OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/signin/easy_unlock_service_factory.h" | 5 #include "chrome/browser/signin/easy_unlock_service_factory.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/memory/singleton.h" | 8 #include "base/memory/singleton.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h" | 10 #include "chrome/browser/cryptauth/chrome_cryptauth_service_factory.h" |
11 #include "chrome/browser/profiles/incognito_helpers.h" | 11 #include "chrome/browser/profiles/incognito_helpers.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/signin/easy_unlock_app_manager.h" | 13 #include "chrome/browser/signin/easy_unlock_app_manager.h" |
14 #include "chrome/browser/signin/easy_unlock_service.h" | 14 #include "chrome/browser/signin/easy_unlock_service.h" |
15 #include "chrome/browser/signin/easy_unlock_service_regular.h" | 15 #include "chrome/browser/signin/easy_unlock_service_regular.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/grit/browser_resources.h" | 17 #include "chrome/grit/browser_resources.h" |
18 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 18 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
| 19 #include "components/pref_registry/pref_registry_syncable.h" |
19 #include "extensions/browser/extension_system.h" | 20 #include "extensions/browser/extension_system.h" |
20 #include "extensions/browser/extension_system_provider.h" | 21 #include "extensions/browser/extension_system_provider.h" |
21 #include "extensions/browser/extensions_browser_client.h" | 22 #include "extensions/browser/extensions_browser_client.h" |
22 | 23 |
23 #if defined(OS_CHROMEOS) | 24 #if defined(OS_CHROMEOS) |
24 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager_
factory.h" | 25 #include "chrome/browser/chromeos/login/easy_unlock/easy_unlock_tpm_key_manager_
factory.h" |
25 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 26 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
26 #include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h" | 27 #include "chrome/browser/signin/easy_unlock_service_signin_chromeos.h" |
27 #endif | 28 #endif |
28 | 29 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 102 |
102 const base::FilePath app_path = app_path_for_testing_.empty() | 103 const base::FilePath app_path = app_path_for_testing_.empty() |
103 ? GetEasyUnlockAppPath() | 104 ? GetEasyUnlockAppPath() |
104 : app_path_for_testing_; | 105 : app_path_for_testing_; |
105 | 106 |
106 service->Initialize(EasyUnlockAppManager::Create( | 107 service->Initialize(EasyUnlockAppManager::Create( |
107 extensions::ExtensionSystem::Get(context), manifest_id, app_path)); | 108 extensions::ExtensionSystem::Get(context), manifest_id, app_path)); |
108 return service; | 109 return service; |
109 } | 110 } |
110 | 111 |
| 112 void EasyUnlockServiceFactory::RegisterProfilePrefs( |
| 113 user_prefs::PrefRegistrySyncable* registry) { |
| 114 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 115 EasyUnlockService::RegisterProfilePrefs(registry); |
| 116 #endif |
| 117 } |
| 118 |
111 content::BrowserContext* EasyUnlockServiceFactory::GetBrowserContextToUse( | 119 content::BrowserContext* EasyUnlockServiceFactory::GetBrowserContextToUse( |
112 content::BrowserContext* context) const { | 120 content::BrowserContext* context) const { |
113 #if defined(OS_CHROMEOS) | 121 #if defined(OS_CHROMEOS) |
114 if (chromeos::ProfileHelper::IsSigninProfile( | 122 if (chromeos::ProfileHelper::IsSigninProfile( |
115 Profile::FromBrowserContext(context))) { | 123 Profile::FromBrowserContext(context))) { |
116 return chrome::GetBrowserContextOwnInstanceInIncognito(context); | 124 return chrome::GetBrowserContextOwnInstanceInIncognito(context); |
117 } | 125 } |
118 #endif | 126 #endif |
119 return chrome::GetBrowserContextRedirectedInIncognito(context); | 127 return chrome::GetBrowserContextRedirectedInIncognito(context); |
120 } | 128 } |
121 | 129 |
122 bool EasyUnlockServiceFactory::ServiceIsCreatedWithBrowserContext() const { | 130 bool EasyUnlockServiceFactory::ServiceIsCreatedWithBrowserContext() const { |
123 return true; | 131 return true; |
124 } | 132 } |
125 | 133 |
126 bool EasyUnlockServiceFactory::ServiceIsNULLWhileTesting() const { | 134 bool EasyUnlockServiceFactory::ServiceIsNULLWhileTesting() const { |
127 // Don't create the service for TestingProfile used in unit_tests because | 135 // Don't create the service for TestingProfile used in unit_tests because |
128 // EasyUnlockService uses ExtensionSystem::ready().Post, which expects | 136 // EasyUnlockService uses ExtensionSystem::ready().Post, which expects |
129 // a MessageLoop that does not exit in many unit_tests cases. | 137 // a MessageLoop that does not exit in many unit_tests cases. |
130 return true; | 138 return true; |
131 } | 139 } |
OLD | NEW |