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

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

Issue 7105018: UMA metrics for cloud policies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed detection of some events, rebased Created 9 years, 6 months 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/cloud_policy_controller.h" 5 #include "chrome/browser/policy/cloud_policy_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/message_loop.h" 12 #include "base/message_loop.h"
13 #include "base/rand_util.h" 13 #include "base/rand_util.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "chrome/browser/policy/cloud_policy_cache_base.h" 15 #include "chrome/browser/policy/cloud_policy_cache_base.h"
16 #include "chrome/browser/policy/cloud_policy_subsystem.h" 16 #include "chrome/browser/policy/cloud_policy_subsystem.h"
17 #include "chrome/browser/policy/device_management_backend.h" 17 #include "chrome/browser/policy/device_management_backend.h"
18 #include "chrome/browser/policy/device_management_service.h" 18 #include "chrome/browser/policy/device_management_service.h"
19 #include "chrome/browser/policy/enterprise_metrics.h"
19 #include "chrome/browser/policy/proto/device_management_constants.h" 20 #include "chrome/browser/policy/proto/device_management_constants.h"
20 21
21 // Domain names that are known not to be managed. 22 // Domain names that are known not to be managed.
22 // We don't register the device when such a user logs in. 23 // We don't register the device when such a user logs in.
23 static const char* kNonManagedDomains[] = { 24 static const char* kNonManagedDomains[] = {
24 "@googlemail.com", 25 "@googlemail.com",
25 "@gmail.com" 26 "@gmail.com"
26 }; 27 };
27 28
28 // Checks the domain part of the given username against the list of known 29 // Checks the domain part of the given username against the list of known
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 if (response.response_size() > 0) { 106 if (response.response_size() > 0) {
106 if (response.response_size() > 1) { 107 if (response.response_size() > 1) {
107 LOG(WARNING) << "More than one policy in the response of the device " 108 LOG(WARNING) << "More than one policy in the response of the device "
108 << "management server, discarding."; 109 << "management server, discarding.";
109 } 110 }
110 if (response.response(0).error_code() != 111 if (response.response(0).error_code() !=
111 DeviceManagementBackend::kErrorServicePolicyNotFound) { 112 DeviceManagementBackend::kErrorServicePolicyNotFound) {
112 cache_->SetPolicy(response.response(0)); 113 cache_->SetPolicy(response.response(0));
113 SetState(STATE_POLICY_VALID); 114 SetState(STATE_POLICY_VALID);
114 } else { 115 } else {
116 em::LogPolicyOperation(em::kPolicyFetchBadResponse);
kmixter1 2011/06/28 01:06:02 Have we considered/investigated a paging/escalatio
Joao da Silva 2011/06/30 12:57:00 AFAIK that hasn't been discussed yet. It would be
kmixter1 2011/06/30 23:28:59 Once this hits stable, we should present these in
115 SetState(STATE_POLICY_UNAVAILABLE); 117 SetState(STATE_POLICY_UNAVAILABLE);
116 } 118 }
119 } else {
120 em::LogPolicyOperation(em::kPolicyFetchBadResponse);
117 } 121 }
118 } 122 }
119 123
120 void CloudPolicyController::OnError(DeviceManagementBackend::ErrorCode code) { 124 void CloudPolicyController::OnError(DeviceManagementBackend::ErrorCode code) {
121 switch (code) { 125 switch (code) {
122 case DeviceManagementBackend::kErrorServiceDeviceNotFound: 126 case DeviceManagementBackend::kErrorServiceDeviceNotFound:
123 case DeviceManagementBackend::kErrorServiceManagementTokenInvalid: { 127 case DeviceManagementBackend::kErrorServiceManagementTokenInvalid: {
124 LOG(WARNING) << "The device token was either invalid or unknown to the " 128 LOG(WARNING) << "The device token was either invalid or unknown to the "
125 << "device manager, re-registering device."; 129 << "device manager, re-registering device.";
126 // Will retry fetching a token but gracefully backing off. 130 // Will retry fetching a token but gracefully backing off.
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 } 357 }
354 358
355 int64 CloudPolicyController::GetRefreshDelay() { 359 int64 CloudPolicyController::GetRefreshDelay() {
356 int64 deviation = (kPolicyRefreshDeviationFactorPercent * 360 int64 deviation = (kPolicyRefreshDeviationFactorPercent *
357 policy_refresh_rate_ms_) / 100; 361 policy_refresh_rate_ms_) / 100;
358 deviation = std::min(deviation, kPolicyRefreshDeviationMaxInMilliseconds); 362 deviation = std::min(deviation, kPolicyRefreshDeviationMaxInMilliseconds);
359 return policy_refresh_rate_ms_ - base::RandGenerator(deviation + 1); 363 return policy_refresh_rate_ms_ - base::RandGenerator(deviation + 1);
360 } 364 }
361 365
362 } // namespace policy 366 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698