Index: chrome/browser/history/history_client_factory.cc |
diff --git a/chrome/browser/history/history_client_factory.cc b/chrome/browser/history/history_client_factory.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..b4149fb7874295fa088b81831f4c99a0b6ed1d9f |
--- /dev/null |
+++ b/chrome/browser/history/history_client_factory.cc |
@@ -0,0 +1,52 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/history/history_client_factory.h" |
+ |
+#include "chrome/browser/profiles/incognito_helpers.h" |
+#include "chrome/browser/profiles/profile.h" |
+#include "components/history/core/browser/history_client.h" |
+#include "components/keyed_service/content/browser_context_dependency_manager.h" |
+ |
+using history::HistoryClient; |
+ |
+// static |
+HistoryClient* HistoryClientFactory::GetForProfile(Profile* profile) { |
+ return static_cast<history::HistoryClient*>( |
+ GetInstance()->GetServiceForBrowserContext(profile, true)); |
+} |
+ |
+// static |
+HistoryClient* HistoryClientFactory::GetForProfileIfExists(Profile* profile) { |
+ return static_cast<history::HistoryClient*>( |
+ GetInstance()->GetServiceForBrowserContext(profile, false)); |
+} |
+ |
+// static |
+HistoryClientFactory* HistoryClientFactory::GetInstance() { |
+ return Singleton<HistoryClientFactory>::get(); |
+} |
+ |
+HistoryClientFactory::HistoryClientFactory() |
+ : BrowserContextKeyedServiceFactory( |
+ "HistoryClient", |
+ BrowserContextDependencyManager::GetInstance()) { |
+} |
+ |
+HistoryClientFactory::~HistoryClientFactory() { |
+} |
+ |
+KeyedService* HistoryClientFactory::BuildServiceInstanceFor( |
+ content::BrowserContext* context) const { |
+ return new HistoryClient(); |
+} |
+ |
+content::BrowserContext* HistoryClientFactory::GetBrowserContextToUse( |
+ content::BrowserContext* context) const { |
+ return chrome::GetBrowserContextRedirectedInIncognito(context); |
+} |
+ |
+bool HistoryClientFactory::ServiceIsNULLWhileTesting() const { |
+ return true; |
+} |