OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/android/blimp/blimp_client_context_factory.h" |
| 6 |
| 7 #include "base/memory/singleton.h" |
| 8 #include "base/supports_user_data.h" |
| 9 #include "blimp/client/public/blimp_client_context.h" |
| 10 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 11 #include "content/public/browser/browser_context.h" |
| 12 |
| 13 namespace chrome { |
| 14 |
| 15 // static |
| 16 BlimpClientContextFactory* BlimpClientContextFactory::GetInstance() { |
| 17 return base::Singleton<BlimpClientContextFactory>::get(); |
| 18 } |
| 19 |
| 20 // static |
| 21 blimp::client::BlimpClientContext* |
| 22 BlimpClientContextFactory::GetForBrowserContext( |
| 23 content::BrowserContext* context) { |
| 24 return static_cast<blimp::client::BlimpClientContext*>( |
| 25 GetInstance()->GetServiceForBrowserContext(context, true)); |
| 26 } |
| 27 |
| 28 BlimpClientContextFactory::BlimpClientContextFactory() |
| 29 : BrowserContextKeyedServiceFactory( |
| 30 "blimp::client::BlimpClientContext", |
| 31 BrowserContextDependencyManager::GetInstance()) {} |
| 32 |
| 33 BlimpClientContextFactory::~BlimpClientContextFactory() {} |
| 34 |
| 35 KeyedService* BlimpClientContextFactory::BuildServiceInstanceFor( |
| 36 content::BrowserContext* context) const { |
| 37 return blimp::client::BlimpClientContext::Create(); |
| 38 } |
| 39 |
| 40 content::BrowserContext* BlimpClientContextFactory::GetBrowserContextToUse( |
| 41 content::BrowserContext* context) const { |
| 42 return context; |
| 43 } |
| 44 |
| 45 } // namespace chrome |
OLD | NEW |