OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/device_policy_cache.h" | 5 #include "chrome/browser/policy/device_policy_cache.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/chromeos/cros_settings_names.h" | 12 #include "chrome/browser/chromeos/cros_settings_names.h" |
13 #include "chrome/browser/chromeos/login/ownership_service.h" | 13 #include "chrome/browser/chromeos/login/ownership_service.h" |
14 #include "chrome/browser/chromeos/login/signed_settings_helper.h" | |
15 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 14 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
16 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 15 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
17 #include "chrome/browser/policy/device_policy_identity_strategy.h" | 16 #include "chrome/browser/policy/device_policy_identity_strategy.h" |
18 #include "chrome/browser/policy/enterprise_install_attributes.h" | 17 #include "chrome/browser/policy/enterprise_install_attributes.h" |
19 #include "chrome/browser/policy/policy_map.h" | 18 #include "chrome/browser/policy/policy_map.h" |
20 #include "chrome/browser/policy/proto/device_management_backend.pb.h" | 19 #include "chrome/browser/policy/proto/device_management_backend.pb.h" |
21 #include "chrome/browser/policy/proto/device_management_constants.h" | 20 #include "chrome/browser/policy/proto/device_management_constants.h" |
22 #include "chrome/browser/policy/proto/device_management_local.pb.h" | 21 #include "chrome/browser/policy/proto/device_management_local.pb.h" |
23 #include "content/browser/browser_thread.h" | 22 #include "content/browser/browser_thread.h" |
24 #include "policy/configuration_policy_type.h" | 23 #include "policy/configuration_policy_type.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 policy, | 173 policy, |
175 callback_factory_.NewCallback( | 174 callback_factory_.NewCallback( |
176 &DevicePolicyCache::PolicyStoreOpCompleted)); | 175 &DevicePolicyCache::PolicyStoreOpCompleted)); |
177 } | 176 } |
178 | 177 |
179 void DevicePolicyCache::SetUnmanaged() { | 178 void DevicePolicyCache::SetUnmanaged() { |
180 LOG(WARNING) << "Tried to set DevicePolicyCache to 'unmanaged'!"; | 179 LOG(WARNING) << "Tried to set DevicePolicyCache to 'unmanaged'!"; |
181 // This is not supported for DevicePolicyCache. | 180 // This is not supported for DevicePolicyCache. |
182 } | 181 } |
183 | 182 |
| 183 bool DevicePolicyCache::IsReady() { |
| 184 return initialization_complete() || !starting_up_; |
| 185 } |
| 186 |
184 void DevicePolicyCache::OnRetrievePolicyCompleted( | 187 void DevicePolicyCache::OnRetrievePolicyCompleted( |
185 chromeos::SignedSettings::ReturnCode code, | 188 chromeos::SignedSettings::ReturnCode code, |
186 const em::PolicyFetchResponse& policy) { | 189 const em::PolicyFetchResponse& policy) { |
187 DCHECK(CalledOnValidThread()); | 190 DCHECK(CalledOnValidThread()); |
188 if (starting_up_) { | 191 if (starting_up_) { |
189 starting_up_ = false; | 192 starting_up_ = false; |
190 if (code == chromeos::SignedSettings::NOT_FOUND || | 193 if (code == chromeos::SignedSettings::NOT_FOUND || |
191 code == chromeos::SignedSettings::KEY_UNAVAILABLE || | 194 code == chromeos::SignedSettings::KEY_UNAVAILABLE || |
192 !policy.has_policy_data()) { | 195 !policy.has_policy_data()) { |
193 InformNotifier(CloudPolicySubsystem::UNENROLLED, | 196 InformNotifier(CloudPolicySubsystem::UNENROLLED, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 Value::CreateStringValue(container.proxy_pac_url())); | 298 Value::CreateStringValue(container.proxy_pac_url())); |
296 } | 299 } |
297 if (container.has_proxy_bypass_list()) { | 300 if (container.has_proxy_bypass_list()) { |
298 recommended->Set(kPolicyProxyBypassList, | 301 recommended->Set(kPolicyProxyBypassList, |
299 Value::CreateStringValue(container.proxy_bypass_list())); | 302 Value::CreateStringValue(container.proxy_bypass_list())); |
300 } | 303 } |
301 } | 304 } |
302 } | 305 } |
303 | 306 |
304 } // namespace policy | 307 } // namespace policy |
OLD | NEW |