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

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

Issue 10828263: Moving FaviconService to a ProfileKeyedService. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: resyncing with library after revert 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/browser/favicon/favicon_service.h ('k') | chrome/browser/favicon/favicon_service_factory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/favicon/favicon_service.cc
===================================================================
--- chrome/browser/favicon/favicon_service.cc (revision 152993)
+++ chrome/browser/favicon/favicon_service.cc (working copy)
@@ -7,11 +7,11 @@
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_backend.h"
#include "chrome/browser/history/history_service_factory.h"
-#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
#include "chrome/common/url_constants.h"
-FaviconService::FaviconService(Profile* profile) : profile_(profile) {
+FaviconService::FaviconService(HistoryService* history_service)
+ : history_service_(history_service) {
}
FaviconService::Handle FaviconService::GetFavicon(
@@ -21,10 +21,8 @@
const FaviconDataCallback& callback) {
GetFaviconRequest* request = new GetFaviconRequest(callback);
AddRequest(request, consumer);
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
- if (hs)
- hs->GetFavicon(request, icon_url, icon_type);
+ if (history_service_)
+ history_service_->GetFavicon(request, icon_url, icon_type);
else
ForwardEmptyResultAsync(request);
return request->handle();
@@ -38,16 +36,16 @@
const FaviconDataCallback& callback) {
GetFaviconRequest* request = new GetFaviconRequest(callback);
AddRequest(request, consumer);
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
- if (hs)
- hs->UpdateFaviconMappingAndFetch(request, page_url, icon_url, icon_type);
+ if (history_service_)
+ history_service_->UpdateFaviconMappingAndFetch(request, page_url,
+ icon_url, icon_type);
else
ForwardEmptyResultAsync(request);
return request->handle();
}
FaviconService::Handle FaviconService::GetFaviconForURL(
+ Profile* profile,
const GURL& page_url,
int icon_types,
CancelableRequestConsumerBase* consumer,
@@ -58,12 +56,10 @@
if (page_url.SchemeIs(chrome::kChromeUIScheme) ||
page_url.SchemeIs(chrome::kExtensionScheme)) {
ChromeWebUIControllerFactory::GetInstance()->GetFaviconForURL(
- profile_, request, page_url);
+ profile, request, page_url);
} else {
- HistoryService* hs = HistoryServiceFactory::GetForProfile(
- profile_, Profile::EXPLICIT_ACCESS);
- if (hs)
- hs->GetFaviconForURL(request, page_url, icon_types);
+ if (history_service_)
+ history_service_->GetFaviconForURL(request, page_url, icon_types);
else
ForwardEmptyResultAsync(request);
}
@@ -79,10 +75,8 @@
GetFaviconRequest* request = new GetFaviconRequest(callback);
AddRequest(request, consumer);
FaviconService::Handle handle = request->handle();
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
- if (hs)
- hs->GetFaviconForID(request, favicon_id);
+ if (history_service_)
+ history_service_->GetFaviconForID(request, favicon_id);
else
ForwardEmptyResultAsync(request);
@@ -91,36 +85,28 @@
void FaviconService::SetFaviconOutOfDateForPage(const GURL& page_url) {
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
- if (hs)
- hs->SetFaviconOutOfDateForPage(page_url);
+ if (history_service_)
+ history_service_->SetFaviconOutOfDateForPage(page_url);
}
void FaviconService::CloneFavicon(const GURL& old_page_url,
const GURL& new_page_url) {
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
- if (hs)
- hs->CloneFavicon(old_page_url, new_page_url);
+ if (history_service_)
+ history_service_->CloneFavicon(old_page_url, new_page_url);
}
void FaviconService::SetImportedFavicons(
const std::vector<history::ImportedFaviconUsage>& favicon_usage) {
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
- if (hs)
- hs->SetImportedFavicons(favicon_usage);
+ if (history_service_)
+ history_service_->SetImportedFavicons(favicon_usage);
}
void FaviconService::SetFavicon(const GURL& page_url,
const GURL& icon_url,
const std::vector<unsigned char>& image_data,
history::IconType icon_type) {
- HistoryService* hs =
- HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
- if (hs)
- hs->SetFavicon(page_url, icon_url, image_data, icon_type);
+ if (history_service_)
+ history_service_->SetFavicon(page_url, icon_url, image_data, icon_type);
}
FaviconService::~FaviconService() {
« no previous file with comments | « chrome/browser/favicon/favicon_service.h ('k') | chrome/browser/favicon/favicon_service_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698