summaryrefslogtreecommitdiffstats
path: root/chrome/browser/favicon
diff options
context:
space:
mode:
authoracleung@chromium.org <acleung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-01 02:57:59 +0000
committeracleung@chromium.org <acleung@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-01 02:57:59 +0000
commitb97d2a87cec2e545b961b7ab93e7b0dca6ad584d (patch)
treeeca66aa0f64a4c4ed781f98f8ea7a0b48c38911d /chrome/browser/favicon
parentcaf07b9cb1f178e0596a4060a13c6f904e22deec (diff)
downloadchromium_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/favicon')
-rw-r--r--chrome/browser/favicon/favicon_tab_helper.cc6
-rw-r--r--chrome/browser/favicon/favicon_tab_helper.h7
2 files changed, 12 insertions, 1 deletions
diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc
index 1e5fc52..2000b33 100644
--- a/chrome/browser/favicon/favicon_tab_helper.cc
+++ b/chrome/browser/favicon/favicon_tab_helper.cc
@@ -37,7 +37,8 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(FaviconTabHelper);
FaviconTabHelper::FaviconTabHelper(WebContents* web_contents)
: content::WebContentsObserver(web_contents),
- profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())) {
+ profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())),
+ should_fetch_icons_(true) {
favicon_handler_.reset(new FaviconHandler(profile_, this,
FaviconHandler::FAVICON));
if (chrome::kEnableTouchIcon)
@@ -49,6 +50,9 @@ FaviconTabHelper::~FaviconTabHelper() {
}
void FaviconTabHelper::FetchFavicon(const GURL& url) {
+ if (!should_fetch_icons_)
+ return;
+
favicon_handler_->FetchFavicon(url);
if (touch_icon_handler_.get())
touch_icon_handler_->FetchFavicon(url);
diff --git a/chrome/browser/favicon/favicon_tab_helper.h b/chrome/browser/favicon/favicon_tab_helper.h
index aae2a55..ef62f5d 100644
--- a/chrome/browser/favicon/favicon_tab_helper.h
+++ b/chrome/browser/favicon/favicon_tab_helper.h
@@ -52,6 +52,12 @@ class FaviconTabHelper : public content::WebContentsObserver,
// space is provided for the favicon, and the favicon is never displayed.
virtual bool ShouldDisplayFavicon();
+ // Allows the client to determine if they want to fetch the Favicons as
+ // they are discovered.
+ void set_should_fetch_icons(bool fetch) {
+ should_fetch_icons_ = fetch;
+ }
+
// content::WebContentsObserver override. Must be public, because also
// called from PrerenderContents.
virtual void DidUpdateFaviconURL(
@@ -86,6 +92,7 @@ class FaviconTabHelper : public content::WebContentsObserver,
const std::vector<SkBitmap>& bitmaps);
Profile* profile_;
+ bool should_fetch_icons_;
scoped_ptr<FaviconHandler> favicon_handler_;