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