Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: chrome/browser/policy/device_policy_cache.cc

Issue 8499021: UserPolicyCache only becomes ready after policy has been fetched. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 base::Bind(&DevicePolicyCache::PolicyStoreOpCompleted, 184 base::Bind(&DevicePolicyCache::PolicyStoreOpCompleted,
185 weak_ptr_factory_.GetWeakPtr()); 185 weak_ptr_factory_.GetWeakPtr());
186 new StorePolicyOperation(signed_settings_helper_, policy, callback); 186 new StorePolicyOperation(signed_settings_helper_, policy, callback);
187 } 187 }
188 188
189 void DevicePolicyCache::SetUnmanaged() { 189 void DevicePolicyCache::SetUnmanaged() {
190 LOG(WARNING) << "Tried to set DevicePolicyCache to 'unmanaged'!"; 190 LOG(WARNING) << "Tried to set DevicePolicyCache to 'unmanaged'!";
191 // This is not supported for DevicePolicyCache. 191 // This is not supported for DevicePolicyCache.
192 } 192 }
193 193
194 void DevicePolicyCache::SetFetchingDone() {
195 // Not interesting for device policy cache.
196 }
197
194 void DevicePolicyCache::OnRetrievePolicyCompleted( 198 void DevicePolicyCache::OnRetrievePolicyCompleted(
195 chromeos::SignedSettings::ReturnCode code, 199 chromeos::SignedSettings::ReturnCode code,
196 const em::PolicyFetchResponse& policy) { 200 const em::PolicyFetchResponse& policy) {
197 DCHECK(CalledOnValidThread()); 201 DCHECK(CalledOnValidThread());
198 if (!IsReady()) { 202 if (!IsReady()) {
199 std::string device_token; 203 std::string device_token;
200 InstallInitialPolicy(code, policy, &device_token); 204 InstallInitialPolicy(code, policy, &device_token);
201 // We need to call SetDeviceToken unconditionally to indicate the cache has 205 // We need to call SetDeviceToken unconditionally to indicate the cache has
202 // finished loading. 206 // finished loading.
203 data_store_->SetDeviceToken(device_token, true); 207 data_store_->SetDeviceToken(device_token, true);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 if (policy.has_open_network_configuration() && 360 if (policy.has_open_network_configuration() &&
357 policy.open_network_configuration().has_open_network_configuration()) { 361 policy.open_network_configuration().has_open_network_configuration()) {
358 std::string config( 362 std::string config(
359 policy.open_network_configuration().open_network_configuration()); 363 policy.open_network_configuration().open_network_configuration());
360 mandatory->Set(kPolicyDeviceOpenNetworkConfiguration, 364 mandatory->Set(kPolicyDeviceOpenNetworkConfiguration,
361 Value::CreateStringValue(config)); 365 Value::CreateStringValue(config));
362 } 366 }
363 } 367 }
364 368
365 } // namespace policy 369 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698