| 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/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" | 59 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" |
| 60 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" | 60 #include "chrome/browser/chromeos/policy/network_configuration_updater.h" |
| 61 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 61 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
| 62 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" | 62 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" |
| 63 #include "chrome/browser/chromeos/settings/cros_settings.h" | 63 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 64 #include "chrome/browser/chromeos/settings/cros_settings_provider.h" | 64 #include "chrome/browser/chromeos/settings/cros_settings_provider.h" |
| 65 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 65 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 66 #include "chrome/browser/chromeos/system/statistics_provider.h" | 66 #include "chrome/browser/chromeos/system/statistics_provider.h" |
| 67 #include "chrome/browser/chromeos/system/timezone_settings.h" | 67 #include "chrome/browser/chromeos/system/timezone_settings.h" |
| 68 #include "chrome/browser/policy/cloud/resource_cache.h" | 68 #include "chrome/browser/policy/cloud/resource_cache.h" |
| 69 #include "chromeos/chromeos_paths.h" |
| 69 #include "chromeos/chromeos_switches.h" | 70 #include "chromeos/chromeos_switches.h" |
| 70 #include "chromeos/dbus/cryptohome_client.h" | 71 #include "chromeos/dbus/cryptohome_client.h" |
| 71 #include "chromeos/dbus/dbus_thread_manager.h" | 72 #include "chromeos/dbus/dbus_thread_manager.h" |
| 72 #else | 73 #else |
| 73 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" | 74 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" |
| 74 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 75 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
| 75 #endif | 76 #endif |
| 76 | 77 |
| 77 using content::BrowserThread; | 78 using content::BrowserThread; |
| 78 | 79 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 // |cros_library| may be NULL on unit tests. DBusThreadManager may not be | 130 // |cros_library| may be NULL on unit tests. DBusThreadManager may not be |
| 130 // initialized on unit tests.. | 131 // initialized on unit tests.. |
| 131 if (cros_library && chromeos::DBusThreadManager::IsInitialized()) { | 132 if (cros_library && chromeos::DBusThreadManager::IsInitialized()) { |
| 132 chromeos::CryptohomeLibrary* cryptohome = | 133 chromeos::CryptohomeLibrary* cryptohome = |
| 133 cros_library->GetCryptohomeLibrary(); | 134 cros_library->GetCryptohomeLibrary(); |
| 134 chromeos::CryptohomeClient* cryptohome_client = | 135 chromeos::CryptohomeClient* cryptohome_client = |
| 135 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); | 136 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); |
| 136 install_attributes_.reset( | 137 install_attributes_.reset( |
| 137 new EnterpriseInstallAttributes(cryptohome, cryptohome_client)); | 138 new EnterpriseInstallAttributes(cryptohome, cryptohome_client)); |
| 138 base::FilePath install_attrs_file; | 139 base::FilePath install_attrs_file; |
| 139 CHECK(PathService::Get(chrome::FILE_INSTALL_ATTRIBUTES, | 140 CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, |
| 140 &install_attrs_file)); | 141 &install_attrs_file)); |
| 141 install_attributes_->ReadCacheFile(install_attrs_file); | 142 install_attributes_->ReadCacheFile(install_attrs_file); |
| 142 | 143 |
| 143 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( | 144 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( |
| 144 new DeviceCloudPolicyStoreChromeOS( | 145 new DeviceCloudPolicyStoreChromeOS( |
| 145 chromeos::DeviceSettingsService::Get(), | 146 chromeos::DeviceSettingsService::Get(), |
| 146 install_attributes_.get())); | 147 install_attributes_.get())); |
| 147 device_cloud_policy_manager_.reset( | 148 device_cloud_policy_manager_.reset( |
| 148 new DeviceCloudPolicyManagerChromeOS( | 149 new DeviceCloudPolicyManagerChromeOS( |
| 149 device_cloud_policy_store.Pass(), | 150 device_cloud_policy_store.Pass(), |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 base::FilePath profile_dir; | 323 base::FilePath profile_dir; |
| 323 CHECK(PathService::Get(chrome::DIR_USER_DATA, &profile_dir)); | 324 CHECK(PathService::Get(chrome::DIR_USER_DATA, &profile_dir)); |
| 324 profile_dir = profile_dir.Append( | 325 profile_dir = profile_dir.Append( |
| 325 command_line->GetSwitchValuePath(chromeos::switches::kLoginProfile)); | 326 command_line->GetSwitchValuePath(chromeos::switches::kLoginProfile)); |
| 326 const base::FilePath legacy_dir = profile_dir.Append(kDeviceManagementDir); | 327 const base::FilePath legacy_dir = profile_dir.Append(kDeviceManagementDir); |
| 327 const base::FilePath policy_cache_file = legacy_dir.Append(kPolicy); | 328 const base::FilePath policy_cache_file = legacy_dir.Append(kPolicy); |
| 328 const base::FilePath token_cache_file = legacy_dir.Append(kToken); | 329 const base::FilePath token_cache_file = legacy_dir.Append(kToken); |
| 329 const base::FilePath resource_cache_dir = | 330 const base::FilePath resource_cache_dir = |
| 330 profile_dir.Append(kPolicy).Append(kResourceDir); | 331 profile_dir.Append(kPolicy).Append(kResourceDir); |
| 331 base::FilePath policy_key_dir; | 332 base::FilePath policy_key_dir; |
| 332 CHECK(PathService::Get(chrome::DIR_USER_POLICY_KEYS, &policy_key_dir)); | 333 CHECK(PathService::Get(chromeos::DIR_USER_POLICY_KEYS, &policy_key_dir)); |
| 333 | 334 |
| 334 if (wait_for_policy_fetch) | 335 if (wait_for_policy_fetch) |
| 335 device_management_service_->ScheduleInitialization(0); | 336 device_management_service_->ScheduleInitialization(0); |
| 336 if (is_public_account && device_local_account_policy_service_) { | 337 if (is_public_account && device_local_account_policy_service_) { |
| 337 device_local_account_policy_provider_.reset( | 338 device_local_account_policy_provider_.reset( |
| 338 new DeviceLocalAccountPolicyProvider( | 339 new DeviceLocalAccountPolicyProvider( |
| 339 user_name, device_local_account_policy_service_.get())); | 340 user_name, device_local_account_policy_service_.get())); |
| 340 | 341 |
| 341 device_local_account_policy_provider_->Init(); | 342 device_local_account_policy_provider_->Init(); |
| 342 global_user_cloud_policy_provider_.SetDelegate( | 343 global_user_cloud_policy_provider_.SetDelegate( |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 return new AsyncPolicyProvider(loader.Pass()); | 583 return new AsyncPolicyProvider(loader.Pass()); |
| 583 } else { | 584 } else { |
| 584 return NULL; | 585 return NULL; |
| 585 } | 586 } |
| 586 #else | 587 #else |
| 587 return NULL; | 588 return NULL; |
| 588 #endif | 589 #endif |
| 589 } | 590 } |
| 590 | 591 |
| 591 } // namespace policy | 592 } // namespace policy |
| OLD | NEW |