Commit 68471b7b authored by sdefresne's avatar sdefresne Committed by Commit bot

Cleanup ChromeHistoryClientFactory

Change interface of GetForProfile() to return an history::HistoryClient*
instead of a ChromeHistoryClient* since no-one depends on the more typed
return value.

Remove unused GetForProfileWithoutCreating() method which is no longer
used (and the corresponding comment).

BUG=None

Review URL: https://codereview.chromium.org/1020913002

Cr-Commit-Position: refs/heads/master@{#321589}
parent ea4ff17f
...@@ -254,7 +254,7 @@ class AndroidProviderBackendTest : public testing::Test { ...@@ -254,7 +254,7 @@ class AndroidProviderBackendTest : public testing::Test {
base::MessageLoopForUI message_loop_; base::MessageLoopForUI message_loop_;
content::TestBrowserThread ui_thread_; content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_; content::TestBrowserThread file_thread_;
ChromeHistoryClient* history_client_; history::HistoryClient* history_client_;
DISALLOW_COPY_AND_ASSIGN(AndroidProviderBackendTest); DISALLOW_COPY_AND_ASSIGN(AndroidProviderBackendTest);
}; };
......
...@@ -12,19 +12,12 @@ ...@@ -12,19 +12,12 @@
#include "components/keyed_service/content/browser_context_dependency_manager.h" #include "components/keyed_service/content/browser_context_dependency_manager.h"
// static // static
ChromeHistoryClient* ChromeHistoryClientFactory::GetForProfile( history::HistoryClient* ChromeHistoryClientFactory::GetForProfile(
Profile* profile) { Profile* profile) {
return static_cast<ChromeHistoryClient*>( return static_cast<history::HistoryClient*>(
GetInstance()->GetServiceForBrowserContext(profile, true)); GetInstance()->GetServiceForBrowserContext(profile, true));
} }
// static
ChromeHistoryClient* ChromeHistoryClientFactory::GetForProfileWithoutCreating(
Profile* profile) {
return static_cast<ChromeHistoryClient*>(
GetInstance()->GetServiceForBrowserContext(profile, false));
}
// static // static
ChromeHistoryClientFactory* ChromeHistoryClientFactory::GetInstance() { ChromeHistoryClientFactory* ChromeHistoryClientFactory::GetInstance() {
return Singleton<ChromeHistoryClientFactory>::get(); return Singleton<ChromeHistoryClientFactory>::get();
...@@ -42,7 +35,7 @@ ChromeHistoryClientFactory::~ChromeHistoryClientFactory() { ...@@ -42,7 +35,7 @@ ChromeHistoryClientFactory::~ChromeHistoryClientFactory() {
KeyedService* ChromeHistoryClientFactory::BuildServiceInstanceFor( KeyedService* ChromeHistoryClientFactory::BuildServiceInstanceFor(
content::BrowserContext* context) const { content::BrowserContext* context) const {
Profile* profile = static_cast<Profile*>(context); Profile* profile = Profile::FromBrowserContext(context);
return new ChromeHistoryClient(BookmarkModelFactory::GetForProfile(profile)); return new ChromeHistoryClient(BookmarkModelFactory::GetForProfile(profile));
} }
......
...@@ -10,20 +10,17 @@ ...@@ -10,20 +10,17 @@
template <typename T> template <typename T>
struct DefaultSingletonTraits; struct DefaultSingletonTraits;
class ChromeHistoryClient;
class Profile; class Profile;
namespace history {
class HistoryClient;
}
// Singleton that owns all ChromeHistoryClients and associates them with // Singleton that owns all ChromeHistoryClients and associates them with
// Profiles. // Profiles.
class ChromeHistoryClientFactory : public BrowserContextKeyedServiceFactory { class ChromeHistoryClientFactory : public BrowserContextKeyedServiceFactory {
public: public:
static ChromeHistoryClient* GetForProfile(Profile* profile); static history::HistoryClient* GetForProfile(Profile* profile);
// TODO(sdefresne): remove this once ChromeHistoryClient is no longer an
// HistoryServiceObserver and can follow the regular shutdown even during
// tests.
static ChromeHistoryClient* GetForProfileWithoutCreating(Profile* profile);
static ChromeHistoryClientFactory* GetInstance(); static ChromeHistoryClientFactory* GetInstance();
private: private:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment