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