| 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 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 if (!args->GetString(0, &username) || | 646 if (!args->GetString(0, &username) || |
| 638 !args->GetString(1, &password)) { | 647 !args->GetString(1, &password)) { |
| 639 NOTREACHED(); | 648 NOTREACHED(); |
| 640 return; | 649 return; |
| 641 } | 650 } |
| 642 | 651 |
| 643 username = SanitizeEmail(username); | 652 username = SanitizeEmail(username); |
| 644 delegate_->Login(username, password); | 653 delegate_->Login(username, password); |
| 645 } | 654 } |
| 646 | 655 |
| 656 void SigninScreenHandler::HandleLaunchDemoUser(const base::ListValue* args) { |
| 657 if (!delegate_) |
| 658 return; |
| 659 delegate_->LoginAsDemoUser(); |
| 660 } |
| 661 |
| 647 void SigninScreenHandler::HandleLaunchIncognito(const base::ListValue* args) { | 662 void SigninScreenHandler::HandleLaunchIncognito(const base::ListValue* args) { |
| 648 if (!delegate_) | 663 if (!delegate_) |
| 649 return; | 664 return; |
| 650 delegate_->LoginAsGuest(); | 665 delegate_->LoginAsGuest(); |
| 651 } | 666 } |
| 652 | 667 |
| 653 void SigninScreenHandler::HandleFixCaptivePortal(const base::ListValue* args) { | 668 void SigninScreenHandler::HandleFixCaptivePortal(const base::ListValue* args) { |
| 654 if (!delegate_) | 669 if (!delegate_) |
| 655 return; | 670 return; |
| 656 delegate_->FixCaptivePortal(); | 671 delegate_->FixCaptivePortal(); |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 | 920 |
| 906 cookie_remover_ = new BrowsingDataRemover( | 921 cookie_remover_ = new BrowsingDataRemover( |
| 907 Profile::FromWebUI(web_ui()), | 922 Profile::FromWebUI(web_ui()), |
| 908 BrowsingDataRemover::EVERYTHING, | 923 BrowsingDataRemover::EVERYTHING, |
| 909 base::Time()); | 924 base::Time()); |
| 910 cookie_remover_->AddObserver(this); | 925 cookie_remover_->AddObserver(this); |
| 911 cookie_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA); | 926 cookie_remover_->Remove(BrowsingDataRemover::REMOVE_SITE_DATA); |
| 912 } | 927 } |
| 913 | 928 |
| 914 } // namespace chromeos | 929 } // namespace chromeos |
| OLD | NEW |