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

Unified Diff: chrome/browser/ui/webui/favicon_source.cc

Issue 10079024: Normalizes URLs requested for favicons in the password manager dialog. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 8 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/resources/options2/password_manager_list.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 43dd432f1c735f3c907162eed492f86d2e94af4e..b95e6a4b7e326ff48b98ab11442de03c901c84f4 100644
--- a/chrome/browser/ui/webui/favicon_source.cc
+++ b/chrome/browser/ui/webui/favicon_source.cc
@@ -58,8 +58,21 @@ void FaviconSource::StartDataRequest(const std::string& path,
request_size_map_[request_id] = pixel_size;
url = GURL(path.substr(slash + 1));
} else {
+ if (path.size() > 10 && path.substr(0, 10) == "normalize/") {
Evan Stade 2012/04/14 00:32:43 why isn't this normalization just the default?
Kyle Horimoto 2012/04/16 19:08:15 Essentially, any page can have its own favicon (e.
Evan Stade 2012/04/16 20:45:18 in this case I would not call it "normalize", but
Kyle Horimoto 2012/04/17 21:37:39 Done.
+ std::string originalUrl = path.substr(10);
+
+ // If the original URL does not specify a scheme (e.g., example.com
+ // instead of http://example.com), add "http://" as a default.
+ if (originalUrl.find("://") == std::string::npos)
Evan Stade 2012/04/14 00:32:43 probably safest to use GURL for this (it has compl
Kyle Horimoto 2012/04/16 19:08:15 Done.
+ originalUrl = "http://" + originalUrl;
+
+ // Strip the path beyond the top-level domain.
+ url = GURL(originalUrl).GetOrigin();
+ } else {
+ url = GURL(path);
+ }
+
request_size_map_[request_id] = 16;
- url = GURL(path);
}
// Intercept requests for prepopulated pages.
« no previous file with comments | « chrome/browser/resources/options2/password_manager_list.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698