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 "blimp/client/public/compositor/compositor_dependencies.h" | 10 #include "blimp/client/public/compositor/compositor_dependencies.h" |
| 11 #include "chrome/browser/android/blimp/chrome_compositor_dependencies.h" |
11 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 12 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
12 #include "content/public/browser/browser_context.h" | 13 #include "content/public/browser/browser_context.h" |
13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "ui/android/context_provider_factory.h" |
14 | 16 |
15 // static | 17 // static |
16 BlimpClientContextFactory* BlimpClientContextFactory::GetInstance() { | 18 BlimpClientContextFactory* BlimpClientContextFactory::GetInstance() { |
17 return base::Singleton<BlimpClientContextFactory>::get(); | 19 return base::Singleton<BlimpClientContextFactory>::get(); |
18 } | 20 } |
19 | 21 |
20 // static | 22 // static |
21 blimp::client::BlimpClientContext* | 23 blimp::client::BlimpClientContext* |
22 BlimpClientContextFactory::GetForBrowserContext( | 24 BlimpClientContextFactory::GetForBrowserContext( |
23 content::BrowserContext* context) { | 25 content::BrowserContext* context) { |
24 DCHECK(!context->IsOffTheRecord()); | 26 DCHECK(!context->IsOffTheRecord()); |
25 return static_cast<blimp::client::BlimpClientContext*>( | 27 return static_cast<blimp::client::BlimpClientContext*>( |
26 GetInstance()->GetServiceForBrowserContext(context, true)); | 28 GetInstance()->GetServiceForBrowserContext(context, true)); |
27 } | 29 } |
28 | 30 |
29 BlimpClientContextFactory::BlimpClientContextFactory() | 31 BlimpClientContextFactory::BlimpClientContextFactory() |
30 : BrowserContextKeyedServiceFactory( | 32 : BrowserContextKeyedServiceFactory( |
31 "blimp::client::BlimpClientContext", | 33 "blimp::client::BlimpClientContext", |
32 BrowserContextDependencyManager::GetInstance()) {} | 34 BrowserContextDependencyManager::GetInstance()) {} |
33 | 35 |
34 BlimpClientContextFactory::~BlimpClientContextFactory() {} | 36 BlimpClientContextFactory::~BlimpClientContextFactory() {} |
35 | 37 |
36 KeyedService* BlimpClientContextFactory::BuildServiceInstanceFor( | 38 KeyedService* BlimpClientContextFactory::BuildServiceInstanceFor( |
37 content::BrowserContext* context) const { | 39 content::BrowserContext* context) const { |
38 return blimp::client::BlimpClientContext::Create( | 40 return blimp::client::BlimpClientContext::Create( |
39 content::BrowserThread::GetTaskRunnerForThread( | 41 content::BrowserThread::GetTaskRunnerForThread( |
40 content::BrowserThread::IO), | 42 content::BrowserThread::IO), |
41 content::BrowserThread::GetTaskRunnerForThread( | 43 content::BrowserThread::GetTaskRunnerForThread( |
42 content::BrowserThread::FILE), | 44 content::BrowserThread::FILE), |
43 nullptr); | 45 base::MakeUnique<ChromeCompositorDependencies>( |
| 46 ui::ContextProviderFactory::GetInstance())); |
44 } | 47 } |
45 | 48 |
46 content::BrowserContext* BlimpClientContextFactory::GetBrowserContextToUse( | 49 content::BrowserContext* BlimpClientContextFactory::GetBrowserContextToUse( |
47 content::BrowserContext* context) const { | 50 content::BrowserContext* context) const { |
48 return context; | 51 return context; |
49 } | 52 } |
OLD | NEW |