diff options
author | acleung@chromium.org <acleung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-01 02:57:59 +0000 |
---|---|---|
committer | acleung@chromium.org <acleung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-01 02:57:59 +0000 |
commit | b97d2a87cec2e545b961b7ab93e7b0dca6ad584d (patch) | |
tree | eca66aa0f64a4c4ed781f98f8ea7a0b48c38911d /chrome/browser/prerender | |
parent | caf07b9cb1f178e0596a4060a13c6f904e22deec (diff) | |
download | chromium_src-b97d2a87cec2e545b961b7ab93e7b0dca6ad584d.zip chromium_src-b97d2a87cec2e545b961b7ab93e7b0dca6ad584d.tar.gz chromium_src-b97d2a87cec2e545b961b7ab93e7b0dca6ad584d.tar.bz2 |
Delays favicon fetching in prerender.
BUG=171073
Review URL: https://chromiumcodereview.appspot.com/12218017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@185423 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/prerender')
-rw-r--r-- | chrome/browser/prerender/prerender_contents.cc | 7 | ||||
-rw-r--r-- | chrome/browser/prerender/prerender_manager.cc | 10 |
2 files changed, 17 insertions, 0 deletions
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc index e04f16c..b6e2d1f 100644 --- a/chrome/browser/prerender/prerender_contents.cc +++ b/chrome/browser/prerender/prerender_contents.cc @@ -9,6 +9,7 @@ #include <utility> #include "base/utf_string_conversions.h" +#include "chrome/browser/favicon/favicon_tab_helper.h" #include "chrome/browser/history/history_tab_helper.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/prerender/prerender_final_status.h" @@ -278,6 +279,12 @@ void PrerenderContents::StartPrerendering( prerender_contents_.reset(CreateWebContents(session_storage_namespace)); BrowserTabContents::AttachTabHelpers(prerender_contents_.get()); +#if defined(OS_ANDROID) + // Delay icon fetching until the contents are getting swapped in + // to conserve network usage in mobile devices. + FaviconTabHelper::FromWebContents( + prerender_contents_.get())->set_should_fetch_icons(false); +#endif // defined(OS_ANDROID) content::WebContentsObserver::Observe(prerender_contents_.get()); web_contents_delegate_.reset(new WebContentsDelegateImpl(this)); diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc index 2f8cf69..53289f4 100644 --- a/chrome/browser/prerender/prerender_manager.cc +++ b/chrome/browser/prerender/prerender_manager.cc @@ -456,7 +456,17 @@ bool PrerenderManager::MaybeUsePrerenderedPage(WebContents* web_contents, prerender_contents->CommitHistory(new_web_contents); GURL icon_url = prerender_contents->icon_url(); + if (!icon_url.is_empty()) { +#if defined(OS_ANDROID) + // Do the delayed icon fetch since we didn't download + // the favicon during prerendering on mobile devices. + FaviconTabHelper * favicon_tap_helper = + FaviconTabHelper::FromWebContents(new_web_contents); + favicon_tap_helper->set_should_fetch_icons(true); + favicon_tap_helper->FetchFavicon(icon_url); +#endif // defined(OS_ANDROID) + std::vector<content::FaviconURL> urls; urls.push_back(content::FaviconURL(icon_url, content::FaviconURL::FAVICON)); FaviconTabHelper::FromWebContents(new_web_contents)-> |