summaryrefslogtreecommitdiffstats
path: root/chrome/browser/history
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-26 18:09:02 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-26 18:09:02 +0000
commitc7fa4367503441fefc7da332b0bddd329ceea9dd (patch)
treeb1469aab9cb635f9f00096b7f746047272474690 /chrome/browser/history
parentaca70615b08a5d741e5a10b91c8746e74d66f897 (diff)
downloadchromium_src-c7fa4367503441fefc7da332b0bddd329ceea9dd.zip
chromium_src-c7fa4367503441fefc7da332b0bddd329ceea9dd.tar.gz
chromium_src-c7fa4367503441fefc7da332b0bddd329ceea9dd.tar.bz2
[components] Switch {RefCounted}ProfileKeyedService to use BrowserContext
instead of Profile. This will help move it out of chrome. BUG=227219 Review URL: https://codereview.chromium.org/14141006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196777 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r--chrome/browser/history/history_service_factory.cc4
-rw-r--r--chrome/browser/history/history_service_factory.h2
-rw-r--r--chrome/browser/history/shortcuts_backend_factory.cc17
-rw-r--r--chrome/browser/history/shortcuts_backend_factory.h6
-rw-r--r--chrome/browser/history/web_history_service_factory.cc4
-rw-r--r--chrome/browser/history/web_history_service_factory.h2
6 files changed, 22 insertions, 13 deletions
diff --git a/chrome/browser/history/history_service_factory.cc b/chrome/browser/history/history_service_factory.cc
index 813c0a0..fa0c2d6 100644
--- a/chrome/browser/history/history_service_factory.cc
+++ b/chrome/browser/history/history_service_factory.cc
@@ -64,7 +64,9 @@ HistoryServiceFactory::~HistoryServiceFactory() {
}
ProfileKeyedService*
-HistoryServiceFactory::BuildServiceInstanceFor(Profile* profile) const {
+HistoryServiceFactory::BuildServiceInstanceFor(
+ content::BrowserContext* context) const {
+ Profile* profile = static_cast<Profile*>(context);
HistoryService* history_service = new HistoryService(profile);
if (!history_service->Init(profile->GetPath(),
BookmarkModelFactory::GetForProfile(profile))) {
diff --git a/chrome/browser/history/history_service_factory.h b/chrome/browser/history/history_service_factory.h
index 9927902..ba8a029 100644
--- a/chrome/browser/history/history_service_factory.h
+++ b/chrome/browser/history/history_service_factory.h
@@ -40,7 +40,7 @@ class HistoryServiceFactory : public ProfileKeyedServiceFactory {
// ProfileKeyedServiceFactory:
virtual ProfileKeyedService* BuildServiceInstanceFor(
- Profile* profile) const OVERRIDE;
+ content::BrowserContext* context) const OVERRIDE;
virtual bool ServiceRedirectedInIncognito() const OVERRIDE;
virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
};
diff --git a/chrome/browser/history/shortcuts_backend_factory.cc b/chrome/browser/history/shortcuts_backend_factory.cc
index 566dbae..dbfdf53 100644
--- a/chrome/browser/history/shortcuts_backend_factory.cc
+++ b/chrome/browser/history/shortcuts_backend_factory.cc
@@ -6,6 +6,7 @@
#include "base/prefs/pref_service.h"
#include "chrome/browser/history/shortcuts_backend.h"
+#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_dependency_manager.h"
#include "chrome/common/pref_names.h"
@@ -32,18 +33,21 @@ ShortcutsBackendFactory* ShortcutsBackendFactory::GetInstance() {
// static
scoped_refptr<RefcountedProfileKeyedService>
-ShortcutsBackendFactory::BuildProfileForTesting(Profile* profile) {
+ShortcutsBackendFactory::BuildProfileForTesting(
+ content::BrowserContext* profile) {
scoped_refptr<history::ShortcutsBackend> backend(
- new ShortcutsBackend(profile, false));
+ new ShortcutsBackend(static_cast<Profile*>(profile), false));
if (backend->Init())
return backend;
return NULL;
}
+// static
scoped_refptr<RefcountedProfileKeyedService>
-ShortcutsBackendFactory::BuildProfileNoDatabaseForTesting(Profile* profile) {
+ShortcutsBackendFactory::BuildProfileNoDatabaseForTesting(
+ content::BrowserContext* profile) {
scoped_refptr<history::ShortcutsBackend> backend(
- new ShortcutsBackend(profile, true));
+ new ShortcutsBackend(static_cast<Profile*>(profile), true));
if (backend->Init())
return backend;
return NULL;
@@ -58,9 +62,10 @@ ShortcutsBackendFactory::ShortcutsBackendFactory()
ShortcutsBackendFactory::~ShortcutsBackendFactory() {}
scoped_refptr<RefcountedProfileKeyedService>
-ShortcutsBackendFactory::BuildServiceInstanceFor(Profile* profile) const {
+ShortcutsBackendFactory::BuildServiceInstanceFor(
+ content::BrowserContext* profile) const {
scoped_refptr<history::ShortcutsBackend> backend(
- new ShortcutsBackend(profile, false));
+ new ShortcutsBackend(static_cast<Profile*>(profile), false));
if (backend->Init())
return backend;
return NULL;
diff --git a/chrome/browser/history/shortcuts_backend_factory.h b/chrome/browser/history/shortcuts_backend_factory.h
index 272b2d0..b15f57c 100644
--- a/chrome/browser/history/shortcuts_backend_factory.h
+++ b/chrome/browser/history/shortcuts_backend_factory.h
@@ -29,12 +29,12 @@ class ShortcutsBackendFactory : public RefcountedProfileKeyedServiceFactory {
// Creates and returns a backend for testing purposes.
static scoped_refptr<RefcountedProfileKeyedService>
- BuildProfileForTesting(Profile* profile);
+ BuildProfileForTesting(content::BrowserContext* profile);
// Creates and returns a backend but without creating its persistent database
// for testing purposes.
static scoped_refptr<RefcountedProfileKeyedService>
- BuildProfileNoDatabaseForTesting(Profile* profile);
+ BuildProfileNoDatabaseForTesting(content::BrowserContext* profile);
private:
friend struct DefaultSingletonTraits<ShortcutsBackendFactory>;
@@ -44,7 +44,7 @@ class ShortcutsBackendFactory : public RefcountedProfileKeyedServiceFactory {
// ProfileKeyedServiceFactory:
virtual scoped_refptr<RefcountedProfileKeyedService> BuildServiceInstanceFor(
- Profile* profile) const OVERRIDE;
+ content::BrowserContext* profile) const OVERRIDE;
virtual bool ServiceIsNULLWhileTesting() const OVERRIDE;
};
diff --git a/chrome/browser/history/web_history_service_factory.cc b/chrome/browser/history/web_history_service_factory.cc
index 66a3b33..bc5f689 100644
--- a/chrome/browser/history/web_history_service_factory.cc
+++ b/chrome/browser/history/web_history_service_factory.cc
@@ -45,7 +45,9 @@ history::WebHistoryService* WebHistoryServiceFactory::GetForProfile(
}
ProfileKeyedService* WebHistoryServiceFactory::BuildServiceInstanceFor(
- Profile* profile) const {
+ content::BrowserContext* context) const {
+ Profile* profile = static_cast<Profile*>(context);
+
// Ensure that the service is not instantiated or used if the user is not
// signed into sync, or if web history is not enabled.
return IsHistorySyncEnabled(profile) ?
diff --git a/chrome/browser/history/web_history_service_factory.h b/chrome/browser/history/web_history_service_factory.h
index e37f725..00e1084 100644
--- a/chrome/browser/history/web_history_service_factory.h
+++ b/chrome/browser/history/web_history_service_factory.h
@@ -26,7 +26,7 @@ class WebHistoryServiceFactory : public ProfileKeyedServiceFactory {
protected:
// Overridden from ProfileKeyedServiceFactory.
virtual ProfileKeyedService* BuildServiceInstanceFor(
- Profile* profile) const OVERRIDE;
+ content::BrowserContext* context) const OVERRIDE;
private:
friend struct DefaultSingletonTraits<WebHistoryServiceFactory>;