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

Unified Diff: chrome/browser/history/web_history_service_factory.cc

Issue 889553003: Revert of Componentize WebHistoryService (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mon Feb 2 15:10:48 PST 2015 Created 5 years, 11 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
Index: chrome/browser/history/web_history_service_factory.cc
diff --git a/chrome/browser/history/web_history_service_factory.cc b/chrome/browser/history/web_history_service_factory.cc
index af6a715f38ad5c93ba27db9d37e7af98b07377a9..54fd8814ff72c2c3c7260b9e4e81c16f5e6f5915 100644
--- a/chrome/browser/history/web_history_service_factory.cc
+++ b/chrome/browser/history/web_history_service_factory.cc
@@ -4,15 +4,12 @@
#include "chrome/browser/history/web_history_service_factory.h"
+#include "chrome/browser/content_settings/cookie_settings.h"
+#include "chrome/browser/history/web_history_service.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
-#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/sync/profile_sync_service.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
-#include "components/history/core/browser/web_history_service.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
-#include "components/signin/core/browser/profile_oauth2_token_service.h"
-#include "components/signin/core/browser/signin_manager.h"
-#include "net/url_request/url_request_context_getter.h"
namespace {
// Returns true if the user is signed in and full history sync is enabled,
@@ -35,33 +32,29 @@ WebHistoryServiceFactory* WebHistoryServiceFactory::GetInstance() {
// static
history::WebHistoryService* WebHistoryServiceFactory::GetForProfile(
Profile* profile) {
- if (!IsHistorySyncEnabled(profile))
- return nullptr;
-
- return static_cast<history::WebHistoryService*>(
- GetInstance()->GetServiceForBrowserContext(profile, true));
+ if (IsHistorySyncEnabled(profile)) {
+ return static_cast<history::WebHistoryService*>(
+ GetInstance()->GetServiceForBrowserContext(profile, true));
+ }
+ return NULL;
}
KeyedService* WebHistoryServiceFactory::BuildServiceInstanceFor(
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.
- if (!IsHistorySyncEnabled(profile))
- return nullptr;
-
- return new history::WebHistoryService(
- ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
- SigninManagerFactory::GetForProfile(profile),
- profile->GetRequestContext());
+ return IsHistorySyncEnabled(profile) ?
+ new history::WebHistoryService(profile) : NULL;
}
WebHistoryServiceFactory::WebHistoryServiceFactory()
: BrowserContextKeyedServiceFactory(
"WebHistoryServiceFactory",
BrowserContextDependencyManager::GetInstance()) {
+ DependsOn(CookieSettings::Factory::GetInstance());
DependsOn(ProfileOAuth2TokenServiceFactory::GetInstance());
- DependsOn(SigninManagerFactory::GetInstance());
}
WebHistoryServiceFactory::~WebHistoryServiceFactory() {
« no previous file with comments | « chrome/browser/history/web_history_service.cc ('k') | chrome/browser/history/web_history_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698