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