chrome/browser/ui/webui/chrome_url_data_manager_backend.cc
// Parse a URL into the components used to resolve its request. |source_name|
// is the hostname and |path| is the remaining portion of the URL.
Parse a URL into the components used to resolve its request. |source_name|
is the hostname and |path| is the remaining portion of the URL.
Parse a URL into the components used to resolve its request . |source_name| is the hostname and |path| is the remaining portion of the URL .
void URLToRequest(const GURL& url, std::string* source_name,
                  std::string* path) {
  DCHECK(url.SchemeIs(chrome::kChromeDevToolsScheme) ||
         url.SchemeIs(chrome::kChromeUIScheme));
  if (!url.is_valid()) {
    NOTREACHED();
    return;
  }
  source_name->assign(url.host());
  const std::string& spec = url.possibly_invalid_spec();
  const url_parse::Parsed& parsed = url.parsed_for_possibly_invalid_spec();
  int offset = parsed.CountCharactersBefore(url_parse::Parsed::PATH, false) + 1;
  if (offset < static_cast<int>(spec.size()))
    path->assign(spec.substr(offset));
}
void URLToRequest ( const GURL & url , std :: string * source_name , std :: string * path ) { DCHECK ( url . SchemeIs ( chrome :: kChromeDevToolsScheme ) || url . SchemeIs ( chrome :: kChromeUIScheme ) ) ; if ( ! url . is_valid ( ) ) { NOTREACHED ( ) ; return ; } source_name -> assign ( url . host ( ) ) ; const std :: string & spec = url . possibly_invalid_spec ( ) ; const url_parse :: Parsed & parsed = url . parsed_for_possibly_invalid_spec ( ) ; int offset = parsed . CountCharactersBefore ( url_parse :: Parsed :: PATH , false ) + 1 ; if ( offset < static_cast < int > ( spec . size ( ) ) ) path -> assign ( spec . substr ( offset ) ) ; }
Parse a URL into the components used to resolve its request.
Parse a URL into the components used to resolve its request .
// Our input looks like: chrome://source_name/extra_bits?foo . // So the url's "host" is our source, and everything after the host is // the path. // + 1 to skip the slash at the beginning of the path.