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