Index: chrome/browser/chromeos/platform_keys/platform_keys_service_factory.cc |
diff --git a/chrome/browser/chromeos/platform_keys/platform_keys_service_factory.cc b/chrome/browser/chromeos/platform_keys/platform_keys_service_factory.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a1098056505785f2d602a3c5a88b59ccb6bc0945 |
--- /dev/null |
+++ b/chrome/browser/chromeos/platform_keys/platform_keys_service_factory.cc |
@@ -0,0 +1,51 @@ |
+// 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/chromeos/platform_keys/platform_keys_service_factory.h" |
+ |
+#include "base/logging.h" |
+#include "base/memory/singleton.h" |
+#include "chrome/browser/chromeos/platform_keys/platform_keys_service.h" |
+#include "chrome/browser/extensions/extension_system_factory.h" |
+#include "chrome/browser/profiles/incognito_helpers.h" |
+#include "components/keyed_service/content/browser_context_dependency_manager.h" |
+ |
+namespace chromeos { |
+ |
+// static |
+PlatformKeysService* PlatformKeysServiceFactory::GetForBrowserContext( |
+ content::BrowserContext* context) { |
+ return static_cast<PlatformKeysService*>( |
+ GetInstance()->GetServiceForBrowserContext(context, true)); |
+} |
+ |
+// static |
+PlatformKeysServiceFactory* PlatformKeysServiceFactory::GetInstance() { |
+ return Singleton<PlatformKeysServiceFactory>::get(); |
+} |
+ |
+PlatformKeysServiceFactory::PlatformKeysServiceFactory() |
+ : BrowserContextKeyedServiceFactory( |
+ "PlatformKeysService", |
+ BrowserContextDependencyManager::GetInstance()) { |
+ DependsOn(extensions::ExtensionSystemFactory::GetInstance()); |
+} |
+ |
+PlatformKeysServiceFactory::~PlatformKeysServiceFactory() { |
+} |
+ |
+content::BrowserContext* PlatformKeysServiceFactory::GetBrowserContextToUse( |
+ content::BrowserContext* context) const { |
+ return chrome::GetBrowserContextRedirectedInIncognito(context); |
+} |
+ |
+KeyedService* PlatformKeysServiceFactory::BuildServiceInstanceFor( |
+ content::BrowserContext* context) const { |
+ extensions::StateStore* store = |
+ extensions::ExtensionSystem::Get(context)->state_store(); |
+ DCHECK(store); |
+ return new PlatformKeysService(store); |
+} |
+ |
+} // namespace chromeos |