| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" | 5 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_factory_chrom
eos.h" |
| 6 | 6 |
| 7 #include <utility> |
| 8 |
| 7 #include "base/bind.h" | 9 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 9 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 10 #include "base/logging.h" | 12 #include "base/logging.h" |
| 11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 12 #include "base/path_service.h" | 14 #include "base/path_service.h" |
| 13 #include "base/sequenced_task_runner.h" | 15 #include "base/sequenced_task_runner.h" |
| 14 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
| 15 #include "base/thread_task_runner_handle.h" | 17 #include "base/thread_task_runner_handle.h" |
| 16 #include "base/threading/sequenced_worker_pool.h" | 18 #include "base/threading/sequenced_worker_pool.h" |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 store.get())); | 193 store.get())); |
| 192 if (force_immediate_load) | 194 if (force_immediate_load) |
| 193 store->LoadImmediately(); | 195 store->LoadImmediately(); |
| 194 | 196 |
| 195 scoped_refptr<base::SequencedTaskRunner> file_task_runner = | 197 scoped_refptr<base::SequencedTaskRunner> file_task_runner = |
| 196 content::BrowserThread::GetMessageLoopProxyForThread( | 198 content::BrowserThread::GetMessageLoopProxyForThread( |
| 197 content::BrowserThread::FILE); | 199 content::BrowserThread::FILE); |
| 198 | 200 |
| 199 scoped_ptr<UserCloudPolicyManagerChromeOS> manager( | 201 scoped_ptr<UserCloudPolicyManagerChromeOS> manager( |
| 200 new UserCloudPolicyManagerChromeOS( | 202 new UserCloudPolicyManagerChromeOS( |
| 201 store.Pass(), external_data_manager.Pass(), | 203 std::move(store), std::move(external_data_manager), |
| 202 component_policy_cache_dir, wait_for_initial_policy, | 204 component_policy_cache_dir, wait_for_initial_policy, |
| 203 initial_policy_fetch_timeout, base::ThreadTaskRunnerHandle::Get(), | 205 initial_policy_fetch_timeout, base::ThreadTaskRunnerHandle::Get(), |
| 204 file_task_runner, io_task_runner)); | 206 file_task_runner, io_task_runner)); |
| 205 | 207 |
| 206 bool wildcard_match = false; | 208 bool wildcard_match = false; |
| 207 if (connector->IsEnterpriseManaged() && | 209 if (connector->IsEnterpriseManaged() && |
| 208 chromeos::CrosSettings::IsWhitelisted(username, &wildcard_match) && | 210 chromeos::CrosSettings::IsWhitelisted(username, &wildcard_match) && |
| 209 wildcard_match && !connector->IsNonEnterpriseUser(username)) { | 211 wildcard_match && !connector->IsNonEnterpriseUser(username)) { |
| 210 manager->EnableWildcardLoginCheck(username); | 212 manager->EnableWildcardLoginCheck(username); |
| 211 } | 213 } |
| 212 | 214 |
| 213 manager->Init( | 215 manager->Init( |
| 214 SchemaRegistryServiceFactory::GetForContext(profile)->registry()); | 216 SchemaRegistryServiceFactory::GetForContext(profile)->registry()); |
| 215 manager->Connect(g_browser_process->local_state(), device_management_service, | 217 manager->Connect(g_browser_process->local_state(), device_management_service, |
| 216 g_browser_process->system_request_context()); | 218 g_browser_process->system_request_context()); |
| 217 | 219 |
| 218 DCHECK(managers_.find(profile) == managers_.end()); | 220 DCHECK(managers_.find(profile) == managers_.end()); |
| 219 managers_[profile] = manager.get(); | 221 managers_[profile] = manager.get(); |
| 220 return manager.Pass(); | 222 return manager; |
| 221 } | 223 } |
| 222 | 224 |
| 223 void UserCloudPolicyManagerFactoryChromeOS::BrowserContextShutdown( | 225 void UserCloudPolicyManagerFactoryChromeOS::BrowserContextShutdown( |
| 224 content::BrowserContext* context) { | 226 content::BrowserContext* context) { |
| 225 Profile* profile = static_cast<Profile*>(context); | 227 Profile* profile = static_cast<Profile*>(context); |
| 226 if (profile->IsOffTheRecord()) | 228 if (profile->IsOffTheRecord()) |
| 227 return; | 229 return; |
| 228 UserCloudPolicyManagerChromeOS* manager = GetManagerForProfile(profile); | 230 UserCloudPolicyManagerChromeOS* manager = GetManagerForProfile(profile); |
| 229 if (manager) | 231 if (manager) |
| 230 manager->Shutdown(); | 232 manager->Shutdown(); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 242 | 244 |
| 243 bool UserCloudPolicyManagerFactoryChromeOS::HasTestingFactory( | 245 bool UserCloudPolicyManagerFactoryChromeOS::HasTestingFactory( |
| 244 content::BrowserContext* context) { | 246 content::BrowserContext* context) { |
| 245 return false; | 247 return false; |
| 246 } | 248 } |
| 247 | 249 |
| 248 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( | 250 void UserCloudPolicyManagerFactoryChromeOS::CreateServiceNow( |
| 249 content::BrowserContext* context) {} | 251 content::BrowserContext* context) {} |
| 250 | 252 |
| 251 } // namespace policy | 253 } // namespace policy |
| OLD | NEW |