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/auto_enrollment_client.h" | 5 #include "chrome/browser/policy/auto_enrollment_client.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/guid.h" | 9 #include "base/guid.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop_proxy.h" | 12 #include "base/message_loop_proxy.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/string_number_conversions.h" | 14 #include "base/string_number_conversions.h" |
15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
16 #include "chrome/browser/policy/browser_policy_connector.h" | 16 #include "chrome/browser/policy/browser_policy_connector.h" |
17 #include "chrome/browser/policy/device_cloud_policy_manager_chromeos.h" | 17 #include "chrome/browser/policy/device_cloud_policy_manager_chromeos.h" |
18 #include "chrome/browser/policy/device_management_service.h" | 18 #include "chrome/browser/policy/device_management_service.h" |
| 19 #include "chrome/browser/prefs/pref_registry_simple.h" |
19 #include "chrome/browser/prefs/pref_service.h" | 20 #include "chrome/browser/prefs/pref_service.h" |
20 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/pref_names.h" | 22 #include "chrome/common/pref_names.h" |
22 #include "crypto/sha2.h" | 23 #include "crypto/sha2.h" |
23 | 24 |
24 namespace em = enterprise_management; | 25 namespace em = enterprise_management; |
25 | 26 |
26 namespace { | 27 namespace { |
27 | 28 |
28 // The modulus value is sent in an int64 field in the protobuf, whose maximum | 29 // The modulus value is sent in an int64 field in the protobuf, whose maximum |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 device_management_service_(service), | 86 device_management_service_(service), |
86 local_state_(local_state) { | 87 local_state_(local_state) { |
87 DCHECK_LE(power_initial_, power_limit_); | 88 DCHECK_LE(power_initial_, power_limit_); |
88 if (!serial_number.empty()) | 89 if (!serial_number.empty()) |
89 serial_number_hash_ = crypto::SHA256HashString(serial_number); | 90 serial_number_hash_ = crypto::SHA256HashString(serial_number); |
90 } | 91 } |
91 | 92 |
92 AutoEnrollmentClient::~AutoEnrollmentClient() {} | 93 AutoEnrollmentClient::~AutoEnrollmentClient() {} |
93 | 94 |
94 // static | 95 // static |
95 void AutoEnrollmentClient::RegisterPrefs(PrefServiceSimple* local_state) { | 96 void AutoEnrollmentClient::RegisterPrefs(PrefRegistrySimple* registry) { |
96 local_state->RegisterBooleanPref(prefs::kShouldAutoEnroll, false); | 97 registry->RegisterBooleanPref(prefs::kShouldAutoEnroll, false); |
97 local_state->RegisterIntegerPref(prefs::kAutoEnrollmentPowerLimit, -1); | 98 registry->RegisterIntegerPref(prefs::kAutoEnrollmentPowerLimit, -1); |
98 } | 99 } |
99 | 100 |
100 // static | 101 // static |
101 bool AutoEnrollmentClient::IsDisabled() { | 102 bool AutoEnrollmentClient::IsDisabled() { |
102 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 103 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
103 return | 104 return |
104 !command_line->HasSwitch(switches::kEnterpriseEnrollmentInitialModulus) && | 105 !command_line->HasSwitch(switches::kEnterpriseEnrollmentInitialModulus) && |
105 !command_line->HasSwitch(switches::kEnterpriseEnrollmentModulusLimit); | 106 !command_line->HasSwitch(switches::kEnterpriseEnrollmentModulusLimit); |
106 } | 107 } |
107 | 108 |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 // This samples |kZero| when there was no need for extra time, so that we can | 328 // This samples |kZero| when there was no need for extra time, so that we can |
328 // measure the ratio of users that succeeded without needing a delay to the | 329 // measure the ratio of users that succeeded without needing a delay to the |
329 // total users going through OOBE. | 330 // total users going through OOBE. |
330 UMA_HISTOGRAM_CUSTOM_TIMES(kExtraTime, delta, kMin, kMax, kBuckets); | 331 UMA_HISTOGRAM_CUSTOM_TIMES(kExtraTime, delta, kMin, kMax, kBuckets); |
331 | 332 |
332 if (!completion_callback_.is_null()) | 333 if (!completion_callback_.is_null()) |
333 completion_callback_.Run(); | 334 completion_callback_.Run(); |
334 } | 335 } |
335 | 336 |
336 } // namespace policy | 337 } // namespace policy |
OLD | NEW |