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

Unified Diff: chrome/browser/sync/sync_setup_flow.cc

Issue 389017: Implement the gaia captcha state and unlock capability in the sync setup wiza... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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
« no previous file with comments | « chrome/browser/sync/sync_setup_flow.h ('k') | chrome/browser/sync/sync_setup_wizard.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/sync_setup_flow.cc
===================================================================
--- chrome/browser/sync/sync_setup_flow.cc (revision 31729)
+++ chrome/browser/sync/sync_setup_flow.cc (working copy)
@@ -55,15 +55,16 @@
NewCallback(this, &FlowHandler::HandleSubmitMergeAndSync));
}
-static bool GetUsernameAndPassword(const std::string& json,
- std::string* username, std::string* password) {
+static bool GetAuthData(const std::string& json,
+ std::string* username, std::string* password, std::string* captcha) {
scoped_ptr<Value> parsed_value(base::JSONReader::Read(json, false));
if (!parsed_value.get() || !parsed_value->IsType(Value::TYPE_DICTIONARY))
return false;
DictionaryValue* result = static_cast<DictionaryValue*>(parsed_value.get());
if (!result->GetString(L"user", username) ||
- !result->GetString(L"pass", password)) {
+ !result->GetString(L"pass", password) ||
+ !result->GetString(L"captcha", captcha)) {
return false;
}
return true;
@@ -71,11 +72,11 @@
void FlowHandler::HandleSubmitAuth(const Value* value) {
std::string json(GetJsonResponse(value));
- std::string username, password;
+ std::string username, password, captcha;
if (json.empty())
return;
- if (!GetUsernameAndPassword(json, &username, &password)) {
+ if (!GetAuthData(json, &username, &password, &captcha)) {
// The page sent us something that we didn't understand.
// This probably indicates a programming error.
NOTREACHED();
@@ -83,7 +84,7 @@
}
if (flow_)
- flow_->OnUserSubmittedAuth(username, password);
+ flow_->OnUserSubmittedAuth(username, password, captcha);
}
void FlowHandler::HandleSubmitMergeAndSync(const Value* value) {
@@ -223,6 +224,8 @@
args->SetString(L"user", user);
args->SetInteger(L"error", user.empty() ? 0 : error.state());
}
+
+ args->SetString(L"captchaUrl", error.captcha().image_url.spec());
}
void SyncSetupFlow::GetDOMMessageHandlers(
« no previous file with comments | « chrome/browser/sync/sync_setup_flow.h ('k') | chrome/browser/sync/sync_setup_wizard.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698