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 <algorithm> | 7 #include <algorithm> |
8 #include <iterator> | 8 #include <iterator> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 weak_ptr_factory_(this) { | 181 weak_ptr_factory_(this) { |
182 // GetPolicyService() must be ready after the constructor is done. | 182 // GetPolicyService() must be ready after the constructor is done. |
183 // The connector is created very early during startup, when the browser | 183 // The connector is created very early during startup, when the browser |
184 // threads aren't running yet; initialize components that need local_state, | 184 // threads aren't running yet; initialize components that need local_state, |
185 // the system request context or other threads (e.g. FILE) at Init(). | 185 // the system request context or other threads (e.g. FILE) at Init(). |
186 | 186 |
187 platform_provider_.reset(CreatePlatformProvider()); | 187 platform_provider_.reset(CreatePlatformProvider()); |
188 | 188 |
189 #if defined(OS_CHROMEOS) | 189 #if defined(OS_CHROMEOS) |
190 // CryptohomeLibrary or DBusThreadManager may be uninitialized on unit tests. | 190 // CryptohomeLibrary or DBusThreadManager may be uninitialized on unit tests. |
| 191 |
| 192 // TODO(satorux): Remove CryptohomeLibrary::IsInitialized() when it's ready |
| 193 // (removing it now breaks tests). crbug.com/141016. |
191 if (chromeos::CryptohomeLibrary::IsInitialized() && | 194 if (chromeos::CryptohomeLibrary::IsInitialized() && |
192 chromeos::DBusThreadManager::IsInitialized()) { | 195 chromeos::DBusThreadManager::IsInitialized()) { |
193 chromeos::CryptohomeLibrary* cryptohome = | |
194 chromeos::CryptohomeLibrary::Get(); | |
195 chromeos::CryptohomeClient* cryptohome_client = | 196 chromeos::CryptohomeClient* cryptohome_client = |
196 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); | 197 chromeos::DBusThreadManager::Get()->GetCryptohomeClient(); |
197 install_attributes_.reset( | 198 install_attributes_.reset( |
198 new EnterpriseInstallAttributes(cryptohome, cryptohome_client)); | 199 new EnterpriseInstallAttributes(cryptohome_client)); |
199 base::FilePath install_attrs_file; | 200 base::FilePath install_attrs_file; |
200 CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, | 201 CHECK(PathService::Get(chromeos::FILE_INSTALL_ATTRIBUTES, |
201 &install_attrs_file)); | 202 &install_attrs_file)); |
202 install_attributes_->ReadCacheFile(install_attrs_file); | 203 install_attributes_->ReadCacheFile(install_attrs_file); |
203 | 204 |
204 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( | 205 scoped_ptr<DeviceCloudPolicyStoreChromeOS> device_cloud_policy_store( |
205 new DeviceCloudPolicyStoreChromeOS( | 206 new DeviceCloudPolicyStoreChromeOS( |
206 chromeos::DeviceSettingsService::Get(), | 207 chromeos::DeviceSettingsService::Get(), |
207 install_attributes_.get())); | 208 install_attributes_.get())); |
208 device_cloud_policy_manager_.reset( | 209 device_cloud_policy_manager_.reset( |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
549 return new AsyncPolicyProvider(loader.Pass()); | 550 return new AsyncPolicyProvider(loader.Pass()); |
550 } else { | 551 } else { |
551 return NULL; | 552 return NULL; |
552 } | 553 } |
553 #else | 554 #else |
554 return NULL; | 555 return NULL; |
555 #endif | 556 #endif |
556 } | 557 } |
557 | 558 |
558 } // namespace policy | 559 } // namespace policy |
OLD | NEW |