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 "base/callback.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" |
8 #include "base/command_line.h" | 9 #include "base/command_line.h" |
9 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/location.h" |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
13 #include "base/prefs/pref_registry_simple.h" | 14 #include "base/prefs/pref_registry_simple.h" |
14 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
15 #include "base/prefs/scoped_user_pref_update.h" | 16 #include "base/prefs/scoped_user_pref_update.h" |
16 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
17 #include "base/strings/string_util.h" | 18 #include "base/strings/string_util.h" |
18 #include "base/strings/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
19 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
20 #include "chrome/browser/browser_process.h" | 21 #include "chrome/browser/browser_process.h" |
21 #include "chrome/browser/browser_process_platform_part_chromeos.h" | 22 #include "chrome/browser/browser_process_platform_part_chromeos.h" |
22 #include "chrome/browser/browser_shutdown.h" | 23 #include "chrome/browser/browser_shutdown.h" |
23 #include "chrome/browser/chrome_notification_types.h" | 24 #include "chrome/browser/chrome_notification_types.h" |
24 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 25 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
25 #include "chrome/browser/chromeos/boot_times_loader.h" | 26 #include "chrome/browser/chromeos/boot_times_loader.h" |
26 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 27 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
27 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" | 28 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_settings.h" |
28 #include "chrome/browser/chromeos/login/hwid_checker.h" | 29 #include "chrome/browser/chromeos/login/hwid_checker.h" |
29 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 30 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
30 #include "chrome/browser/chromeos/login/screen_locker.h" | 31 #include "chrome/browser/chromeos/login/screen_locker.h" |
31 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" | 32 #include "chrome/browser/chromeos/login/screens/core_oobe_actor.h" |
32 #include "chrome/browser/chromeos/login/user.h" | 33 #include "chrome/browser/chromeos/login/user.h" |
33 #include "chrome/browser/chromeos/login/webui_login_display.h" | 34 #include "chrome/browser/chromeos/login/webui_login_display.h" |
34 #include "chrome/browser/chromeos/login/wizard_controller.h" | 35 #include "chrome/browser/chromeos/login/wizard_controller.h" |
35 #include "chrome/browser/chromeos/net/network_portal_detector.h" | 36 #include "chrome/browser/chromeos/net/network_portal_detector.h" |
36 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 37 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
37 #include "chrome/browser/chromeos/settings/cros_settings.h" | 38 #include "chrome/browser/chromeos/settings/cros_settings.h" |
38 #include "chrome/browser/io_thread.h" | 39 #include "chrome/browser/io_thread.h" |
39 #include "chrome/browser/policy/browser_policy_connector.h" | 40 #include "chrome/browser/policy/browser_policy_connector.h" |
40 #include "chrome/browser/profiles/profile.h" | 41 #include "chrome/browser/profiles/profile.h" |
| 42 #include "chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retrie
ver.h" |
41 #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" | 43 #include "chrome/browser/ui/webui/chromeos/login/error_screen_handler.h" |
42 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" | 44 #include "chrome/browser/ui/webui/chromeos/login/native_window_delegate.h" |
43 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" | 45 #include "chrome/browser/ui/webui/chromeos/login/network_state_informer.h" |
44 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" | 46 #include "chrome/browser/ui/webui/chromeos/login/oobe_ui.h" |
45 #include "chrome/common/chrome_switches.h" | 47 #include "chrome/common/chrome_switches.h" |
46 #include "chrome/common/pref_names.h" | 48 #include "chrome/common/pref_names.h" |
47 #include "chrome/common/url_constants.h" | 49 #include "chrome/common/url_constants.h" |
48 #include "chromeos/chromeos_switches.h" | 50 #include "chromeos/chromeos_switches.h" |
49 #include "chromeos/dbus/dbus_thread_manager.h" | 51 #include "chromeos/dbus/dbus_thread_manager.h" |
50 #include "chromeos/dbus/power_manager_client.h" | 52 #include "chromeos/dbus/power_manager_client.h" |
51 #include "chromeos/ime/input_method_manager.h" | 53 #include "chromeos/ime/input_method_manager.h" |
52 #include "chromeos/ime/xkeyboard.h" | 54 #include "chromeos/ime/xkeyboard.h" |
53 #include "chromeos/network/network_state.h" | 55 #include "chromeos/network/network_state.h" |
54 #include "chromeos/network/network_state_handler.h" | 56 #include "chromeos/network/network_state_handler.h" |
| 57 #include "content/public/browser/browser_thread.h" |
55 #include "content/public/browser/render_view_host.h" | 58 #include "content/public/browser/render_view_host.h" |
56 #include "content/public/browser/web_contents.h" | 59 #include "content/public/browser/web_contents.h" |
57 #include "google_apis/gaia/gaia_auth_util.h" | 60 #include "google_apis/gaia/gaia_auth_util.h" |
58 #include "grit/chromium_strings.h" | 61 #include "grit/chromium_strings.h" |
59 #include "grit/generated_resources.h" | 62 #include "grit/generated_resources.h" |
| 63 #include "net/url_request/url_request_context_getter.h" |
60 #include "third_party/cros_system_api/dbus/service_constants.h" | 64 #include "third_party/cros_system_api/dbus/service_constants.h" |
61 | 65 |
62 #if defined(USE_AURA) | 66 #if defined(USE_AURA) |
63 #include "ash/shell.h" | 67 #include "ash/shell.h" |
64 #include "ash/wm/lock_state_controller.h" | 68 #include "ash/wm/lock_state_controller.h" |
65 #endif | 69 #endif |
66 | 70 |
67 using content::BrowserThread; | 71 using content::BrowserThread; |
68 using content::RenderViewHost; | 72 using content::RenderViewHost; |
69 | 73 |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 &SigninScreenHandler::HandleLoginUIStateChanged); | 726 &SigninScreenHandler::HandleLoginUIStateChanged); |
723 AddCallback("unlockOnLoginSuccess", | 727 AddCallback("unlockOnLoginSuccess", |
724 &SigninScreenHandler::HandleUnlockOnLoginSuccess); | 728 &SigninScreenHandler::HandleUnlockOnLoginSuccess); |
725 AddCallback("showLoadingTimeoutError", | 729 AddCallback("showLoadingTimeoutError", |
726 &SigninScreenHandler::HandleShowLoadingTimeoutError); | 730 &SigninScreenHandler::HandleShowLoadingTimeoutError); |
727 AddCallback("updateOfflineLogin", | 731 AddCallback("updateOfflineLogin", |
728 &SigninScreenHandler::HandleUpdateOfflineLogin); | 732 &SigninScreenHandler::HandleUpdateOfflineLogin); |
729 AddCallback("focusPod", &SigninScreenHandler::HandleFocusPod); | 733 AddCallback("focusPod", &SigninScreenHandler::HandleFocusPod); |
730 AddCallback("customButtonClicked", | 734 AddCallback("customButtonClicked", |
731 &SigninScreenHandler::HandleCustomButtonClicked); | 735 &SigninScreenHandler::HandleCustomButtonClicked); |
| 736 AddCallback("retrieveAuthenticatedUserEmail", |
| 737 &SigninScreenHandler::HandleRetrieveAuthenticatedUserEmail); |
732 | 738 |
733 // This message is sent by the kiosk app menu, but is handled here | 739 // This message is sent by the kiosk app menu, but is handled here |
734 // so we can tell the delegate to launch the app. | 740 // so we can tell the delegate to launch the app. |
735 AddCallback("launchKioskApp", &SigninScreenHandler::HandleLaunchKioskApp); | 741 AddCallback("launchKioskApp", &SigninScreenHandler::HandleLaunchKioskApp); |
736 } | 742 } |
737 | 743 |
738 void SigninScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { | 744 void SigninScreenHandler::RegisterPrefs(PrefRegistrySimple* registry) { |
739 registry->RegisterDictionaryPref(prefs::kUsersLRUInputMethod); | 745 registry->RegisterDictionaryPref(prefs::kUsersLRUInputMethod); |
740 } | 746 } |
741 | 747 |
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1438 void SigninScreenHandler::HandleCustomButtonClicked( | 1444 void SigninScreenHandler::HandleCustomButtonClicked( |
1439 const std::string& username) { | 1445 const std::string& username) { |
1440 if (user_pod_button_callback_map_.find(username) | 1446 if (user_pod_button_callback_map_.find(username) |
1441 == user_pod_button_callback_map_.end()) { | 1447 == user_pod_button_callback_map_.end()) { |
1442 LOG(WARNING) << "User pod custom button clicked but no callback found"; | 1448 LOG(WARNING) << "User pod custom button clicked but no callback found"; |
1443 return; | 1449 return; |
1444 } | 1450 } |
1445 user_pod_button_callback_map_[username].Run(); | 1451 user_pod_button_callback_map_[username].Run(); |
1446 } | 1452 } |
1447 | 1453 |
| 1454 void SigninScreenHandler::HandleRetrieveAuthenticatedUserEmail( |
| 1455 double attempt_token) { |
| 1456 email_retriever_.reset(new AuthenticatedUserEmailRetriever( |
| 1457 base::Bind(&SigninScreenHandler::CallJS<double, std::string>, |
| 1458 base::Unretained(this), |
| 1459 "login.GaiaSigninScreen.setAuthenticatedUserEmail", |
| 1460 attempt_token), |
| 1461 Profile::FromWebUI(web_ui())->GetRequestContext())); |
| 1462 } |
| 1463 |
1448 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id) { | 1464 void SigninScreenHandler::HandleLaunchKioskApp(const std::string& app_id) { |
1449 delegate_->LoginAsKioskApp(app_id); | 1465 delegate_->LoginAsKioskApp(app_id); |
1450 } | 1466 } |
1451 | 1467 |
1452 void SigninScreenHandler::StartClearingDnsCache() { | 1468 void SigninScreenHandler::StartClearingDnsCache() { |
1453 if (dns_clear_task_running_ || !g_browser_process->io_thread()) | 1469 if (dns_clear_task_running_ || !g_browser_process->io_thread()) |
1454 return; | 1470 return; |
1455 | 1471 |
1456 dns_cleared_ = false; | 1472 dns_cleared_ = false; |
1457 BrowserThread::PostTaskAndReply( | 1473 BrowserThread::PostTaskAndReply( |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1625 DCHECK(gaia_screen_handler_); | 1641 DCHECK(gaia_screen_handler_); |
1626 return gaia_screen_handler_->frame_state(); | 1642 return gaia_screen_handler_->frame_state(); |
1627 } | 1643 } |
1628 | 1644 |
1629 net::Error SigninScreenHandler::FrameError() const { | 1645 net::Error SigninScreenHandler::FrameError() const { |
1630 DCHECK(gaia_screen_handler_); | 1646 DCHECK(gaia_screen_handler_); |
1631 return gaia_screen_handler_->frame_error(); | 1647 return gaia_screen_handler_->frame_error(); |
1632 } | 1648 } |
1633 | 1649 |
1634 } // namespace chromeos | 1650 } // namespace chromeos |
OLD | NEW |