summaryrefslogtreecommitdiffstats
path: root/chrome/browser/sync/sync_setup_flow.cc
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 21:22:09 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-12 21:22:09 +0000
commit1fc9b3ffe78b02bcb819fefa2b0884a1e31d060b (patch)
tree56d7edd9250228f9b4c41ed87e1358ee37296a7e /chrome/browser/sync/sync_setup_flow.cc
parentc8b4944b44f10dc92209737015d81ca5eac9c1e7 (diff)
downloadchromium_src-1fc9b3ffe78b02bcb819fefa2b0884a1e31d060b.zip
chromium_src-1fc9b3ffe78b02bcb819fefa2b0884a1e31d060b.tar.gz
chromium_src-1fc9b3ffe78b02bcb819fefa2b0884a1e31d060b.tar.bz2
Implement the gaia captcha state and unlock capability in the sync setup wizard.
BUG=19738 TEST=Get a Google Account into captcha state. Start syncing. You should be presented with a captcha image and textbox to answer the challenge. Doing so correctly shoud unlock your account and proceed with sync setup. Review URL: http://codereview.chromium.org/389017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31829 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/sync/sync_setup_flow.cc')
-rw-r--r--chrome/browser/sync/sync_setup_flow.cc15
1 files changed, 9 insertions, 6 deletions
diff --git a/chrome/browser/sync/sync_setup_flow.cc b/chrome/browser/sync/sync_setup_flow.cc
index 50a8c2c..7e4b140 100644
--- a/chrome/browser/sync/sync_setup_flow.cc
+++ b/chrome/browser/sync/sync_setup_flow.cc
@@ -55,15 +55,16 @@ void FlowHandler::RegisterMessages() {
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 @@ static bool GetUsernameAndPassword(const std::string& json,
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 @@ void FlowHandler::HandleSubmitAuth(const Value* value) {
}
if (flow_)
- flow_->OnUserSubmittedAuth(username, password);
+ flow_->OnUserSubmittedAuth(username, password, captcha);
}
void FlowHandler::HandleSubmitMergeAndSync(const Value* value) {
@@ -223,6 +224,8 @@ void SyncSetupFlow::GetArgsForGaiaLogin(const ProfileSyncService* service,
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(