Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7909)

Unified Diff: chrome/common/favicon/favicon_url_parser.cc

Issue 861333002: [Favicon] Minor code cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed DCHECK(). Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/favicon_source.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/favicon/favicon_url_parser.cc
diff --git a/chrome/common/favicon/favicon_url_parser.cc b/chrome/common/favicon/favicon_url_parser.cc
index 16d78af4e9f816f4b8984310c7bd4518c5fe9118..5f0bdf70d111eb851271690fee01679212a84d27 100644
--- a/chrome/common/favicon/favicon_url_parser.cc
+++ b/chrome/common/favicon/favicon_url_parser.cc
@@ -96,24 +96,22 @@ bool ParseFaviconPath(const std::string& path,
parsed_index += strlen(kIconURLParameter);
parsed->is_icon_url = true;
parsed->url = path.substr(parsed_index);
- } else {
+ } else if (HasSubstringAt(path, parsed_index, kOriginParameter)) {
// 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)) {
- parsed_index += strlen(kOriginParameter);
- std::string possibly_invalid_url = path.substr(parsed_index);
+ parsed_index += strlen(kOriginParameter);
+ std::string possibly_invalid_url = 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.
- if (!GURL(possibly_invalid_url).has_scheme())
- possibly_invalid_url = "http://" + possibly_invalid_url;
+ // If the URL does not specify a scheme (e.g., example.com instead of
+ // http://example.com), add "http://" as a default.
+ if (!GURL(possibly_invalid_url).has_scheme())
+ possibly_invalid_url = "http://" + possibly_invalid_url;
- // Strip the path beyond the top-level domain.
- parsed->url = GURL(possibly_invalid_url).GetOrigin().spec();
- } else {
- parsed->url = path.substr(parsed_index);
- }
+ // Strip the path beyond the top-level domain.
+ parsed->url = GURL(possibly_invalid_url).GetOrigin().spec();
+ } else {
+ parsed->url = path.substr(parsed_index);
}
// The parsed index needs to be returned in order to allow Instant Extended
« no previous file with comments | « chrome/browser/ui/webui/favicon_source.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698