OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/ui/webui/chromeos/login/signin_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/command_line.h" | |
12 #include "base/debug/trace_event.h" | 11 #include "base/debug/trace_event.h" |
13 #include "base/location.h" | 12 #include "base/location.h" |
14 #include "base/logging.h" | 13 #include "base/logging.h" |
15 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
16 #include "base/prefs/pref_registry_simple.h" | 15 #include "base/prefs/pref_registry_simple.h" |
17 #include "base/prefs/pref_service.h" | 16 #include "base/prefs/pref_service.h" |
18 #include "base/prefs/scoped_user_pref_update.h" | 17 #include "base/prefs/scoped_user_pref_update.h" |
19 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
20 #include "base/strings/string_util.h" | 19 #include "base/strings/string_util.h" |
21 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
(...skipping 21 matching lines...) Expand all Loading... |
43 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 42 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
44 #include "chrome/browser/chromeos/settings/cros_settings.h" | 43 #include "chrome/browser/chromeos/settings/cros_settings.h" |
45 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" | 44 #include "chrome/browser/extensions/api/screenlock_private/screenlock_private_ap
i.h" |
46 #include "chrome/browser/io_thread.h" | 45 #include "chrome/browser/io_thread.h" |
47 #include "chrome/browser/profiles/profile.h" | 46 #include "chrome/browser/profiles/profile.h" |
48 #include "chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retrie
ver.h" | 47 #include "chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retrie
ver.h" |
49 #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" | 48 #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" |
50 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" | 49 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" |
51 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" | 50 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
52 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 51 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
53 #include "chrome/common/chrome_switches.h" | |
54 #include "chrome/common/pref_names.h" | 52 #include "chrome/common/pref_names.h" |
55 #include "chrome/common/url_constants.h" | 53 #include "chrome/common/url_constants.h" |
56 #include "chromeos/chromeos_switches.h" | |
57 #include "chromeos/dbus/dbus_thread_manager.h" | 54 #include "chromeos/dbus/dbus_thread_manager.h" |
58 #include "chromeos/dbus/power_manager_client.h" | 55 #include "chromeos/dbus/power_manager_client.h" |
59 #include "chromeos/ime/ime_keyboard.h" | 56 #include "chromeos/ime/ime_keyboard.h" |
60 #include "chromeos/ime/input_method_manager.h" | 57 #include "chromeos/ime/input_method_manager.h" |
61 #include "chromeos/login/auth/key.h" | 58 #include "chromeos/login/auth/key.h" |
62 #include "chromeos/login/auth/user_context.h" | 59 #include "chromeos/login/auth/user_context.h" |
63 #include "chromeos/network/network_state.h" | 60 #include "chromeos/network/network_state.h" |
64 #include "chromeos/network/network_state_handler.h" | 61 #include "chromeos/network/network_state_handler.h" |
65 #include "chromeos/network/portal_detector/network_portal_detector.h" | 62 #include "chromeos/network/portal_detector/network_portal_detector.h" |
66 #include "components/user_manager/user_type.h" | 63 #include "components/user_manager/user_type.h" |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 builder->Add("easyUnlockTooltip", | 380 builder->Add("easyUnlockTooltip", |
384 IDS_LOGIN_EASY_UNLOCK_TOOLTIP); | 381 IDS_LOGIN_EASY_UNLOCK_TOOLTIP); |
385 | 382 |
386 builder->Add("fatalEnrollmentError", | 383 builder->Add("fatalEnrollmentError", |
387 IDS_ENTERPRISE_ENROLLMENT_AUTH_FATAL_ERROR); | 384 IDS_ENTERPRISE_ENROLLMENT_AUTH_FATAL_ERROR); |
388 builder->Add("insecureURLEnrollmentError", | 385 builder->Add("insecureURLEnrollmentError", |
389 IDS_ENTERPRISE_ENROLLMENT_AUTH_INSECURE_URL_ERROR); | 386 IDS_ENTERPRISE_ENROLLMENT_AUTH_INSECURE_URL_ERROR); |
390 | 387 |
391 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) | 388 if (chromeos::KioskModeSettings::Get()->IsKioskModeEnabled()) |
392 builder->Add("demoLoginMessage", IDS_KIOSK_MODE_LOGIN_MESSAGE); | 389 builder->Add("demoLoginMessage", IDS_KIOSK_MODE_LOGIN_MESSAGE); |
393 | |
394 builder->Add("runType", CommandLine::ForCurrentProcess()->HasSwitch( | |
395 switches::kFirstExecAfterBoot) ? "firstExecAfterBoot" : | |
396 "notFirstExecAfterBoot"); | |
397 } | 390 } |
398 | 391 |
399 void SigninScreenHandler::Show(const LoginScreenContext& context) { | 392 void SigninScreenHandler::Show(const LoginScreenContext& context) { |
400 CHECK(delegate_); | 393 CHECK(delegate_); |
401 | 394 |
402 // Just initialize internal fields from context and call ShowImpl(). | 395 // Just initialize internal fields from context and call ShowImpl(). |
403 oobe_ui_ = context.oobe_ui(); | 396 oobe_ui_ = context.oobe_ui(); |
404 gaia_screen_handler_->PopulateEmail(context.email()); | 397 gaia_screen_handler_->PopulateEmail(context.email()); |
405 ShowImpl(); | 398 ShowImpl(); |
406 } | 399 } |
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 } | 1091 } |
1099 | 1092 |
1100 void SigninScreenHandler::HandleToggleKioskAutolaunchScreen() { | 1093 void SigninScreenHandler::HandleToggleKioskAutolaunchScreen() { |
1101 policy::BrowserPolicyConnectorChromeOS* connector = | 1094 policy::BrowserPolicyConnectorChromeOS* connector = |
1102 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 1095 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
1103 if (delegate_ && !connector->IsEnterpriseManaged()) | 1096 if (delegate_ && !connector->IsEnterpriseManaged()) |
1104 delegate_->ShowKioskAutolaunchScreen(); | 1097 delegate_->ShowKioskAutolaunchScreen(); |
1105 } | 1098 } |
1106 | 1099 |
1107 void SigninScreenHandler::LoadUsers(const base::ListValue& users_list, | 1100 void SigninScreenHandler::LoadUsers(const base::ListValue& users_list, |
1108 bool animated, | |
1109 bool showGuest) { | 1101 bool showGuest) { |
1110 CallJS("login.AccountPickerScreen.loadUsers", | 1102 CallJS("login.AccountPickerScreen.loadUsers", |
1111 users_list, | 1103 users_list, |
1112 animated, | |
1113 delegate_->IsShowGuest()); | 1104 delegate_->IsShowGuest()); |
1114 } | 1105 } |
1115 | 1106 |
1116 void SigninScreenHandler::HandleAccountPickerReady() { | 1107 void SigninScreenHandler::HandleAccountPickerReady() { |
1117 VLOG(0) << "Login WebUI >> AccountPickerReady"; | 1108 VLOG(0) << "Login WebUI >> AccountPickerReady"; |
1118 | 1109 |
1119 if (delegate_ && !ScreenLocker::default_screen_locker() && | 1110 if (delegate_ && !ScreenLocker::default_screen_locker() && |
1120 !chromeos::IsMachineHWIDCorrect() && | 1111 !chromeos::IsMachineHWIDCorrect() && |
1121 !oobe_ui_) { | 1112 !oobe_ui_) { |
1122 delegate_->ShowWrongHWIDScreen(); | 1113 delegate_->ShowWrongHWIDScreen(); |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 return gaia_screen_handler_->frame_error(); | 1378 return gaia_screen_handler_->frame_error(); |
1388 } | 1379 } |
1389 | 1380 |
1390 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { | 1381 void SigninScreenHandler::OnCapsLockChanged(bool enabled) { |
1391 caps_lock_enabled_ = enabled; | 1382 caps_lock_enabled_ = enabled; |
1392 if (page_is_ready()) | 1383 if (page_is_ready()) |
1393 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); | 1384 CallJS("login.AccountPickerScreen.setCapsLockState", caps_lock_enabled_); |
1394 } | 1385 } |
1395 | 1386 |
1396 } // namespace chromeos | 1387 } // namespace chromeos |
OLD | NEW |