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

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

Issue 10873022: Revert 152904 - Moving FaviconService to a ProfileKeyedService. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: 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 152958)
+++ 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(HistoryService* history_service)
- : history_service_(history_service) {
+FaviconService::FaviconService(Profile* profile) : profile_(profile) {
}
FaviconService::Handle FaviconService::GetFavicon(
@@ -21,8 +21,10 @@
const FaviconDataCallback& callback) {
GetFaviconRequest* request = new GetFaviconRequest(callback);
AddRequest(request, consumer);
- if (history_service_)
- history_service_->GetFavicon(request, icon_url, icon_type);
+ HistoryService* hs =
+ HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
+ if (hs)
+ hs->GetFavicon(request, icon_url, icon_type);
else
ForwardEmptyResultAsync(request);
return request->handle();
@@ -36,16 +38,16 @@
const FaviconDataCallback& callback) {
GetFaviconRequest* request = new GetFaviconRequest(callback);
AddRequest(request, consumer);
- if (history_service_)
- history_service_->UpdateFaviconMappingAndFetch(request, page_url,
- icon_url, icon_type);
+ HistoryService* hs =
+ HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
+ if (hs)
+ hs->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,
@@ -56,10 +58,12 @@
if (page_url.SchemeIs(chrome::kChromeUIScheme) ||
page_url.SchemeIs(chrome::kExtensionScheme)) {
ChromeWebUIControllerFactory::GetInstance()->GetFaviconForURL(
- profile, request, page_url);
+ profile_, request, page_url);
} else {
- if (history_service_)
- history_service_->GetFaviconForURL(request, page_url, icon_types);
+ HistoryService* hs = HistoryServiceFactory::GetForProfile(
+ profile_, Profile::EXPLICIT_ACCESS);
+ if (hs)
+ hs->GetFaviconForURL(request, page_url, icon_types);
else
ForwardEmptyResultAsync(request);
}
@@ -75,8 +79,10 @@
GetFaviconRequest* request = new GetFaviconRequest(callback);
AddRequest(request, consumer);
FaviconService::Handle handle = request->handle();
- if (history_service_)
- history_service_->GetFaviconForID(request, favicon_id);
+ HistoryService* hs =
+ HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
+ if (hs)
+ hs->GetFaviconForID(request, favicon_id);
else
ForwardEmptyResultAsync(request);
@@ -85,28 +91,36 @@
void FaviconService::SetFaviconOutOfDateForPage(const GURL& page_url) {
- if (history_service_)
- history_service_->SetFaviconOutOfDateForPage(page_url);
+ HistoryService* hs =
+ HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
+ if (hs)
+ hs->SetFaviconOutOfDateForPage(page_url);
}
void FaviconService::CloneFavicon(const GURL& old_page_url,
const GURL& new_page_url) {
- if (history_service_)
- history_service_->CloneFavicon(old_page_url, new_page_url);
+ HistoryService* hs =
+ HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
+ if (hs)
+ hs->CloneFavicon(old_page_url, new_page_url);
}
void FaviconService::SetImportedFavicons(
const std::vector<history::ImportedFaviconUsage>& favicon_usage) {
- if (history_service_)
- history_service_->SetImportedFavicons(favicon_usage);
+ HistoryService* hs =
+ HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
+ if (hs)
+ hs->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) {
- if (history_service_)
- history_service_->SetFavicon(page_url, icon_url, image_data, icon_type);
+ HistoryService* hs =
+ HistoryServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS);
+ if (hs)
+ hs->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