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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 | 48 |
49 namespace chromeos { | 49 namespace chromeos { |
50 | 50 |
51 namespace { | 51 namespace { |
52 | 52 |
53 const char kJsScreenPath[] = "login.GaiaSigninScreen"; | 53 const char kJsScreenPath[] = "login.GaiaSigninScreen"; |
54 const char kAuthIframeParentName[] = "signin-frame"; | 54 const char kAuthIframeParentName[] = "signin-frame"; |
55 const char kAuthIframeParentOrigin[] = | 55 const char kAuthIframeParentOrigin[] = |
56 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/"; | 56 "chrome-extension://mfffpogegjflfpflabcdkioaeobkgjik/"; |
57 | 57 |
58 // TODO(rsorokin): Get rid of this url before the release. | |
Dmitry Polukhin
2015/02/26 12:54:02
Please file an issue, make it release beta blocker
| |
59 const char kStagingGaiaUrl[] = "https://accounts.sandbox.google.com/"; | |
58 // TODO(rsorokin): Move this to the proper file. | 60 // TODO(rsorokin): Move this to the proper file. |
59 const char kMinuteMaidPath[] = "ChromeOsEmbeddedSetup"; | 61 const char kMinuteMaidPath[] = "ChromeOsEmbeddedSetup"; |
60 | 62 |
61 void UpdateAuthParams(base::DictionaryValue* params, | 63 void UpdateAuthParams(base::DictionaryValue* params, |
62 bool has_users, | 64 bool has_users, |
63 bool is_enrolling_consumer_management) { | 65 bool is_enrolling_consumer_management) { |
64 CrosSettings* cros_settings = CrosSettings::Get(); | 66 CrosSettings* cros_settings = CrosSettings::Get(); |
65 bool allow_new_user = true; | 67 bool allow_new_user = true; |
66 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); | 68 cros_settings->GetBoolean(kAccountsPrefAllowNewUser, &allow_new_user); |
67 bool allow_guest = true; | 69 bool allow_guest = true; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
236 | 238 |
237 params.SetString("chromeType", GetChromeDeviceTypeString()); | 239 params.SetString("chromeType", GetChromeDeviceTypeString()); |
238 params.SetString("clientId", | 240 params.SetString("clientId", |
239 GaiaUrls::GetInstance()->oauth2_chrome_client_id()); | 241 GaiaUrls::GetInstance()->oauth2_chrome_client_id()); |
240 if (!command_line->HasSwitch(switches::kGaiaEndpointChromeOS)) { | 242 if (!command_line->HasSwitch(switches::kGaiaEndpointChromeOS)) { |
241 command_line->AppendSwitchASCII(switches::kGaiaEndpointChromeOS, | 243 command_line->AppendSwitchASCII(switches::kGaiaEndpointChromeOS, |
242 kMinuteMaidPath); | 244 kMinuteMaidPath); |
243 } | 245 } |
244 } | 246 } |
245 | 247 |
246 const GURL gaia_url = | 248 if (StartupUtils::IsWebviewSigninEnabled()) { |
247 command_line->HasSwitch(::switches::kGaiaUrl) | 249 // We can't use switch --gaia-url in this case cause we need get |
248 ? GURL(command_line->GetSwitchValueASCII(::switches::kGaiaUrl)) | 250 // auth_code from staging gaia and make all the other auths against prod |
249 : GaiaUrls::GetInstance()->gaia_url(); | 251 // gaia so user could use all the google services. |
250 params.SetString("gaiaUrl", gaia_url.spec()); | 252 const GURL gaia_url = GURL(kStagingGaiaUrl); |
253 params.SetString("gaiaUrl", gaia_url.spec()); | |
254 } else { | |
255 const GURL gaia_url = | |
256 command_line->HasSwitch(::switches::kGaiaUrl) | |
257 ? GURL(command_line->GetSwitchValueASCII(::switches::kGaiaUrl)) | |
258 : GaiaUrls::GetInstance()->gaia_url(); | |
259 params.SetString("gaiaUrl", gaia_url.spec()); | |
260 } | |
251 | 261 |
252 if (command_line->HasSwitch(switches::kGaiaEndpointChromeOS)) { | 262 if (command_line->HasSwitch(switches::kGaiaEndpointChromeOS)) { |
253 params.SetString("gaiaEndpoint", command_line->GetSwitchValueASCII( | 263 params.SetString("gaiaEndpoint", command_line->GetSwitchValueASCII( |
254 switches::kGaiaEndpointChromeOS)); | 264 switches::kGaiaEndpointChromeOS)); |
255 } | 265 } |
256 if (context.embedded_signin_enabled) { | 266 if (context.embedded_signin_enabled) { |
257 params.SetBoolean("useEmbedded", true); | 267 params.SetBoolean("useEmbedded", true); |
258 // We set 'constrained' here to switch troubleshooting page on embedded | 268 // We set 'constrained' here to switch troubleshooting page on embedded |
259 // signin to full tab. | 269 // signin to full tab. |
260 params.SetInteger("constrained", 1); | 270 params.SetInteger("constrained", 1); |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
787 | 797 |
788 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { | 798 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { |
789 DCHECK(signin_screen_handler_); | 799 DCHECK(signin_screen_handler_); |
790 return signin_screen_handler_->delegate_; | 800 return signin_screen_handler_->delegate_; |
791 } | 801 } |
792 | 802 |
793 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { | 803 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { |
794 signin_screen_handler_ = handler; | 804 signin_screen_handler_ = handler; |
795 } | 805 } |
796 } // namespace chromeos | 806 } // namespace chromeos |
OLD | NEW |