Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(132)

Unified Diff: chrome/browser/remoting/setup_flow_login_step.cc

Issue 6178012: Bugfixes for the remoting setup wizard: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/remoting/setup_flow_login_step.cc
diff --git a/chrome/browser/remoting/setup_flow_login_step.cc b/chrome/browser/remoting/setup_flow_login_step.cc
index 71ee79be700f0e26861002d7675fc4f0e515a846..ada7d2f5d5ff4be7bb42bc486ab5d2c76cf0eb1c 100644
--- a/chrome/browser/remoting/setup_flow_login_step.cc
+++ b/chrome/browser/remoting/setup_flow_login_step.cc
@@ -20,6 +20,11 @@ namespace remoting {
static const wchar_t kLoginIFrameXPath[] = L"//iframe[@id='login']";
SetupFlowLoginStep::SetupFlowLoginStep() { }
+
+SetupFlowLoginStep::SetupFlowLoginStep(const string16& error_message)
+ : error_message_(error_message) {
+}
+
SetupFlowLoginStep::~SetupFlowLoginStep() { }
void SetupFlowLoginStep::HandleMessage(const std::string& message,
@@ -41,17 +46,18 @@ void SetupFlowLoginStep::HandleMessage(const std::string& message,
CHECK(parsed_value->IsType(Value::TYPE_DICTIONARY));
- std::string username, password, captcha;
+ std::string username, password, captcha, access_code;
const DictionaryValue* result =
static_cast<const DictionaryValue*>(parsed_value.get());
if (!result->GetString("user", &username) ||
!result->GetString("pass", &password) ||
- !result->GetString("captcha", &captcha)) {
+ !result->GetString("captcha", &captcha) ||
+ !result->GetString("access_code", &access_code)) {
NOTREACHED() << "Unable to parse auth data";
return;
}
- OnUserSubmittedAuth(username, password, captcha);
+ OnUserSubmittedAuth(username, password, captcha, access_code);
}
}
@@ -62,14 +68,22 @@ void SetupFlowLoginStep::Cancel() {
void SetupFlowLoginStep::OnUserSubmittedAuth(const std::string& user,
const std::string& password,
- const std::string& captcha) {
+ const std::string& captcha,
+ const std::string& access_code) {
flow()->context()->login = user;
// Start the authenticator.
authenticator_.reset(
new GaiaAuthFetcher(this, GaiaConstants::kChromeSource,
flow()->profile()->GetRequestContext()));
- authenticator_->StartClientLogin(user, password,
+
+ std::string remoting_password;
+ if (!access_code.empty())
+ remoting_password = access_code;
+ else
+ remoting_password = password;
+
+ authenticator_->StartClientLogin(user, remoting_password,
GaiaConstants::kRemotingService,
"", captcha,
GaiaAuthFetcher::HostedAccountsAllowed);
@@ -112,6 +126,8 @@ void SetupFlowLoginStep::DoStart() {
// TODO(sergeyu): Supply current login name if the service was started before.
args.SetString("user", "");
args.SetBoolean("editable_user", true);
+ if (!error_message_.empty())
+ args.SetString("error_message", error_message_);
ShowGaiaLogin(args);
}
@@ -123,14 +139,13 @@ void SetupFlowLoginStep::ShowGaiaLogin(const DictionaryValue& args) {
std::string json;
base::JSONWriter::Write(&args, false, &json);
- std::wstring javascript = std::wstring(L"showGaiaLogin") +
- L"(" + UTF8ToWide(json) + L");";
+ std::wstring javascript = std::wstring(L"showGaiaLogin(") +
+ UTF8ToWide(json) + L");";
ExecuteJavascriptInIFrame(kLoginIFrameXPath, javascript);
}
void SetupFlowLoginStep::ShowGaiaFailed(const GoogleServiceAuthError& error) {
DictionaryValue args;
- args.SetString("user", "");
args.SetInteger("error", error.state());
args.SetBoolean("editable_user", true);
args.SetString("captchaUrl", error.captcha().image_url.spec());
« no previous file with comments | « chrome/browser/remoting/setup_flow_login_step.h ('k') | chrome/browser/remoting/setup_flow_register_step.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698