OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/gaia_screen_handler.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 namespace chromeos { | 47 namespace chromeos { |
48 | 48 |
49 namespace { | 49 namespace { |
50 | 50 |
51 const char kJsScreenPath[] = "login.GaiaSigninScreen"; | 51 const char kJsScreenPath[] = "login.GaiaSigninScreen"; |
52 const char kAuthIframeParentName[] = "signin-frame"; | 52 const char kAuthIframeParentName[] = "signin-frame"; |
53 const char kAuthIframeParentOrigin[] = | 53 const char kAuthIframeParentOrigin[] = |
54 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/"; | 54 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/"; |
55 | 55 |
| 56 // TODO(rsorokin): Move this to the proper file. |
| 57 const char kMinuteMaidPath[] = "ChromeOsEmbeddedSetup"; |
| 58 |
56 void UpdateAuthParams(base::DictionaryValue* params, | 59 void UpdateAuthParams(base::DictionaryValue* params, |
57 bool has_users, | 60 bool has_users, |
58 bool is_enrolling_consumer_management) { | 61 bool is_enrolling_consumer_management) { |
59 CrosSettings* cros_settings = CrosSettings::Get(); | 62 CrosSettings* cros_settings = CrosSettings::Get(); |
60 bool allow_new_user = true; | 63 bool allow_new_user = true; |
61 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 64 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
62 bool allow_guest = true; | 65 bool allow_guest = true; |
63 cros_settings->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); | 66 cros_settings->GetBoolean(kAccountsPrefAllowGuest, &allow_guest); |
64 // Account creation depends on Guest sign-in (http://crosbug.com/24570). | 67 // Account creation depends on Guest sign-in (http://crosbug.com/24570). |
65 params->SetBoolean("createAccount", allow_new_user && allow_guest); | 68 params->SetBoolean("createAccount", allow_new_user && allow_guest); |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 localized_strings->SetString( | 216 localized_strings->SetString( |
214 "stringEmptyPassword", | 217 "stringEmptyPassword", |
215 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_EMPTY_PASSWORD)); | 218 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_EMPTY_PASSWORD)); |
216 localized_strings->SetString( | 219 localized_strings->SetString( |
217 "stringError", l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_ERROR)); | 220 "stringError", l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_ERROR)); |
218 params.Set("localizedStrings", localized_strings); | 221 params.Set("localizedStrings", localized_strings); |
219 } | 222 } |
220 | 223 |
221 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 224 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
222 | 225 |
| 226 if (StartupUtils::IsWebviewSigninEnabled()) { |
| 227 params.SetBoolean("useMinuteMaid", true); |
| 228 if (!command_line->HasSwitch(switches::kGaiaEndpointChromeOS)) { |
| 229 command_line->AppendSwitchASCII(switches::kGaiaEndpointChromeOS, |
| 230 kMinuteMaidPath); |
| 231 } |
| 232 } |
| 233 |
223 const GURL gaia_url = | 234 const GURL gaia_url = |
224 command_line->HasSwitch(::switches::kGaiaUrl) | 235 command_line->HasSwitch(::switches::kGaiaUrl) |
225 ? GURL(command_line->GetSwitchValueASCII(::switches::kGaiaUrl)) | 236 ? GURL(command_line->GetSwitchValueASCII(::switches::kGaiaUrl)) |
226 : GaiaUrls::GetInstance()->gaia_url(); | 237 : GaiaUrls::GetInstance()->gaia_url(); |
227 params.SetString("gaiaUrl", gaia_url.spec()); | 238 params.SetString("gaiaUrl", gaia_url.spec()); |
228 | 239 |
229 if (command_line->HasSwitch(switches::kGaiaEndpointChromeOS)) { | 240 if (command_line->HasSwitch(switches::kGaiaEndpointChromeOS)) { |
230 params.SetString("gaiaEndpoint", command_line->GetSwitchValueASCII( | 241 params.SetString("gaiaEndpoint", command_line->GetSwitchValueASCII( |
231 switches::kGaiaEndpointChromeOS)); | 242 switches::kGaiaEndpointChromeOS)); |
232 } | 243 } |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 PrefService* prefs = g_browser_process->local_state(); | 715 PrefService* prefs = g_browser_process->local_state(); |
705 if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { | 716 if (prefs->GetBoolean(prefs::kFactoryResetRequested)) { |
706 core_oobe_actor_->ShowDeviceResetScreen(); | 717 core_oobe_actor_->ShowDeviceResetScreen(); |
707 } else if (prefs->GetBoolean(prefs::kDebuggingFeaturesRequested)) { | 718 } else if (prefs->GetBoolean(prefs::kDebuggingFeaturesRequested)) { |
708 core_oobe_actor_->ShowEnableDebuggingScreen(); | 719 core_oobe_actor_->ShowEnableDebuggingScreen(); |
709 } | 720 } |
710 } | 721 } |
711 } | 722 } |
712 | 723 |
713 void GaiaScreenHandler::MaybePreloadAuthExtension() { | 724 void GaiaScreenHandler::MaybePreloadAuthExtension() { |
| 725 // TODO(rsorokin): Revert that when issue with hidden webview load will be |
| 726 // fixed. |
| 727 if (StartupUtils::IsWebviewSigninEnabled()) |
| 728 return; |
714 VLOG(1) << "MaybePreloadAuthExtension() call."; | 729 VLOG(1) << "MaybePreloadAuthExtension() call."; |
715 | 730 |
716 // If cookies clearing was initiated or |dns_clear_task_running_| then auth | 731 // If cookies clearing was initiated or |dns_clear_task_running_| then auth |
717 // extension showing has already been initiated and preloading is senseless. | 732 // extension showing has already been initiated and preloading is senseless. |
718 if (signin_screen_handler_->ShouldLoadGaia() && | 733 if (signin_screen_handler_->ShouldLoadGaia() && |
719 !gaia_silent_load_ && | 734 !gaia_silent_load_ && |
720 !cookies_cleared_ && | 735 !cookies_cleared_ && |
721 !dns_clear_task_running_ && | 736 !dns_clear_task_running_ && |
722 network_state_informer_->state() == NetworkStateInformer::ONLINE) { | 737 network_state_informer_->state() == NetworkStateInformer::ONLINE) { |
723 gaia_silent_load_ = true; | 738 gaia_silent_load_ = true; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
759 | 774 |
760 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { | 775 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { |
761 DCHECK(signin_screen_handler_); | 776 DCHECK(signin_screen_handler_); |
762 return signin_screen_handler_->delegate_; | 777 return signin_screen_handler_->delegate_; |
763 } | 778 } |
764 | 779 |
765 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { | 780 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { |
766 signin_screen_handler_ = handler; | 781 signin_screen_handler_ = handler; |
767 } | 782 } |
768 } // namespace chromeos | 783 } // namespace chromeos |
OLD | NEW |