Chromium Code Reviews| 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 23 matching lines...) Expand all Loading... | |
| 34 #include "chromeos/chromeos_switches.h" | 34 #include "chromeos/chromeos_switches.h" |
| 35 #include "chromeos/login/auth/user_context.h" | 35 #include "chromeos/login/auth/user_context.h" |
| 36 #include "chromeos/settings/cros_settings_names.h" | 36 #include "chromeos/settings/cros_settings_names.h" |
| 37 #include "components/login/localized_values_builder.h" | 37 #include "components/login/localized_values_builder.h" |
| 38 #include "components/user_manager/user_manager.h" | 38 #include "components/user_manager/user_manager.h" |
| 39 #include "content/public/browser/browser_thread.h" | 39 #include "content/public/browser/browser_thread.h" |
| 40 #include "content/public/browser/render_frame_host.h" | 40 #include "content/public/browser/render_frame_host.h" |
| 41 #include "google_apis/gaia/gaia_auth_util.h" | 41 #include "google_apis/gaia/gaia_auth_util.h" |
| 42 #include "google_apis/gaia/gaia_switches.h" | 42 #include "google_apis/gaia/gaia_switches.h" |
| 43 #include "google_apis/gaia/gaia_urls.h" | 43 #include "google_apis/gaia/gaia_urls.h" |
| 44 #include "grit/browser_resources.h" | |
| 44 #include "ui/base/ime/chromeos/input_method_manager.h" | 45 #include "ui/base/ime/chromeos/input_method_manager.h" |
| 45 #include "ui/base/l10n/l10n_util.h" | 46 #include "ui/base/l10n/l10n_util.h" |
| 46 | 47 |
| 47 using content::BrowserThread; | 48 using content::BrowserThread; |
| 48 | 49 |
| 49 namespace chromeos { | 50 namespace chromeos { |
| 50 | 51 |
| 51 namespace { | 52 namespace { |
| 52 | 53 |
| 53 const char kJsScreenPath[] = "login.GaiaSigninScreen"; | 54 const char kJsScreenPath[] = "login.GaiaSigninScreen"; |
| 54 const char kAuthIframeParentName[] = "signin-frame"; | 55 const char kAuthIframeParentName[] = "signin-frame"; |
| 55 const char kAuthIframeParentOrigin[] = | 56 const char kAuthIframeParentOrigin[] = |
| 56 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/"; | 57 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/"; |
| 57 | 58 |
| 58 // TODO(rsorokin): Get rid of this url before the beta release. Issue tracking | 59 // TODO(rsorokin): Get rid of this before the beta release. Issue tracking |
| 59 // that http://crbug/462204. | 60 // that http://crbug/462204. |
| 60 const char kStagingGaiaUrl[] = "https://accounts.sandbox.google.com/"; | 61 const char kGaiaSandboxUrlSwitch[] = "gaia-sandbox-url"; |
|
Dmitry Polukhin
2015/03/13 11:56:20
We agreed to use accounts.sandbox.google.com tempo
Dmitry Polukhin
2015/03/17 17:51:43
As discussed it is not a problem. We will switch t
| |
| 61 // TODO(rsorokin): Move this to the proper file. | 62 // TODO(rsorokin): Move this to the proper file. |
| 62 const char kMinuteMaidPath[] = "ChromeOsEmbeddedSetup"; | 63 const char kMinuteMaidPath[] = "ChromeOsEmbeddedSetup"; |
| 63 | 64 |
| 64 void UpdateAuthParams(base::DictionaryValue* params, | 65 void UpdateAuthParams(base::DictionaryValue* params, |
| 65 bool has_users, | 66 bool has_users, |
| 66 bool is_enrolling_consumer_management) { | 67 bool is_enrolling_consumer_management) { |
| 67 CrosSettings* cros_settings = CrosSettings::Get(); | 68 CrosSettings* cros_settings = CrosSettings::Get(); |
| 68 bool allow_new_user = true; | 69 bool allow_new_user = true; |
| 69 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 70 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
| 70 bool allow_guest = true; | 71 bool allow_guest = true; |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 params.SetString("chromeType", GetChromeDeviceTypeString()); | 242 params.SetString("chromeType", GetChromeDeviceTypeString()); |
| 242 params.SetString("clientId", | 243 params.SetString("clientId", |
| 243 GaiaUrls::GetInstance()->oauth2_chrome_client_id()); | 244 GaiaUrls::GetInstance()->oauth2_chrome_client_id()); |
| 244 if (!command_line->HasSwitch(switches::kGaiaEndpointChromeOS)) { | 245 if (!command_line->HasSwitch(switches::kGaiaEndpointChromeOS)) { |
| 245 command_line->AppendSwitchASCII(switches::kGaiaEndpointChromeOS, | 246 command_line->AppendSwitchASCII(switches::kGaiaEndpointChromeOS, |
| 246 kMinuteMaidPath); | 247 kMinuteMaidPath); |
| 247 } | 248 } |
| 248 } | 249 } |
| 249 | 250 |
| 250 if (!command_line->HasSwitch(::switches::kGaiaUrl) && | 251 if (!command_line->HasSwitch(::switches::kGaiaUrl) && |
| 252 command_line->HasSwitch(kGaiaSandboxUrlSwitch) && | |
| 251 StartupUtils::IsWebviewSigninEnabled()) { | 253 StartupUtils::IsWebviewSigninEnabled()) { |
| 252 // We can't use switch --gaia-url in this case cause we need get | 254 // We can't use switch --gaia-url in this case cause we need get |
| 253 // auth_code from staging gaia and make all the other auths against prod | 255 // auth_code from staging gaia and make all the other auths against prod |
| 254 // gaia so user could use all the google services. | 256 // gaia so user could use all the google services. |
| 257 // Default to production Gaia for MM unless --gaia-url or --gaia-sandbox-url | |
| 258 // is specified. | |
| 255 // TODO(dpolukhin): crbug.com/462204 | 259 // TODO(dpolukhin): crbug.com/462204 |
| 256 const GURL gaia_url = GURL(kStagingGaiaUrl); | 260 const GURL gaia_url = |
| 261 GURL(command_line->GetSwitchValueASCII(kGaiaSandboxUrlSwitch)); | |
| 257 params.SetString("gaiaUrl", gaia_url.spec()); | 262 params.SetString("gaiaUrl", gaia_url.spec()); |
| 258 } else { | 263 } else { |
| 259 const GURL gaia_url = | 264 const GURL gaia_url = |
| 260 command_line->HasSwitch(::switches::kGaiaUrl) | 265 command_line->HasSwitch(::switches::kGaiaUrl) |
| 261 ? GURL(command_line->GetSwitchValueASCII(::switches::kGaiaUrl)) | 266 ? GURL(command_line->GetSwitchValueASCII(::switches::kGaiaUrl)) |
| 262 : GaiaUrls::GetInstance()->gaia_url(); | 267 : GaiaUrls::GetInstance()->gaia_url(); |
| 263 params.SetString("gaiaUrl", gaia_url.spec()); | 268 params.SetString("gaiaUrl", gaia_url.spec()); |
| 264 } | 269 } |
| 265 | 270 |
| 266 if (command_line->HasSwitch(switches::kGaiaEndpointChromeOS)) { | 271 if (command_line->HasSwitch(switches::kGaiaEndpointChromeOS)) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 355 builder->Add("fatalErrorMessageVerificationFailed", | 360 builder->Add("fatalErrorMessageVerificationFailed", |
| 356 IDS_LOGIN_FATAL_ERROR_PASSWORD_VERIFICATION); | 361 IDS_LOGIN_FATAL_ERROR_PASSWORD_VERIFICATION); |
| 357 builder->Add("fatalErrorMessageInsecureURL", | 362 builder->Add("fatalErrorMessageInsecureURL", |
| 358 IDS_LOGIN_FATAL_ERROR_TEXT_INSECURE_URL); | 363 IDS_LOGIN_FATAL_ERROR_TEXT_INSECURE_URL); |
| 359 builder->Add("fatalErrorInstructions", IDS_LOGIN_FATAL_ERROR_INSTRUCTIONS); | 364 builder->Add("fatalErrorInstructions", IDS_LOGIN_FATAL_ERROR_INSTRUCTIONS); |
| 360 builder->Add("fatalErrorDismissButton", IDS_OK); | 365 builder->Add("fatalErrorDismissButton", IDS_OK); |
| 361 } | 366 } |
| 362 | 367 |
| 363 void GaiaScreenHandler::GetAdditionalParameters(base::DictionaryValue* dict) { | 368 void GaiaScreenHandler::GetAdditionalParameters(base::DictionaryValue* dict) { |
| 364 dict->SetBoolean("isWebviewSignin", StartupUtils::IsWebviewSigninEnabled()); | 369 dict->SetBoolean("isWebviewSignin", StartupUtils::IsWebviewSigninEnabled()); |
| 370 dict->SetString( | |
| 371 "samlInjectedJS", | |
| 372 l10n_util::GetStringUTF8(IDR_GAIA_AUTH_WEBVIEW_SAML_INJECTED_JS)); | |
| 365 } | 373 } |
| 366 | 374 |
| 367 void GaiaScreenHandler::Initialize() { | 375 void GaiaScreenHandler::Initialize() { |
| 368 } | 376 } |
| 369 | 377 |
| 370 void GaiaScreenHandler::RegisterMessages() { | 378 void GaiaScreenHandler::RegisterMessages() { |
| 371 AddCallback("frameLoadingCompleted", | 379 AddCallback("frameLoadingCompleted", |
| 372 &GaiaScreenHandler::HandleFrameLoadingCompleted); | 380 &GaiaScreenHandler::HandleFrameLoadingCompleted); |
| 373 AddCallback("completeLogin", &GaiaScreenHandler::HandleCompleteLogin); | 381 AddCallback("completeLogin", &GaiaScreenHandler::HandleCompleteLogin); |
| 374 AddCallback("completeAuthentication", | 382 AddCallback("completeAuthentication", |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 837 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { | 845 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { |
| 838 DCHECK(signin_screen_handler_); | 846 DCHECK(signin_screen_handler_); |
| 839 return signin_screen_handler_->delegate_; | 847 return signin_screen_handler_->delegate_; |
| 840 } | 848 } |
| 841 | 849 |
| 842 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { | 850 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { |
| 843 signin_screen_handler_ = handler; | 851 signin_screen_handler_ = handler; |
| 844 } | 852 } |
| 845 | 853 |
| 846 } // namespace chromeos | 854 } // namespace chromeos |
| OLD | NEW |