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" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 bool AutoEnrollmentClient::IsDisabled() { | 104 bool AutoEnrollmentClient::IsDisabled() { |
105 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 105 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
106 return | 106 return |
107 !command_line->HasSwitch(switches::kEnterpriseEnrollmentInitialModulus) && | 107 !command_line->HasSwitch(switches::kEnterpriseEnrollmentInitialModulus) && |
108 !command_line->HasSwitch(switches::kEnterpriseEnrollmentModulusLimit); | 108 !command_line->HasSwitch(switches::kEnterpriseEnrollmentModulusLimit); |
109 } | 109 } |
110 | 110 |
111 // static | 111 // static |
112 AutoEnrollmentClient* AutoEnrollmentClient::Create( | 112 AutoEnrollmentClient* AutoEnrollmentClient::Create( |
113 const base::Closure& completion_callback) { | 113 const base::Closure& completion_callback) { |
| 114 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 115 |
114 // The client won't do anything if |service| is NULL. | 116 // The client won't do anything if |service| is NULL. |
115 DeviceManagementService* service = NULL; | 117 DeviceManagementService* service = NULL; |
116 if (IsDisabled()) { | 118 if (IsDisabled()) { |
117 VLOG(1) << "Auto-enrollment is disabled"; | 119 VLOG(1) << "Auto-enrollment is disabled"; |
118 } else { | 120 } else { |
119 std::string url = BrowserPolicyConnector::GetDeviceManagementUrl(); | 121 std::string url = |
| 122 command_line->GetSwitchValueASCII(switches::kDeviceManagementUrl); |
120 if (!url.empty()) { | 123 if (!url.empty()) { |
121 service = new DeviceManagementService(url); | 124 service = new DeviceManagementService(url); |
122 service->ScheduleInitialization(0); | 125 service->ScheduleInitialization(0); |
123 } | 126 } |
124 } | 127 } |
125 | 128 |
126 int power_initial = GetSanitizedArg( | 129 int power_initial = GetSanitizedArg( |
127 switches::kEnterpriseEnrollmentInitialModulus); | 130 switches::kEnterpriseEnrollmentInitialModulus); |
128 int power_limit = GetSanitizedArg( | 131 int power_limit = GetSanitizedArg( |
129 switches::kEnterpriseEnrollmentModulusLimit); | 132 switches::kEnterpriseEnrollmentModulusLimit); |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 // This samples |kZero| when there was no need for extra time, so that we can | 332 // This samples |kZero| when there was no need for extra time, so that we can |
330 // measure the ratio of users that succeeded without needing a delay to the | 333 // measure the ratio of users that succeeded without needing a delay to the |
331 // total users going through OOBE. | 334 // total users going through OOBE. |
332 UMA_HISTOGRAM_CUSTOM_TIMES(kExtraTime, delta, kMin, kMax, kBuckets); | 335 UMA_HISTOGRAM_CUSTOM_TIMES(kExtraTime, delta, kMin, kMax, kBuckets); |
333 | 336 |
334 if (!completion_callback_.is_null()) | 337 if (!completion_callback_.is_null()) |
335 completion_callback_.Run(); | 338 completion_callback_.Run(); |
336 } | 339 } |
337 | 340 |
338 } // namespace policy | 341 } // namespace policy |
OLD | NEW |