Chromium Code Reviews| Index: chrome/browser/ui/webui/favicon_source.cc |
| diff --git a/chrome/browser/ui/webui/favicon_source.cc b/chrome/browser/ui/webui/favicon_source.cc |
| index 0552d874ecdbc5ae58e503e858e741c326b63bf5..90bce1facc4cb73dd4f563f04d105e2247a9b37c 100644 |
| --- a/chrome/browser/ui/webui/favicon_source.cc |
| +++ b/chrome/browser/ui/webui/favicon_source.cc |
| @@ -161,8 +161,9 @@ bool FaviconSource::ShouldReplaceExistingSource() const { |
| bool FaviconSource::ShouldServiceRequest(const net::URLRequest* request) const { |
| if (request->url().SchemeIs(chrome::kChromeSearchScheme)) { |
| - return InstantService::IsInstantPath(request->url()) && |
| - InstantIOContext::ShouldServiceRequest(request); |
| + // Strip leading slash. |
| + std::string path = request->url().path().substr(1); |
|
Jered
2013/05/31 17:34:33
Why do the !path.empty() check here? I think we ca
kmadhusu
2013/06/04 02:36:01
It was just a safety check. Removed.
|
| + return !path.empty() && InstantIOContext::ShouldServiceRequest(request); |
| } |
| return URLDataSource::ShouldServiceRequest(request); |
| } |
| @@ -188,33 +189,28 @@ bool FaviconSource::ParsePath(const std::string& raw_path, |
| if (raw_path.empty()) |
| return false; |
| - // Translate to regular path if |raw_path| is of the form |
| - // chrome-search://favicon/<most_visited_item_id>, where |
| - // "most_visited_item_id" is a uint64. |
| - std::string path = InstantService::MaybeTranslateInstantPathOnUI(profile_, |
| - raw_path); |
| size_t parsed_index = 0; |
| - if (HasSubstringAt(path, parsed_index, kLargestParameter)) { |
| + if (HasSubstringAt(raw_path, parsed_index, kLargestParameter)) { |
| parsed_index += strlen(kLargestParameter); |
| *size_in_dip = 0; |
| - } else if (HasSubstringAt(path, parsed_index, kSizeParameter)) { |
| + } else if (HasSubstringAt(raw_path, parsed_index, kSizeParameter)) { |
| parsed_index += strlen(kSizeParameter); |
| - size_t slash = path.find("/", parsed_index); |
| + size_t slash = raw_path.find("/", parsed_index); |
| if (slash == std::string::npos) |
| return false; |
| - size_t scale_delimiter = path.find("@", parsed_index); |
| + size_t scale_delimiter = raw_path.find("@", parsed_index); |
| std::string size_str; |
| std::string scale_str; |
| if (scale_delimiter == std::string::npos) { |
| // Support the legacy size format of 'size/aa/' where 'aa' is the desired |
| // size in DIP for the sake of not regressing the extensions which use it. |
| - size_str = path.substr(parsed_index, slash - parsed_index); |
| + size_str = raw_path.substr(parsed_index, slash - parsed_index); |
| } else { |
| - size_str = path.substr(parsed_index, scale_delimiter - parsed_index); |
| - scale_str = path.substr(scale_delimiter + 1, |
| - slash - scale_delimiter - 1); |
| + size_str = raw_path.substr(parsed_index, scale_delimiter - parsed_index); |
| + scale_str = raw_path.substr(scale_delimiter + 1, |
| + slash - scale_delimiter - 1); |
| } |
| if (!base::StringToInt(size_str, size_in_dip)) |
| @@ -240,17 +236,17 @@ bool FaviconSource::ParsePath(const std::string& raw_path, |
| parsed_index = slash + 1; |
| } |
| - if (HasSubstringAt(path, parsed_index, kIconURLParameter)) { |
| + if (HasSubstringAt(raw_path, parsed_index, kIconURLParameter)) { |
| parsed_index += strlen(kIconURLParameter); |
| *is_icon_url = true; |
| - *url = GURL(path.substr(parsed_index)); |
| + *url = GURL(raw_path.substr(parsed_index)); |
| } else { |
| // URL requests prefixed with "origin/" are converted to a form with an |
| // empty path and a valid scheme. (e.g., example.com --> |
| // http://example.com/ or http://example.com/a --> http://example.com/) |
| - if (HasSubstringAt(path, parsed_index, kOriginParameter)) { |
| + if (HasSubstringAt(raw_path, parsed_index, kOriginParameter)) { |
| parsed_index += strlen(kOriginParameter); |
| - std::string possibly_invalid_url = path.substr(parsed_index); |
| + std::string possibly_invalid_url = raw_path.substr(parsed_index); |
| // If the URL does not specify a scheme (e.g., example.com instead of |
| // http://example.com), add "http://" as a default. |
| @@ -260,7 +256,7 @@ bool FaviconSource::ParsePath(const std::string& raw_path, |
| // Strip the path beyond the top-level domain. |
| *url = GURL(possibly_invalid_url).GetOrigin(); |
| } else { |
| - *url = GURL(path.substr(parsed_index)); |
| + *url = GURL(raw_path.substr(parsed_index)); |
| } |
| } |
| return true; |