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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" | 63 #include "chrome/browser/chromeos/policy/user_cloud_policy_manager_chromeos.h" |
64 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" | 64 #include "chrome/browser/chromeos/policy/user_cloud_policy_store_chromeos.h" |
65 #include "chrome/browser/chromeos/settings/cros_settings.h" | 65 #include "chrome/browser/chromeos/settings/cros_settings.h" |
66 #include "chrome/browser/chromeos/settings/cros_settings_provider.h" | 66 #include "chrome/browser/chromeos/settings/cros_settings_provider.h" |
67 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 67 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
68 #include "chrome/browser/chromeos/system/statistics_provider.h" | 68 #include "chrome/browser/chromeos/system/statistics_provider.h" |
69 #include "chrome/browser/chromeos/system/timezone_settings.h" | 69 #include "chrome/browser/chromeos/system/timezone_settings.h" |
70 #include "chrome/browser/policy/cloud/resource_cache.h" | 70 #include "chrome/browser/policy/cloud/resource_cache.h" |
71 #include "chromeos/chromeos_paths.h" | 71 #include "chromeos/chromeos_paths.h" |
72 #include "chromeos/chromeos_switches.h" | 72 #include "chromeos/chromeos_switches.h" |
| 73 #include "chromeos/cryptohome/cryptohome_library.h" |
73 #include "chromeos/dbus/cryptohome_client.h" | 74 #include "chromeos/dbus/cryptohome_client.h" |
74 #include "chromeos/dbus/dbus_thread_manager.h" | 75 #include "chromeos/dbus/dbus_thread_manager.h" |
75 #else | 76 #else |
76 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" | 77 #include "chrome/browser/policy/cloud/user_cloud_policy_manager.h" |
77 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" | 78 #include "chrome/browser/policy/cloud/user_cloud_policy_manager_factory.h" |
78 #endif | 79 #endif |
79 | 80 |
80 using content::BrowserThread; | 81 using content::BrowserThread; |
81 | 82 |
82 namespace policy { | 83 namespace policy { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // The connector is created very early during startup, when the browser | 122 // The connector is created very early during startup, when the browser |
122 // threads aren't running yet; initialize components that need local_state, | 123 // threads aren't running yet; initialize components that need local_state, |
123 // the system request context or other threads (e.g. FILE) at Init(). | 124 // the system request context or other threads (e.g. FILE) at Init(). |
124 | 125 |
125 platform_provider_.reset(CreatePlatformProvider()); | 126 platform_provider_.reset(CreatePlatformProvider()); |
126 | 127 |
127 device_management_service_.reset( | 128 device_management_service_.reset( |
128 new DeviceManagementService(GetDeviceManagementUrl())); | 129 new DeviceManagementService(GetDeviceManagementUrl())); |
129 | 130 |
130 #if defined(OS_CHROMEOS) | 131 #if defined(OS_CHROMEOS) |
131 chromeos::CrosLibrary* cros_library = chromeos::CrosLibrary::Get(); | 132 // CryptohomeLibrary or DBusThreadManager may be uninitialized on unit tests. |
132 // |cros_library| may be NULL on unit tests. DBusThreadManager may not be | 133 if (chromeos::CryptohomeLibrary::IsInitialized() && |
133 // initialized on unit tests.. | 134 chromeos::DBusThreadManager::IsInitialized()) { |
134 if (cros_library && chromeos::DBusThreadManager::IsInitialized()) { | |
135 chromeos::CryptohomeLibrary* cryptohome = | 135 chromeos::CryptohomeLibrary* cryptohome = |
136 cros_library->GetCryptohomeLibrary(); | 136 chromeos::CryptohomeLibrary::Get(); |
137 chromeos::CryptohomeClient* cryptohome_client = | 137 chromeos::CryptohomeClient* cryptohome_client = |
138 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); | 138 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); |
139 install_attributes_.reset( | 139 install_attributes_.reset( |
140 new EnterpriseInstallAttributes(cryptohome, cryptohome_client)); | 140 new EnterpriseInstallAttributes(cryptohome, cryptohome_client)); |
141 base::FilePath install_attrs_file; | 141 base::FilePath install_attrs_file; |
142 CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, | 142 CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, |
143 &install_attrs_file)); | 143 &install_attrs_file)); |
144 install_attributes_->ReadCacheFile(install_attrs_file); | 144 install_attributes_->ReadCacheFile(install_attrs_file); |
145 | 145 |
146 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( | 146 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( |
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 return new AsyncPolicyProvider(loader.Pass()); | 597 return new AsyncPolicyProvider(loader.Pass()); |
598 } else { | 598 } else { |
599 return NULL; | 599 return NULL; |
600 } | 600 } |
601 #else | 601 #else |
602 return NULL; | 602 return NULL; |
603 #endif | 603 #endif |
604 } | 604 } |
605 | 605 |
606 } // namespace policy | 606 } // namespace policy |
OLD | NEW |