| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_mint_token_flow.h" | 5 #include "google_apis/gaia/oauth2_mint_token_flow.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 JoinString(parameters_.scopes, ' '), true).c_str(), | 171 JoinString(parameters_.scopes, ' '), true).c_str(), |
| 172 net::EscapeUrlEncodedData(parameters_.client_id, true).c_str(), | 172 net::EscapeUrlEncodedData(parameters_.client_id, true).c_str(), |
| 173 net::EscapeUrlEncodedData(parameters_.extension_id, true).c_str()); | 173 net::EscapeUrlEncodedData(parameters_.extension_id, true).c_str()); |
| 174 } | 174 } |
| 175 | 175 |
| 176 void OAuth2MintTokenFlow::ProcessApiCallSuccess( | 176 void OAuth2MintTokenFlow::ProcessApiCallSuccess( |
| 177 const net::URLFetcher* source) { | 177 const net::URLFetcher* source) { |
| 178 std::string response_body; | 178 std::string response_body; |
| 179 source->GetResponseAsString(&response_body); | 179 source->GetResponseAsString(&response_body); |
| 180 scoped_ptr<base::Value> value(base::JSONReader::Read(response_body)); | 180 scoped_ptr<base::Value> value(base::JSONReader::Read(response_body)); |
| 181 DictionaryValue* dict = NULL; | 181 base::DictionaryValue* dict = NULL; |
| 182 if (!value.get() || !value->GetAsDictionary(&dict)) { | 182 if (!value.get() || !value->GetAsDictionary(&dict)) { |
| 183 ReportFailure(GoogleServiceAuthError::FromUnexpectedServiceResponse( | 183 ReportFailure(GoogleServiceAuthError::FromUnexpectedServiceResponse( |
| 184 "Not able to parse a JSON object from a service response.")); | 184 "Not able to parse a JSON object from a service response.")); |
| 185 return; | 185 return; |
| 186 } | 186 } |
| 187 | 187 |
| 188 std::string issue_advice_value; | 188 std::string issue_advice_value; |
| 189 if (!dict->GetString(kIssueAdviceKey, &issue_advice_value)) { | 189 if (!dict->GetString(kIssueAdviceKey, &issue_advice_value)) { |
| 190 ReportFailure(GoogleServiceAuthError::FromUnexpectedServiceResponse( | 190 ReportFailure(GoogleServiceAuthError::FromUnexpectedServiceResponse( |
| 191 "Not able to find an issueAdvice in a service response.")); | 191 "Not able to find an issueAdvice in a service response.")); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 for (size_t i = 0; i < entry.details.size(); i++) | 273 for (size_t i = 0; i < entry.details.size(); i++) |
| 274 TrimWhitespace(entry.details[i], TRIM_ALL, &entry.details[i]); | 274 TrimWhitespace(entry.details[i], TRIM_ALL, &entry.details[i]); |
| 275 issue_advice->push_back(entry); | 275 issue_advice->push_back(entry); |
| 276 } | 276 } |
| 277 | 277 |
| 278 if (!success) | 278 if (!success) |
| 279 issue_advice->clear(); | 279 issue_advice->clear(); |
| 280 | 280 |
| 281 return success; | 281 return success; |
| 282 } | 282 } |
| OLD | NEW |