| 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/chromeos/login/enrollment/enrollment_screen.h" | 5 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/metrics/histogram.h" | 11 #include "base/metrics/histogram.h" |
| 12 #include "base/timer/elapsed_timer.h" | 12 #include "base/timer/elapsed_timer.h" |
| 13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
| 14 #include "chrome/browser/browser_process_platform_part.h" | 14 #include "chrome/browser/browser_process_platform_part.h" |
| 15 #include "chrome/browser/chromeos/login/enrollment/enrollment_uma.h" | 15 #include "chrome/browser/chromeos/login/enrollment/enrollment_uma.h" |
| 16 #include "chrome/browser/chromeos/login/screen_manager.h" | 16 #include "chrome/browser/chromeos/login/screen_manager.h" |
| 17 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" | 17 #include "chrome/browser/chromeos/login/screens/base_screen_delegate.h" |
| 18 #include "chrome/browser/chromeos/login/startup_utils.h" | 18 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 19 #include "chrome/browser/chromeos/login/wizard_controller.h" | 19 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 20 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 20 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
| 21 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 21 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 22 #include "chromeos/dbus/cryptohome_client.h" | 22 #include "chromeos/dbus/cryptohome_client.h" |
| 23 #include "chromeos/dbus/dbus_method_call_status.h" | 23 #include "chromeos/dbus/dbus_method_call_status.h" |
| 24 #include "chromeos/dbus/dbus_thread_manager.h" | 24 #include "chromeos/dbus/dbus_thread_manager.h" |
| 25 #include "chromeos/dbus/session_manager_client.h" | |
| 26 #include "components/pairing/controller_pairing_controller.h" | 25 #include "components/pairing/controller_pairing_controller.h" |
| 27 #include "google_apis/gaia/gaia_auth_util.h" | 26 #include "google_apis/gaia/gaia_auth_util.h" |
| 28 | 27 |
| 29 using namespace pairing_chromeos; | 28 using namespace pairing_chromeos; |
| 30 | 29 |
| 31 // Do not change the UMA histogram parameters without renaming the histograms! | 30 // Do not change the UMA histogram parameters without renaming the histograms! |
| 32 #define UMA_ENROLLMENT_TIME(histogram_name, elapsed_timer) \ | 31 #define UMA_ENROLLMENT_TIME(histogram_name, elapsed_timer) \ |
| 33 do { \ | 32 do { \ |
| 34 UMA_HISTOGRAM_CUSTOM_TIMES( \ | 33 UMA_HISTOGRAM_CUSTOM_TIMES( \ |
| 35 (histogram_name), \ | 34 (histogram_name), \ |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 ClearAuth(base::Bind(&EnrollmentScreen::Finish, base::Unretained(this), | 188 ClearAuth(base::Bind(&EnrollmentScreen::Finish, base::Unretained(this), |
| 190 BaseScreenDelegate::ENTERPRISE_ENROLLMENT_BACK)); | 189 BaseScreenDelegate::ENTERPRISE_ENROLLMENT_BACK)); |
| 191 return; | 190 return; |
| 192 } | 191 } |
| 193 | 192 |
| 194 ClearAuth(base::Bind(&EnrollmentScreen::Finish, base::Unretained(this), | 193 ClearAuth(base::Bind(&EnrollmentScreen::Finish, base::Unretained(this), |
| 195 BaseScreenDelegate::ENTERPRISE_ENROLLMENT_COMPLETED)); | 194 BaseScreenDelegate::ENTERPRISE_ENROLLMENT_COMPLETED)); |
| 196 } | 195 } |
| 197 | 196 |
| 198 void EnrollmentScreen::OnConfirmationClosed() { | 197 void EnrollmentScreen::OnConfirmationClosed() { |
| 199 // If the machine has been put in KIOSK mode we have to restart the session | |
| 200 // here to go in the proper KIOSK mode login screen. | |
| 201 policy::BrowserPolicyConnectorChromeOS* connector = | |
| 202 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | |
| 203 if (connector->GetDeviceMode() == policy::DEVICE_MODE_RETAIL_KIOSK) { | |
| 204 DBusThreadManager::Get()->GetSessionManagerClient()->StopSession(); | |
| 205 return; | |
| 206 } | |
| 207 | |
| 208 ClearAuth(base::Bind(&EnrollmentScreen::Finish, base::Unretained(this), | 198 ClearAuth(base::Bind(&EnrollmentScreen::Finish, base::Unretained(this), |
| 209 BaseScreenDelegate::ENTERPRISE_ENROLLMENT_COMPLETED)); | 199 BaseScreenDelegate::ENTERPRISE_ENROLLMENT_COMPLETED)); |
| 210 } | 200 } |
| 211 | 201 |
| 212 void EnrollmentScreen::OnAuthError(const GoogleServiceAuthError& error) { | 202 void EnrollmentScreen::OnAuthError(const GoogleServiceAuthError& error) { |
| 213 DCHECK(!remora_controller_); | 203 DCHECK(!remora_controller_); |
| 214 OnAnyEnrollmentError(); | 204 OnAnyEnrollmentError(); |
| 215 actor_->ShowAuthError(error); | 205 actor_->ShowAuthError(error); |
| 216 } | 206 } |
| 217 | 207 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 enrollment_failed_once_ = true; | 255 enrollment_failed_once_ = true; |
| 266 if (elapsed_timer_) | 256 if (elapsed_timer_) |
| 267 UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeFailure, elapsed_timer_); | 257 UMA_ENROLLMENT_TIME(kMetricEnrollmentTimeFailure, elapsed_timer_); |
| 268 if (remora_controller_) { | 258 if (remora_controller_) { |
| 269 remora_controller_->OnEnrollmentStatusChanged( | 259 remora_controller_->OnEnrollmentStatusChanged( |
| 270 HostPairingController::ENROLLMENT_STATUS_FAILURE); | 260 HostPairingController::ENROLLMENT_STATUS_FAILURE); |
| 271 } | 261 } |
| 272 } | 262 } |
| 273 | 263 |
| 274 } // namespace chromeos | 264 } // namespace chromeos |
| OLD | NEW |