| 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/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" | 10 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" |
| 11 #include "chrome/browser/chromeos/login/users/user_manager.h" | 11 #include "chrome/browser/chromeos/login/users/user_manager.h" |
| 12 #include "chrome/browser/chromeos/settings/cros_settings.h" | 12 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 13 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" | 13 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h" |
| 14 #include "chromeos/chromeos_switches.h" |
| 14 #include "chromeos/settings/cros_settings_names.h" | 15 #include "chromeos/settings/cros_settings_names.h" |
| 15 #include "google_apis/gaia/gaia_switches.h" | 16 #include "google_apis/gaia/gaia_switches.h" |
| 16 #include "google_apis/gaia/gaia_urls.h" | 17 #include "google_apis/gaia/gaia_urls.h" |
| 17 #include "grit/chromium_strings.h" | 18 #include "grit/chromium_strings.h" |
| 18 #include "grit/generated_resources.h" | 19 #include "grit/generated_resources.h" |
| 19 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 20 | 21 |
| 21 namespace chromeos { | 22 namespace chromeos { |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 "stringEmptyEmail", | 132 "stringEmptyEmail", |
| 132 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_EMPTY_EMAIL)); | 133 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_EMPTY_EMAIL)); |
| 133 localized_strings->SetString( | 134 localized_strings->SetString( |
| 134 "stringEmptyPassword", | 135 "stringEmptyPassword", |
| 135 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_EMPTY_PASSWORD)); | 136 l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_EMPTY_PASSWORD)); |
| 136 localized_strings->SetString( | 137 localized_strings->SetString( |
| 137 "stringError", l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_ERROR)); | 138 "stringError", l10n_util::GetStringUTF16(IDS_LOGIN_OFFLINE_ERROR)); |
| 138 params.Set("localizedStrings", localized_strings); | 139 params.Set("localizedStrings", localized_strings); |
| 139 } | 140 } |
| 140 | 141 |
| 142 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
| 143 |
| 141 const GURL gaia_url = | 144 const GURL gaia_url = |
| 142 CommandLine::ForCurrentProcess()->HasSwitch(::switches::kGaiaUrl) | 145 command_line->HasSwitch(::switches::kGaiaUrl) |
| 143 ? GURL(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 146 ? GURL(command_line->GetSwitchValueASCII(::switches::kGaiaUrl)) |
| 144 ::switches::kGaiaUrl)) | |
| 145 : GaiaUrls::GetInstance()->gaia_url(); | 147 : GaiaUrls::GetInstance()->gaia_url(); |
| 146 params.SetString("gaiaUrl", gaia_url.spec()); | 148 params.SetString("gaiaUrl", gaia_url.spec()); |
| 147 | 149 |
| 150 if (command_line->HasSwitch(chromeos::switches::kEnableEmbeddedSignin)) |
| 151 params.SetBoolean("useEmbedded", true); |
| 152 |
| 148 frame_state_ = FRAME_STATE_LOADING; | 153 frame_state_ = FRAME_STATE_LOADING; |
| 149 CallJS("loadAuthExtension", params); | 154 CallJS("loadAuthExtension", params); |
| 150 } | 155 } |
| 151 | 156 |
| 152 void GaiaScreenHandler::UpdateGaia(const GaiaContext& context) { | 157 void GaiaScreenHandler::UpdateGaia(const GaiaContext& context) { |
| 153 base::DictionaryValue params; | 158 base::DictionaryValue params; |
| 154 UpdateAuthParams(¶ms, context.has_users); | 159 UpdateAuthParams(¶ms, context.has_users); |
| 155 CallJS("updateAuthExtension", params); | 160 CallJS("updateAuthExtension", params); |
| 156 } | 161 } |
| 157 | 162 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 void GaiaScreenHandler::UpdateState(ErrorScreenActor::ErrorReason reason) { | 232 void GaiaScreenHandler::UpdateState(ErrorScreenActor::ErrorReason reason) { |
| 228 if (signin_screen_handler_) | 233 if (signin_screen_handler_) |
| 229 signin_screen_handler_->UpdateState(reason); | 234 signin_screen_handler_->UpdateState(reason); |
| 230 } | 235 } |
| 231 | 236 |
| 232 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { | 237 void GaiaScreenHandler::SetSigninScreenHandler(SigninScreenHandler* handler) { |
| 233 signin_screen_handler_ = handler; | 238 signin_screen_handler_ = handler; |
| 234 } | 239 } |
| 235 | 240 |
| 236 } // namespace chromeos | 241 } // namespace chromeos |
| OLD | NEW |