| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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_switches.h" | 69 #include "chromeos/chromeos_switches.h" |
| 70 #include "chromeos/cryptohome/cryptohome_library.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 |
| 79 namespace policy { | 80 namespace policy { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 // The connector is created very early during startup, when the browser | 119 // The connector is created very early during startup, when the browser |
| 119 // threads aren't running yet; initialize components that need local_state, | 120 // threads aren't running yet; initialize components that need local_state, |
| 120 // the system request context or other threads (e.g. FILE) at Init(). | 121 // the system request context or other threads (e.g. FILE) at Init(). |
| 121 | 122 |
| 122 platform_provider_.reset(CreatePlatformProvider()); | 123 platform_provider_.reset(CreatePlatformProvider()); |
| 123 | 124 |
| 124 device_management_service_.reset( | 125 device_management_service_.reset( |
| 125 new DeviceManagementService(GetDeviceManagementUrl())); | 126 new DeviceManagementService(GetDeviceManagementUrl())); |
| 126 | 127 |
| 127 #if defined(OS_CHROMEOS) | 128 #if defined(OS_CHROMEOS) |
| 128 chromeos::CrosLibrary* cros_library = chromeos::CrosLibrary::Get(); | 129 // CryptohomeLibrary or DBusThreadManager may be uninitialized on unit tests. |
| 129 // |cros_library| may be NULL on unit tests. DBusThreadManager may not be | 130 if (chromeos::CryptohomeLibrary::IsInitialized() && |
| 130 // initialized on unit tests.. | 131 chromeos::DBusThreadManager::IsInitialized()) { |
| 131 if (cros_library && chromeos::DBusThreadManager::IsInitialized()) { | |
| 132 chromeos::CryptohomeLibrary* cryptohome = | 132 chromeos::CryptohomeLibrary* cryptohome = |
| 133 cros_library->GetCryptohomeLibrary(); | 133 chromeos::CryptohomeLibrary::Get(); |
| 134 chromeos::CryptohomeClient* cryptohome_client = | 134 chromeos::CryptohomeClient* cryptohome_client = |
| 135 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); | 135 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); |
| 136 install_attributes_.reset( | 136 install_attributes_.reset( |
| 137 new EnterpriseInstallAttributes(cryptohome, cryptohome_client)); | 137 new EnterpriseInstallAttributes(cryptohome, cryptohome_client)); |
| 138 base::FilePath install_attrs_file; | 138 base::FilePath install_attrs_file; |
| 139 CHECK(PathService::Get(chrome::FILE_INSTALL_ATTRIBUTES, | 139 CHECK(PathService::Get(chrome::FILE_INSTALL_ATTRIBUTES, |
| 140 &install_attrs_file)); | 140 &install_attrs_file)); |
| 141 install_attributes_->ReadCacheFile(install_attrs_file); | 141 install_attributes_->ReadCacheFile(install_attrs_file); |
| 142 | 142 |
| 143 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( | 143 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 return new AsyncPolicyProvider(loader.Pass()); | 582 return new AsyncPolicyProvider(loader.Pass()); |
| 583 } else { | 583 } else { |
| 584 return NULL; | 584 return NULL; |
| 585 } | 585 } |
| 586 #else | 586 #else |
| 587 return NULL; | 587 return NULL; |
| 588 #endif | 588 #endif |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace policy | 591 } // namespace policy |
| OLD | NEW |