| 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); | |
| 261 | 259 |
| 262 if (wait_for_policy_fetch) | 260 if (wait_for_policy_fetch) |
| 263 device_management_service_->ScheduleInitialization(0); | 261 device_management_service_->ScheduleInitialization(0); |
| 264 if (is_public_account && device_local_account_policy_service_.get()) { | 262 if (is_public_account && device_local_account_policy_service_.get()) { |
| 265 device_local_account_policy_provider_.reset( | 263 device_local_account_policy_provider_.reset( |
| 266 new DeviceLocalAccountPolicyProvider( | 264 new DeviceLocalAccountPolicyProvider( |
| 267 user_name, device_local_account_policy_service_.get())); | 265 user_name, device_local_account_policy_service_.get())); |
| 268 | 266 |
| 269 device_local_account_policy_provider_->Init(); | 267 device_local_account_policy_provider_->Init(); |
| 270 global_user_cloud_policy_provider_.SetDelegate( | 268 global_user_cloud_policy_provider_.SetDelegate( |
| 271 device_local_account_policy_provider_.get()); | 269 device_local_account_policy_provider_.get()); |
| 272 } else if (!IsNonEnterpriseUser(user_name)) { | 270 } else if (!IsNonEnterpriseUser(user_name)) { |
| 273 scoped_ptr<CloudPolicyStore> store( | 271 scoped_ptr<CloudPolicyStore> store( |
| 274 new UserCloudPolicyStoreChromeOS( | 272 new UserCloudPolicyStoreChromeOS( |
| 275 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(), | |
| 276 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), | 273 chromeos::DBusThreadManager::Get()->GetSessionManagerClient(), |
| 277 user_name, policy_key_dir, token_cache_file, policy_cache_file)); | 274 user_name, token_cache_file, policy_cache_file)); |
| 278 user_cloud_policy_manager_.reset( | 275 user_cloud_policy_manager_.reset( |
| 279 new UserCloudPolicyManagerChromeOS(store.Pass(), | 276 new UserCloudPolicyManagerChromeOS(store.Pass(), |
| 280 wait_for_policy_fetch)); | 277 wait_for_policy_fetch)); |
| 281 | 278 |
| 282 user_cloud_policy_manager_->Init(); | 279 user_cloud_policy_manager_->Init(); |
| 283 user_cloud_policy_manager_->Connect(g_browser_process->local_state(), | 280 user_cloud_policy_manager_->Connect(g_browser_process->local_state(), |
| 284 device_management_service_.get(), | 281 device_management_service_.get(), |
| 285 GetUserAffiliation(user_name)); | 282 GetUserAffiliation(user_name)); |
| 286 global_user_cloud_policy_provider_.SetDelegate( | 283 global_user_cloud_policy_provider_.SetDelegate( |
| 287 user_cloud_policy_manager_.get()); | 284 user_cloud_policy_manager_.get()); |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 return new AsyncPolicyProvider(loader.Pass()); | 529 return new AsyncPolicyProvider(loader.Pass()); |
| 533 } else { | 530 } else { |
| 534 return NULL; | 531 return NULL; |
| 535 } | 532 } |
| 536 #else | 533 #else |
| 537 return NULL; | 534 return NULL; |
| 538 #endif | 535 #endif |
| 539 } | 536 } |
| 540 | 537 |
| 541 } // namespace policy | 538 } // namespace policy |
| OLD | NEW |