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

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

Issue 8773034: Clean up error handling and timestamp initialization for cloud policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 kMetricPolicySize); 296 kMetricPolicySize);
297 InformNotifier(CloudPolicySubsystem::LOCAL_ERROR, 297 InformNotifier(CloudPolicySubsystem::LOCAL_ERROR,
298 CloudPolicySubsystem::POLICY_LOCAL_ERROR); 298 CloudPolicySubsystem::POLICY_LOCAL_ERROR);
299 return; 299 return;
300 } 300 }
301 UMA_HISTOGRAM_ENUMERATION(kMetricPolicy, kMetricPolicyLoadSucceeded, 301 UMA_HISTOGRAM_ENUMERATION(kMetricPolicy, kMetricPolicyLoadSucceeded,
302 kMetricPolicySize); 302 kMetricPolicySize);
303 data_store_->set_user_name(policy_data.username()); 303 data_store_->set_user_name(policy_data.username());
304 data_store_->set_device_id(policy_data.device_id()); 304 data_store_->set_device_id(policy_data.device_id());
305 *device_token = policy_data.request_token(); 305 *device_token = policy_data.request_token();
306 SetPolicyInternal(policy, NULL, false); 306 base::Time timestamp;
307 if (SetPolicyInternal(policy, &timestamp, true))
308 set_last_policy_refresh_time(timestamp);
307 } 309 }
308 310
309 // static 311 // static
310 void DevicePolicyCache::DecodeDevicePolicy( 312 void DevicePolicyCache::DecodeDevicePolicy(
311 const em::ChromeDeviceSettingsProto& policy, 313 const em::ChromeDeviceSettingsProto& policy,
312 PolicyMap* mandatory, 314 PolicyMap* mandatory,
313 PolicyMap* recommended) { 315 PolicyMap* recommended) {
314 if (policy.has_device_policy_refresh_rate()) { 316 if (policy.has_device_policy_refresh_rate()) {
315 const em::DevicePolicyRefreshRateProto container = 317 const em::DevicePolicyRefreshRateProto container =
316 policy.device_policy_refresh_rate(); 318 policy.device_policy_refresh_rate();
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 if (policy.has_open_network_configuration() && 359 if (policy.has_open_network_configuration() &&
358 policy.open_network_configuration().has_open_network_configuration()) { 360 policy.open_network_configuration().has_open_network_configuration()) {
359 std::string config( 361 std::string config(
360 policy.open_network_configuration().open_network_configuration()); 362 policy.open_network_configuration().open_network_configuration());
361 mandatory->Set(kPolicyDeviceOpenNetworkConfiguration, 363 mandatory->Set(kPolicyDeviceOpenNetworkConfiguration,
362 Value::CreateStringValue(config)); 364 Value::CreateStringValue(config));
363 } 365 }
364 } 366 }
365 367
366 } // namespace policy 368 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud_policy_controller.cc ('k') | chrome/browser/policy/device_token_fetcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698