Index: chrome/browser/android/blimp/blimp_client_context_factory.cc |
diff --git a/chrome/browser/android/blimp/blimp_client_context_factory.cc b/chrome/browser/android/blimp/blimp_client_context_factory.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5cea361869eb2d7ddd5e371e1be0b90525da349b |
--- /dev/null |
+++ b/chrome/browser/android/blimp/blimp_client_context_factory.cc |
@@ -0,0 +1,41 @@ |
+// Copyright 2016 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/android/blimp/blimp_client_context_factory.h" |
+ |
+#include "base/memory/singleton.h" |
+#include "base/supports_user_data.h" |
+#include "blimp/client/public/blimp_client_context.h" |
+#include "components/keyed_service/content/browser_context_dependency_manager.h" |
+#include "content/public/browser/browser_context.h" |
+ |
+// static |
+BlimpClientContextFactory* BlimpClientContextFactory::GetInstance() { |
+ return base::Singleton<BlimpClientContextFactory>::get(); |
+} |
+ |
+// static |
+blimp::client::BlimpClientContext* |
+BlimpClientContextFactory::GetForBrowserContext( |
+ content::BrowserContext* context) { |
+ return static_cast<blimp::client::BlimpClientContext*>( |
+ GetInstance()->GetServiceForBrowserContext(context, true)); |
+} |
+ |
+BlimpClientContextFactory::BlimpClientContextFactory() |
+ : BrowserContextKeyedServiceFactory( |
+ "blimp::client::BlimpClientContext", |
+ BrowserContextDependencyManager::GetInstance()) {} |
+ |
+BlimpClientContextFactory::~BlimpClientContextFactory() {} |
+ |
+KeyedService* BlimpClientContextFactory::BuildServiceInstanceFor( |
+ content::BrowserContext* context) const { |
+ return blimp::client::BlimpClientContext::Create(); |
+} |
+ |
+content::BrowserContext* BlimpClientContextFactory::GetBrowserContextToUse( |
+ content::BrowserContext* context) const { |
+ return context; |
+} |