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

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: Updated comments 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..6f064ab26f72b38eaf1ff09df13476d6df123575 100644
--- a/chrome/browser/ui/webui/favicon_source.cc
+++ b/chrome/browser/ui/webui/favicon_source.cc
@@ -58,8 +58,24 @@ void FaviconSource::StartDataRequest(const std::string& path,
request_size_map_[request_id] = pixel_size;
url = GURL(path.substr(slash + 1));
} 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 (path.size() > 7 && path.substr(0, 7) == "origin/") {
+ std::string originalUrl = path.substr(7);
+
+ // If the original URL does not specify a scheme (e.g., example.com
+ // instead of http://example.com), add "http://" as a default.
+ if (!GURL(originalUrl).has_scheme())
+ 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