OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/policy/browser_policy_connector.h" | 5 #include "chrome/browser/policy/browser_policy_connector.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 | 249 |
250 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 250 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
251 | 251 |
252 base::FilePath profile_dir; | 252 base::FilePath profile_dir; |
253 PathService::Get(chrome::DIR_USER_DATA, &profile_dir); | 253 PathService::Get(chrome::DIR_USER_DATA, &profile_dir); |
254 profile_dir = profile_dir.Append( | 254 profile_dir = profile_dir.Append( |
255 command_line->GetSwitchValuePath(switches::kLoginProfile)); | 255 command_line->GetSwitchValuePath(switches::kLoginProfile)); |
256 const base::FilePath policy_dir = profile_dir.Append(kPolicyDir); | 256 const base::FilePath policy_dir = profile_dir.Append(kPolicyDir); |
257 const base::FilePath policy_cache_file = policy_dir.Append(kPolicyCacheFile); | 257 const base::FilePath policy_cache_file = policy_dir.Append(kPolicyCacheFile); |
258 const base::FilePath token_cache_file = policy_dir.Append(kTokenCacheFile); | 258 const base::FilePath token_cache_file = policy_dir.Append(kTokenCacheFile); |
| 259 FilePath policy_key_dir; |
| 260 PathService::Get(chrome::DIR_USER_POLICY_KEYS, &policy_key_dir); |
259 | 261 |
260 if (wait_for_policy_fetch) | 262 if (wait_for_policy_fetch) |
261 device_management_service_->ScheduleInitialization(0); | 263 device_management_service_->ScheduleInitialization(0); |
262 if (is_public_account && device_local_account_policy_service_.get()) { | 264 if (is_public_account && device_local_account_policy_service_.get()) { |
263 device_local_account_policy_provider_.reset( | 265 device_local_account_policy_provider_.reset( |
264 new DeviceLocalAccountPolicyProvider( | 266 new DeviceLocalAccountPolicyProvider( |
265 user_name, device_local_account_policy_service_.get())); | 267 user_name, device_local_account_policy_service_.get())); |
266 | 268 |
267 device_local_account_policy_provider_->Init(); | 269 device_local_account_policy_provider_->Init(); |
268 global_user_cloud_policy_provider_.SetDelegate( | 270 global_user_cloud_policy_provider_.SetDelegate( |
269 device_local_account_policy_provider_.get()); | 271 device_local_account_policy_provider_.get()); |
270 } else if (!IsNonEnterpriseUser(user_name)) { | 272 } else if (!IsNonEnterpriseUser(user_name)) { |
271 scoped_ptr<CloudPolicyStore> store( | 273 scoped_ptr<CloudPolicyStore> store( |
272 new UserCloudPolicyStoreChromeOS( | 274 new UserCloudPolicyStoreChromeOS( |
| 275 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(), |
273 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), | 276 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), |
274 user_name, token_cache_file, policy_cache_file)); | 277 user_name, policy_key_dir, token_cache_file, policy_cache_file)); |
275 user_cloud_policy_manager_.reset( | 278 user_cloud_policy_manager_.reset( |
276 new UserCloudPolicyManagerChromeOS(store.Pass(), | 279 new UserCloudPolicyManagerChromeOS(store.Pass(), |
277 wait_for_policy_fetch)); | 280 wait_for_policy_fetch)); |
278 | 281 |
279 user_cloud_policy_manager_->Init(); | 282 user_cloud_policy_manager_->Init(); |
280 user_cloud_policy_manager_->Connect(g_browser_process->local_state(), | 283 user_cloud_policy_manager_->Connect(g_browser_process->local_state(), |
281 device_management_service_.get(), | 284 device_management_service_.get(), |
282 GetUserAffiliation(user_name)); | 285 GetUserAffiliation(user_name)); |
283 global_user_cloud_policy_provider_.SetDelegate( | 286 global_user_cloud_policy_provider_.SetDelegate( |
284 user_cloud_policy_manager_.get()); | 287 user_cloud_policy_manager_.get()); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 return new AsyncPolicyProvider(loader.Pass()); | 532 return new AsyncPolicyProvider(loader.Pass()); |
530 } else { | 533 } else { |
531 return NULL; | 534 return NULL; |
532 } | 535 } |
533 #else | 536 #else |
534 return NULL; | 537 return NULL; |
535 #endif | 538 #endif |
536 } | 539 } |
537 | 540 |
538 } // namespace policy | 541 } // namespace policy |
OLD | NEW |