| 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/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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/browser_shutdown.h" | 15 #include "chrome/browser/browser_shutdown.h" |
| 16 #include "chrome/browser/chromeos/cros/cros_library.h" | 16 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 17 #include "chrome/browser/chromeos/cros/network_library.h" | 17 #include "chrome/browser/chromeos/cros/network_library.h" |
| 18 #include "chrome/browser/chromeos/cros_settings.h" | 18 #include "chrome/browser/chromeos/cros_settings.h" |
| 19 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" | 19 #include "chrome/browser/chromeos/dbus/dbus_thread_manager.h" |
| 20 #include "chrome/browser/chromeos/dbus/power_manager_client.h" | 20 #include "chrome/browser/chromeos/dbus/power_manager_client.h" |
| 21 #include "chrome/browser/chromeos/input_method/input_method_manager.h" | 21 #include "chrome/browser/chromeos/input_method/input_method_manager.h" |
| 22 #include "chrome/browser/chromeos/input_method/xkeyboard.h" | 22 #include "chrome/browser/chromeos/input_method/xkeyboard.h" |
| 23 #include "chrome/browser/chromeos/kiosk_mode/kiosk_mode_helper.h" |
| 23 #include "chrome/browser/chromeos/login/screen_locker.h" | 24 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 24 #include "chrome/browser/chromeos/login/user.h" | 25 #include "chrome/browser/chromeos/login/user.h" |
| 25 #include "chrome/browser/chromeos/login/webui_login_display.h" | 26 #include "chrome/browser/chromeos/login/webui_login_display.h" |
| 26 #include "chrome/browser/io_thread.h" | 27 #include "chrome/browser/io_thread.h" |
| 27 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
| 28 #include "chrome/common/chrome_notification_types.h" | 29 #include "chrome/common/chrome_notification_types.h" |
| 29 #include "chrome/common/chrome_switches.h" | 30 #include "chrome/common/chrome_switches.h" |
| 30 #include "chrome/common/net/gaia/gaia_urls.h" | 31 #include "chrome/common/net/gaia/gaia_urls.h" |
| 31 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 32 #include "content/browser/renderer_host/render_view_host.h" | 33 #include "content/browser/renderer_host/render_view_host.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 localized_strings->SetString("proxyMessageText", | 321 localized_strings->SetString("proxyMessageText", |
| 321 l10n_util::GetStringUTF16(IDS_LOGIN_PROXY_ERROR_MESSAGE)); | 322 l10n_util::GetStringUTF16(IDS_LOGIN_PROXY_ERROR_MESSAGE)); |
| 322 localized_strings->SetString("createAccount", | 323 localized_strings->SetString("createAccount", |
| 323 l10n_util::GetStringUTF16(IDS_CREATE_ACCOUNT_HTML)); | 324 l10n_util::GetStringUTF16(IDS_CREATE_ACCOUNT_HTML)); |
| 324 localized_strings->SetString("guestSignin", | 325 localized_strings->SetString("guestSignin", |
| 325 l10n_util::GetStringUTF16(IDS_BROWSE_WITHOUT_SIGNING_IN_HTML)); | 326 l10n_util::GetStringUTF16(IDS_BROWSE_WITHOUT_SIGNING_IN_HTML)); |
| 326 localized_strings->SetString("offlineLogin", | 327 localized_strings->SetString("offlineLogin", |
| 327 l10n_util::GetStringUTF16(IDS_OFFLINE_LOGIN_HTML)); | 328 l10n_util::GetStringUTF16(IDS_OFFLINE_LOGIN_HTML)); |
| 328 localized_strings->SetString("removeUser", | 329 localized_strings->SetString("removeUser", |
| 329 l10n_util::GetStringUTF16(IDS_LOGIN_REMOVE)); | 330 l10n_util::GetStringUTF16(IDS_LOGIN_REMOVE)); |
| 331 |
| 332 if (chromeos::KioskModeHelper::Get()->IsKioskModeEnabled()) { |
| 333 localized_strings->SetString("demoLoginMessage", |
| 334 l10n_util::GetStringUTF16(IDS_KIOSK_MODE_LOGIN_MESSAGE)); |
| 335 } |
| 330 } | 336 } |
| 331 | 337 |
| 332 void SigninScreenHandler::Show(bool oobe_ui) { | 338 void SigninScreenHandler::Show(bool oobe_ui) { |
| 333 CHECK(delegate_); | 339 CHECK(delegate_); |
| 334 | 340 |
| 335 oobe_ui_ = oobe_ui; | 341 oobe_ui_ = oobe_ui; |
| 336 if (!page_is_ready()) { | 342 if (!page_is_ready()) { |
| 337 show_on_init_ = true; | 343 show_on_init_ = true; |
| 338 return; | 344 return; |
| 339 } | 345 } |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 | 390 |
| 385 web_ui()->RegisterMessageCallback("authenticateUser", | 391 web_ui()->RegisterMessageCallback("authenticateUser", |
| 386 base::Bind(&SigninScreenHandler::HandleAuthenticateUser, | 392 base::Bind(&SigninScreenHandler::HandleAuthenticateUser, |
| 387 base::Unretained(this))); | 393 base::Unretained(this))); |
| 388 web_ui()->RegisterMessageCallback("completeLogin", | 394 web_ui()->RegisterMessageCallback("completeLogin", |
| 389 base::Bind(&SigninScreenHandler::HandleCompleteLogin, | 395 base::Bind(&SigninScreenHandler::HandleCompleteLogin, |
| 390 base::Unretained(this))); | 396 base::Unretained(this))); |
| 391 web_ui()->RegisterMessageCallback("getUsers", | 397 web_ui()->RegisterMessageCallback("getUsers", |
| 392 base::Bind(&SigninScreenHandler::HandleGetUsers, | 398 base::Bind(&SigninScreenHandler::HandleGetUsers, |
| 393 base::Unretained(this))); | 399 base::Unretained(this))); |
| 400 web_ui()->RegisterMessageCallback("launchDemoUser", |
| 401 base::Bind(&SigninScreenHandler::HandleLaunchDemoUser, |
| 402 base::Unretained(this))); |
| 394 web_ui()->RegisterMessageCallback("launchIncognito", | 403 web_ui()->RegisterMessageCallback("launchIncognito", |
| 395 base::Bind(&SigninScreenHandler::HandleLaunchIncognito, | 404 base::Bind(&SigninScreenHandler::HandleLaunchIncognito, |
| 396 base::Unretained(this))); | 405 base::Unretained(this))); |
| 397 web_ui()->RegisterMessageCallback("fixCaptivePortal", | 406 web_ui()->RegisterMessageCallback("fixCaptivePortal", |
| 398 base::Bind(&SigninScreenHandler::HandleFixCaptivePortal, | 407 base::Bind(&SigninScreenHandler::HandleFixCaptivePortal, |
| 399 base::Unretained(this))); | 408 base::Unretained(this))); |
| 400 web_ui()->RegisterMessageCallback("offlineLogin", | 409 web_ui()->RegisterMessageCallback("offlineLogin", |
| 401 base::Bind(&SigninScreenHandler::HandleOfflineLogin, | 410 base::Bind(&SigninScreenHandler::HandleOfflineLogin, |
| 402 base::Unretained(this))); | 411 base::Unretained(this))); |
| 403 web_ui()->RegisterMessageCallback("showAddUser", | 412 web_ui()->RegisterMessageCallback("showAddUser", |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 if (!args->GetString(0, &username) || | 653 if (!args->GetString(0, &username) || |
| 645 !args->GetString(1, &password)) { | 654 !args->GetString(1, &password)) { |
| 646 NOTREACHED(); | 655 NOTREACHED(); |
| 647 return; | 656 return; |
| 648 } | 657 } |
| 649 | 658 |
| 650 username = SanitizeEmail(username); | 659 username = SanitizeEmail(username); |
| 651 delegate_->Login(username, password); | 660 delegate_->Login(username, password); |
| 652 } | 661 } |
| 653 | 662 |
| 663 void SigninScreenHandler::HandleLaunchDemoUser(const base::ListValue* args) { |
| 664 if (!delegate_) |
| 665 return; |
| 666 delegate_->LoginAsDemoUser(); |
| 667 } |
| 668 |
| 654 void SigninScreenHandler::HandleLaunchIncognito(const base::ListValue* args) { | 669 void SigninScreenHandler::HandleLaunchIncognito(const base::ListValue* args) { |
| 655 if (!delegate_) | 670 if (!delegate_) |
| 656 return; | 671 return; |
| 657 delegate_->LoginAsGuest(); | 672 delegate_->LoginAsGuest(); |
| 658 } | 673 } |
| 659 | 674 |
| 660 void SigninScreenHandler::HandleFixCaptivePortal(const base::ListValue* args) { | 675 void SigninScreenHandler::HandleFixCaptivePortal(const base::ListValue* args) { |
| 661 if (!delegate_) | 676 if (!delegate_) |
| 662 return; | 677 return; |
| 663 delegate_->FixCaptivePortal(); | 678 delegate_->FixCaptivePortal(); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 | 931 |
| 917 cookie_remover_ = new BrowsingDataRemover( | 932 cookie_remover_ = new BrowsingDataRemover( |
| 918 Profile::FromWebUI(web_ui()), | 933 Profile::FromWebUI(web_ui()), |
| 919 BrowsingDataRemover::EVERYTHING, | 934 BrowsingDataRemover::EVERYTHING, |
| 920 base::Time()); | 935 base::Time()); |
| 921 cookie_remover_->AddObserver(this); | 936 cookie_remover_->AddObserver(this); |
| 922 cookie_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA); | 937 cookie_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA); |
| 923 } | 938 } |
| 924 | 939 |
| 925 } // namespace chromeos | 940 } // namespace chromeos |
| OLD | NEW |