summaryrefslogtreecommitdiffstats
path: root/chrome/browser/favicon/favicon_service.cc
diff options
context:
space:
mode:
authorricow@chromium.org <ricow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-23 06:58:39 +0000
committerricow@chromium.org <ricow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-08-23 06:58:39 +0000
commit8c715080dced54bec5d13862ed6a0da9974405e8 (patch)
tree56419cd3184ee559d34e718358ca67302b320b48 /chrome/browser/favicon/favicon_service.cc
parent85b667621215f8a8e97abc641c7ec88bfe84587c (diff)
downloadchromium_src-8c715080dced54bec5d13862ed6a0da9974405e8.zip
chromium_src-8c715080dced54bec5d13862ed6a0da9974405e8.tar.gz
chromium_src-8c715080dced54bec5d13862ed6a0da9974405e8.tar.bz2
Revert 152904 - Moving FaviconService to a ProfileKeyedService.
BUG=112526 Review URL: https://chromiumcodereview.appspot.com/10828263 This seems to be causing win7 sync issues. TBR=rlp@chromium.org Review URL: https://chromiumcodereview.appspot.com/10873022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@152959 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/favicon/favicon_service.cc')
-rw-r--r--chrome/browser/favicon/favicon_service.cc56
1 files changed, 35 insertions, 21 deletions
diff --git a/chrome/browser/favicon/favicon_service.cc b/chrome/browser/favicon/favicon_service.cc
index ff3d6e5..6c55b30 100644
--- a/chrome/browser/favicon/favicon_service.cc
+++ b/chrome/browser/favicon/favicon_service.cc
@@ -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 @@ FaviconService::Handle FaviconService::GetFavicon(
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 @@ FaviconService::Handle FaviconService::UpdateFaviconMappingAndFetch(
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 @@ FaviconService::Handle FaviconService::GetFaviconForURL(
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 @@ FaviconService::Handle FaviconService::GetFaviconForID(
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 @@ FaviconService::Handle FaviconService::GetFaviconForID(
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() {