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

Unified Diff: chrome/renderer/chrome_render_view_observer.cc

Issue 10831163: Update favicon URLs on FinishLoad for main frame (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comments and description changes. Created 8 years, 4 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/renderer/chrome_render_view_observer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/chrome_render_view_observer.cc
diff --git a/chrome/renderer/chrome_render_view_observer.cc b/chrome/renderer/chrome_render_view_observer.cc
index 9d820967d6dfee9bf5bed81c71c2830eb39bd1e2..4625e6206e29ffa49e174a27d8107611aa04c377 100644
--- a/chrome/renderer/chrome_render_view_observer.cc
+++ b/chrome/renderer/chrome_render_view_observer.cc
@@ -696,13 +696,11 @@ void ChromeRenderViewObserver::DidStopLoading() {
routing_id(), render_view()->GetPageId(), osd_url,
search_provider::AUTODETECTED_PROVIDER));
}
+}
- int icon_types = WebIconURL::TypeFavicon;
- if (chrome::kEnableTouchIcon)
- icon_types |= WebIconURL::TypeTouchPrecomposed | WebIconURL::TypeTouch;
-
- WebVector<WebIconURL> icon_urls =
- render_view()->GetWebView()->mainFrame()->iconURLs(icon_types);
+void ChromeRenderViewObserver::CollectAndUpdateFaviconURLs(
darin (slow to review) 2012/08/06 20:46:32 please list functions in the .cpp file in the same
aruslan 2012/08/06 20:52:27 Done.
+ WebKit::WebFrame* frame, int icon_types) {
+ WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_types);
std::vector<FaviconURL> urls;
for (size_t i = 0; i < icon_urls.size(); i++) {
WebURL url = icon_urls[i].iconURL();
@@ -715,6 +713,21 @@ void ChromeRenderViewObserver::DidStopLoading() {
}
}
+void ChromeRenderViewObserver::DidFinishLoad(WebKit::WebFrame* frame) {
+ if (frame->parent())
+ return;
+
+ // Please note that we are updating favicons only for the _main_ frame.
+ // Updating Favicon URLs at DidFinishLoad ensures that icon loads always get
+ // initiated after all of the other page resources have been fetched, so icon
+ // loads should not compete with page resources for network bandwidth.
+ int icon_types = WebIconURL::TypeFavicon;
+ if (chrome::kEnableTouchIcon)
+ icon_types |= WebIconURL::TypeTouchPrecomposed | WebIconURL::TypeTouch;
+
+ CollectAndUpdateFaviconURLs(frame, icon_types);
+}
+
void ChromeRenderViewObserver::DidChangeIcon(WebFrame* frame,
WebIconURL::Type icon_type) {
if (frame->parent())
@@ -724,14 +737,7 @@ void ChromeRenderViewObserver::DidChangeIcon(WebFrame* frame,
icon_type != WebIconURL::TypeFavicon)
return;
- WebVector<WebIconURL> icon_urls = frame->iconURLs(icon_type);
- std::vector<FaviconURL> urls;
- for (size_t i = 0; i < icon_urls.size(); i++) {
- urls.push_back(FaviconURL(icon_urls[i].iconURL(),
- ToFaviconType(icon_urls[i].iconType())));
- }
- Send(new IconHostMsg_UpdateFaviconURL(
- routing_id(), render_view()->GetPageId(), urls));
+ CollectAndUpdateFaviconURLs(frame, icon_type);
}
void ChromeRenderViewObserver::DidCommitProvisionalLoad(
« no previous file with comments | « chrome/renderer/chrome_render_view_observer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698