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" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
14 #include "chrome/browser/browser_shutdown.h" | 14 #include "chrome/browser/browser_shutdown.h" |
15 #include "chrome/browser/chromeos/input_method/input_method_util.h" | 15 #include "chrome/browser/chromeos/input_method/input_method_util.h" |
16 #include "chrome/browser/chromeos/language_preferences.h" | 16 #include "chrome/browser/chromeos/language_preferences.h" |
17 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 17 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
18 #include "chrome/browser/chromeos/policy/consumer_management_service.h" | 18 #include "chrome/browser/chromeos/policy/consumer_management_service.h" |
19 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 19 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
20 #include "chrome/browser/chromeos/settings/cros_settings.h" | 20 #include "chrome/browser/chromeos/settings/cros_settings.h" |
21 #include "chrome/browser/io_thread.h" | 21 #include "chrome/browser/io_thread.h" |
22 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 22 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
23 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" | 23 #include "chrome/browser/ui/webui/signin/inline_login_ui.h" |
24 #include "chrome/common/chrome_version_info.h" | |
24 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
25 #include "chrome/grit/generated_resources.h" | 26 #include "chrome/grit/generated_resources.h" |
26 #include "chromeos/chromeos_switches.h" | 27 #include "chromeos/chromeos_switches.h" |
27 #include "chromeos/ime/input_method_manager.h" | 28 #include "chromeos/ime/input_method_manager.h" |
28 #include "chromeos/settings/cros_settings_names.h" | 29 #include "chromeos/settings/cros_settings_names.h" |
29 #include "components/user_manager/user_manager.h" | 30 #include "components/user_manager/user_manager.h" |
30 #include "content/public/browser/browser_thread.h" | 31 #include "content/public/browser/browser_thread.h" |
31 #include "content/public/browser/render_frame_host.h" | 32 #include "content/public/browser/render_frame_host.h" |
32 #include "google_apis/gaia/gaia_auth_util.h" | 33 #include "google_apis/gaia/gaia_auth_util.h" |
33 #include "google_apis/gaia/gaia_switches.h" | 34 #include "google_apis/gaia/gaia_switches.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
139 consumer_management_(consumer_management), | 140 consumer_management_(consumer_management), |
140 core_oobe_actor_(core_oobe_actor), | 141 core_oobe_actor_(core_oobe_actor), |
141 dns_cleared_(false), | 142 dns_cleared_(false), |
142 dns_clear_task_running_(false), | 143 dns_clear_task_running_(false), |
143 cookies_cleared_(false), | 144 cookies_cleared_(false), |
144 focus_stolen_(false), | 145 focus_stolen_(false), |
145 gaia_silent_load_(false), | 146 gaia_silent_load_(false), |
146 using_saml_api_(false), | 147 using_saml_api_(false), |
147 is_enrolling_consumer_management_(false), | 148 is_enrolling_consumer_management_(false), |
148 test_expects_complete_login_(false), | 149 test_expects_complete_login_(false), |
150 embedded_signin_enabled_by_shortcut_(false), | |
149 signin_screen_handler_(NULL), | 151 signin_screen_handler_(NULL), |
150 weak_factory_(this) { | 152 weak_factory_(this) { |
151 DCHECK(network_state_informer_.get()); | 153 DCHECK(network_state_informer_.get()); |
152 } | 154 } |
153 | 155 |
154 GaiaScreenHandler::~GaiaScreenHandler() { | 156 GaiaScreenHandler::~GaiaScreenHandler() { |
155 } | 157 } |
156 | 158 |
157 void GaiaScreenHandler::LoadGaia(const GaiaContext& context) { | 159 void GaiaScreenHandler::LoadGaia(const GaiaContext& context) { |
158 base::DictionaryValue params; | 160 base::DictionaryValue params; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 } | 199 } |
198 | 200 |
199 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 201 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
200 | 202 |
201 const GURL gaia_url = | 203 const GURL gaia_url = |
202 command_line->HasSwitch(::switches::kGaiaUrl) | 204 command_line->HasSwitch(::switches::kGaiaUrl) |
203 ? GURL(command_line->GetSwitchValueASCII(::switches::kGaiaUrl)) | 205 ? GURL(command_line->GetSwitchValueASCII(::switches::kGaiaUrl)) |
204 : GaiaUrls::GetInstance()->gaia_url(); | 206 : GaiaUrls::GetInstance()->gaia_url(); |
205 params.SetString("gaiaUrl", gaia_url.spec()); | 207 params.SetString("gaiaUrl", gaia_url.spec()); |
206 | 208 |
207 if (command_line->HasSwitch(chromeos::switches::kEnableEmbeddedSignin)) | 209 if (command_line->HasSwitch(chromeos::switches::kEnableEmbeddedSignin) || |
210 embedded_signin_enabled_by_shortcut_) | |
208 params.SetBoolean("useEmbedded", true); | 211 params.SetBoolean("useEmbedded", true); |
209 | 212 |
210 frame_state_ = FRAME_STATE_LOADING; | 213 frame_state_ = FRAME_STATE_LOADING; |
211 CallJS("loadAuthExtension", params); | 214 CallJS("loadAuthExtension", params); |
212 } | 215 } |
213 | 216 |
214 void GaiaScreenHandler::UpdateGaia(const GaiaContext& context) { | 217 void GaiaScreenHandler::UpdateGaia(const GaiaContext& context) { |
215 base::DictionaryValue params; | 218 base::DictionaryValue params; |
216 UpdateAuthParams(¶ms, context.has_users, | 219 UpdateAuthParams(¶ms, context.has_users, |
217 context.is_enrolling_consumer_management); | 220 context.is_enrolling_consumer_management); |
218 CallJS("updateAuthExtension", params); | 221 CallJS("updateAuthExtension", params); |
219 } | 222 } |
220 | 223 |
221 void GaiaScreenHandler::ReloadGaia(bool force_reload) { | 224 void GaiaScreenHandler::ReloadGaia(bool force_reload) { |
222 if (frame_state_ == FRAME_STATE_LOADING && !force_reload) { | 225 if (frame_state_ == FRAME_STATE_LOADING && !force_reload) { |
223 VLOG(1) << "Skipping reloading of Gaia since gaia is loading."; | 226 VLOG(1) << "Skipping reloading of Gaia since gaia is loading."; |
224 return; | 227 return; |
225 } | 228 } |
226 NetworkStateInformer::State state = network_state_informer_->state(); | 229 NetworkStateInformer::State state = network_state_informer_->state(); |
227 if (state != NetworkStateInformer::ONLINE) { | 230 if (state != NetworkStateInformer::ONLINE) { |
228 VLOG(1) << "Skipping reloading of Gaia since network state=" | 231 VLOG(1) << "Skipping reloading of Gaia since network state=" |
229 << NetworkStateInformer::StatusString(state); | 232 << NetworkStateInformer::StatusString(state); |
230 return; | 233 return; |
231 } | 234 } |
232 VLOG(1) << "Reloading Gaia."; | 235 VLOG(1) << "Reloading Gaia."; |
233 frame_state_ = FRAME_STATE_LOADING; | 236 frame_state_ = FRAME_STATE_LOADING; |
234 CallJS("doReload"); | 237 CallJS("doReload"); |
235 } | 238 } |
236 | 239 |
240 void GaiaScreenHandler::SwitchToEmbeddedSignin() { | |
241 // This feature should not be working on Stable,Beta images. | |
242 chrome::VersionInfo::Channel channel = chrome::VersionInfo::GetChannel(); | |
243 if (channel == chrome::VersionInfo::CHANNEL_STABLE || | |
244 channel == chrome::VersionInfo::CHANNEL_BETA) { | |
245 return; | |
246 } | |
247 embedded_signin_enabled_by_shortcut_ = true; | |
248 LoadAuthExtension(true, true, false); | |
249 embedded_signin_enabled_by_shortcut_ = false; | |
Nikita (slow)
2014/10/10 10:56:28
I suggest clearing this flag only when user explic
Roman Sorokin (ftl)
2014/10/10 12:19:32
Done.
| |
250 } | |
251 | |
237 void GaiaScreenHandler::DeclareLocalizedValues( | 252 void GaiaScreenHandler::DeclareLocalizedValues( |
238 LocalizedValuesBuilder* builder) { | 253 LocalizedValuesBuilder* builder) { |
239 builder->Add("signinScreenTitle", IDS_SIGNIN_SCREEN_TITLE); | 254 builder->Add("signinScreenTitle", IDS_SIGNIN_SCREEN_TITLE); |
240 builder->Add("signinScreenPasswordChanged", | 255 builder->Add("signinScreenPasswordChanged", |
241 IDS_SIGNIN_SCREEN_PASSWORD_CHANGED); | 256 IDS_SIGNIN_SCREEN_PASSWORD_CHANGED); |
242 builder->Add("createAccount", IDS_CREATE_ACCOUNT_HTML); | 257 builder->Add("createAccount", IDS_CREATE_ACCOUNT_HTML); |
243 builder->Add("guestSignin", IDS_BROWSE_WITHOUT_SIGNING_IN_HTML); | 258 builder->Add("guestSignin", IDS_BROWSE_WITHOUT_SIGNING_IN_HTML); |
244 builder->Add("createSupervisedUser", | 259 builder->Add("createSupervisedUser", |
245 IDS_CREATE_SUPERVISED_USER_HTML); | 260 IDS_CREATE_SUPERVISED_USER_HTML); |
246 builder->Add("createSupervisedUserFeatureName", | 261 builder->Add("createSupervisedUserFeatureName", |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
666 | 681 |
667 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { | 682 SigninScreenHandlerDelegate* GaiaScreenHandler::Delegate() { |
668 DCHECK(signin_screen_handler_); | 683 DCHECK(signin_screen_handler_); |
669 return signin_screen_handler_->delegate_; | 684 return signin_screen_handler_->delegate_; |
670 } | 685 } |
671 | 686 |
672 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { | 687 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { |
673 signin_screen_handler_ = handler; | 688 signin_screen_handler_ = handler; |
674 } | 689 } |
675 } // namespace chromeos | 690 } // namespace chromeos |
OLD | NEW |