| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "google_apis/gaia/oauth2_access_token_fetcher_impl.h" | 5 #include "google_apis/gaia/oauth2_access_token_fetcher_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 | 129 |
| 130 } // namespace | 130 } // namespace |
| 131 | 131 |
| 132 OAuth2AccessTokenFetcherImpl::OAuth2AccessTokenFetcherImpl( | 132 OAuth2AccessTokenFetcherImpl::OAuth2AccessTokenFetcherImpl( |
| 133 OAuth2AccessTokenConsumer* consumer, | 133 OAuth2AccessTokenConsumer* consumer, |
| 134 net::URLRequestContextGetter* getter, | 134 net::URLRequestContextGetter* getter, |
| 135 const std::string& refresh_token) | 135 const std::string& refresh_token) |
| 136 : OAuth2AccessTokenFetcher(consumer), | 136 : OAuth2AccessTokenFetcher(consumer), |
| 137 getter_(getter), | 137 getter_(getter), |
| 138 refresh_token_(refresh_token), | 138 refresh_token_(refresh_token), |
| 139 state_(INITIAL) {} | 139 state_(INITIAL) { |
| 140 DCHECK(getter_); |
| 141 } |
| 140 | 142 |
| 141 OAuth2AccessTokenFetcherImpl::~OAuth2AccessTokenFetcherImpl() {} | 143 OAuth2AccessTokenFetcherImpl::~OAuth2AccessTokenFetcherImpl() {} |
| 142 | 144 |
| 143 void OAuth2AccessTokenFetcherImpl::CancelRequest() { fetcher_.reset(); } | 145 void OAuth2AccessTokenFetcherImpl::CancelRequest() { fetcher_.reset(); } |
| 144 | 146 |
| 145 void OAuth2AccessTokenFetcherImpl::Start( | 147 void OAuth2AccessTokenFetcherImpl::Start( |
| 146 const std::string& client_id, | 148 const std::string& client_id, |
| 147 const std::string& client_secret, | 149 const std::string& client_secret, |
| 148 const std::vector<std::string>& scopes) { | 150 const std::vector<std::string>& scopes) { |
| 149 client_id_ = client_id; | 151 client_id_ = client_id; |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 // static | 314 // static |
| 313 bool OAuth2AccessTokenFetcherImpl::ParseGetAccessTokenFailureResponse( | 315 bool OAuth2AccessTokenFetcherImpl::ParseGetAccessTokenFailureResponse( |
| 314 const net::URLFetcher* source, | 316 const net::URLFetcher* source, |
| 315 std::string* error) { | 317 std::string* error) { |
| 316 CHECK(error); | 318 CHECK(error); |
| 317 scoped_ptr<base::DictionaryValue> value = ParseGetAccessTokenResponse(source); | 319 scoped_ptr<base::DictionaryValue> value = ParseGetAccessTokenResponse(source); |
| 318 if (value.get() == NULL) | 320 if (value.get() == NULL) |
| 319 return false; | 321 return false; |
| 320 return value->GetString(kErrorKey, error); | 322 return value->GetString(kErrorKey, error); |
| 321 } | 323 } |
| OLD | NEW |