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

Unified Diff: chrome/browser/favicon/favicon_tab_helper.cc

Issue 11195010: Extract Favicon Download logic from FaviconTabHelper (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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/favicon/favicon_tab_helper.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/favicon/favicon_tab_helper.cc
diff --git a/chrome/browser/favicon/favicon_tab_helper.cc b/chrome/browser/favicon/favicon_tab_helper.cc
index 6525b0664ab790bab6e94c762c9dfe502ccdd61c..027061e4822aaeced6a0e1340f95e2c8daf15057 100644
--- a/chrome/browser/favicon/favicon_tab_helper.cc
+++ b/chrome/browser/favicon/favicon_tab_helper.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/favicon/favicon_tab_helper.h"
+#include "chrome/browser/favicon/favicon_download_helper.h"
#include "chrome/browser/favicon/favicon_handler.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/favicon/favicon_util.h"
@@ -38,6 +39,7 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(FaviconTabHelper)
FaviconTabHelper::FaviconTabHelper(WebContents* web_contents)
: content::WebContentsObserver(web_contents),
profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())) {
+ favicon_download_helper_.reset(new FaviconDownloadHelper(web_contents, this));
favicon_handler_.reset(new FaviconHandler(profile_, this,
FaviconHandler::FAVICON));
if (chrome::kEnableTouchIcon)
@@ -93,6 +95,14 @@ bool FaviconTabHelper::ShouldDisplayFavicon() {
return true;
}
+void FaviconTabHelper::OnUpdateFaviconURL(
+ int32 page_id,
+ const std::vector<FaviconURL>& candidates) {
+ favicon_handler_->OnUpdateFaviconURL(page_id, candidates);
+ if (touch_icon_handler_.get())
+ touch_icon_handler_->OnUpdateFaviconURL(page_id, candidates);
+}
+
void FaviconTabHelper::SaveFavicon() {
NavigationEntry* entry = web_contents()->GetController().GetActiveEntry();
if (!entry || entry->GetURL().is_empty())
@@ -132,22 +142,12 @@ int FaviconTabHelper::DownloadImage(const GURL& image_url,
return 0;
}
-void FaviconTabHelper::OnUpdateFaviconURL(
- int32 page_id,
- const std::vector<FaviconURL>& candidates) {
- favicon_handler_->OnUpdateFaviconURL(page_id, candidates);
- if (touch_icon_handler_.get())
- touch_icon_handler_->OnUpdateFaviconURL(page_id, candidates);
-}
-
NavigationEntry* FaviconTabHelper::GetActiveEntry() {
return web_contents()->GetController().GetActiveEntry();
}
int FaviconTabHelper::StartDownload(const GURL& url, int image_size) {
- content::RenderViewHost* host = web_contents()->GetRenderViewHost();
- int id = FaviconUtil::DownloadFavicon(host, url, image_size);
- return id;
+ return favicon_download_helper_->DownloadFavicon(url, image_size);
}
void FaviconTabHelper::NotifyFaviconUpdated() {
@@ -177,16 +177,6 @@ void FaviconTabHelper::DidNavigateMainFrame(
FetchFavicon(details.entry->GetURL());
}
-bool FaviconTabHelper::OnMessageReceived(const IPC::Message& message) {
- bool message_handled = false; // Allow other handlers to receive these.
- IPC_BEGIN_MESSAGE_MAP(FaviconTabHelper, message)
- IPC_MESSAGE_HANDLER(IconHostMsg_DidDownloadFavicon, OnDidDownloadFavicon)
- IPC_MESSAGE_HANDLER(IconHostMsg_UpdateFaviconURL, OnUpdateFaviconURL)
- IPC_MESSAGE_UNHANDLED(message_handled = false)
- IPC_END_MESSAGE_MAP()
- return message_handled;
-}
-
void FaviconTabHelper::OnDidDownloadFavicon(
int id,
const GURL& image_url,
« no previous file with comments | « chrome/browser/favicon/favicon_tab_helper.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698