diff options
author | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-15 21:42:33 +0000 |
---|---|---|
committer | xiyuan@chromium.org <xiyuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-15 21:43:57 +0000 |
commit | 7c37d21139d766a0cecf1336a2485f019c9cb219 (patch) | |
tree | 29638bfdf391a3a2afe1e295cb787dcfd9fb4fa5 /google_apis | |
parent | 648f8114b1298813e1baa249adfbe73158913773 (diff) | |
download | chromium_src-7c37d21139d766a0cecf1336a2485f019c9cb219.zip chromium_src-7c37d21139d766a0cecf1336a2485f019c9cb219.tar.gz chromium_src-7c37d21139d766a0cecf1336a2485f019c9cb219.tar.bz2 |
Wire easy unlock settings UI
- Add API to get/set/clear the pairing info into user prefs;
- Add an onTurnFlowFinished event so that the app can clear its state;
- Extend EasyUnlockService to store pairing info and provide
turn-off flow support;
- Update settings UI to trigger turn off flow and observe
the turn-off flow status to show pending/error or dismiss when done;
- Add EasyUnlockToggleFlow to wrap api calls to server;
- Update OAuth2ApiFlow to support application/json content-type and
handle 204 as success;
BUG=397356,394640
Review URL: https://codereview.chromium.org/475483003
Cr-Commit-Position: refs/heads/master@{#290019}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@290019 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'google_apis')
-rw-r--r-- | google_apis/gaia/oauth2_api_call_flow.cc | 9 | ||||
-rw-r--r-- | google_apis/gaia/oauth2_api_call_flow.h | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/google_apis/gaia/oauth2_api_call_flow.cc b/google_apis/gaia/oauth2_api_call_flow.cc index 08312eb..07f3208 100644 --- a/google_apis/gaia/oauth2_api_call_flow.cc +++ b/google_apis/gaia/oauth2_api_call_flow.cc @@ -90,7 +90,8 @@ void OAuth2ApiCallFlow::EndApiCall(const net::URLFetcher* source) { return; } - if (source->GetResponseCode() != net::HTTP_OK) { + if (source->GetResponseCode() != net::HTTP_OK && + source->GetResponseCode() != net::HTTP_NO_CONTENT) { state_ = ERROR_STATE; ProcessApiCallFailure(source); return; @@ -125,6 +126,10 @@ void OAuth2ApiCallFlow::EndMintAccessToken( } } +std::string OAuth2ApiCallFlow::CreateApiCallBodyContentType() { + return "application/x-www-form-urlencoded"; +} + OAuth2AccessTokenFetcher* OAuth2ApiCallFlow::CreateAccessTokenFetcher() { return new OAuth2AccessTokenFetcherImpl(this, context_, refresh_token_); } @@ -166,7 +171,7 @@ URLFetcher* OAuth2ApiCallFlow::CreateURLFetcher() { result->SetAutomaticallyRetryOnNetworkChanges(3); if (!empty_body) - result->SetUploadData("application/x-www-form-urlencoded", body); + result->SetUploadData(CreateApiCallBodyContentType(), body); return result; } diff --git a/google_apis/gaia/oauth2_api_call_flow.h b/google_apis/gaia/oauth2_api_call_flow.h index b29bc8a..70c9b51 100644 --- a/google_apis/gaia/oauth2_api_call_flow.h +++ b/google_apis/gaia/oauth2_api_call_flow.h @@ -66,6 +66,7 @@ class OAuth2ApiCallFlow // Methods to help create HTTP request. virtual GURL CreateApiCallUrl() = 0; virtual std::string CreateApiCallBody() = 0; + virtual std::string CreateApiCallBodyContentType(); // Sub-classes can expose an appropriate observer interface by implementing // these template methods. |