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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 net::EscapeUrlEncodedData(parameters_.extension_id, true).c_str()); | 151 net::EscapeUrlEncodedData(parameters_.extension_id, true).c_str()); |
152 } | 152 } |
153 | 153 |
154 void OAuth2MintTokenFlow::ProcessApiCallSuccess( | 154 void OAuth2MintTokenFlow::ProcessApiCallSuccess( |
155 const net::URLFetcher* source) { | 155 const net::URLFetcher* source) { |
156 // TODO(munjal): Change error code paths in this method to report an | 156 // TODO(munjal): Change error code paths in this method to report an |
157 // internal error. | 157 // internal error. |
158 std::string response_body; | 158 std::string response_body; |
159 source->GetResponseAsString(&response_body); | 159 source->GetResponseAsString(&response_body); |
160 scoped_ptr<base::Value> value(base::JSONReader::Read(response_body)); | 160 scoped_ptr<base::Value> value(base::JSONReader::Read(response_body)); |
161 DictionaryValue* dict = NULL; | 161 base::DictionaryValue* dict = NULL; |
162 if (!value.get() || !value->GetAsDictionary(&dict)) { | 162 if (!value.get() || !value->GetAsDictionary(&dict)) { |
163 ReportFailure(GoogleServiceAuthError::FromConnectionError(101)); | 163 ReportFailure(GoogleServiceAuthError::FromConnectionError(101)); |
164 return; | 164 return; |
165 } | 165 } |
166 | 166 |
167 std::string issue_advice; | 167 std::string issue_advice; |
168 if (!dict->GetString(kIssueAdviceKey, &issue_advice)) { | 168 if (!dict->GetString(kIssueAdviceKey, &issue_advice)) { |
169 ReportFailure(GoogleServiceAuthError::FromConnectionError(101)); | 169 ReportFailure(GoogleServiceAuthError::FromConnectionError(101)); |
170 return; | 170 return; |
171 } | 171 } |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 for (size_t i = 0; i < entry.details.size(); i++) | 247 for (size_t i = 0; i < entry.details.size(); i++) |
248 TrimWhitespace(entry.details[i], TRIM_ALL, &entry.details[i]); | 248 TrimWhitespace(entry.details[i], TRIM_ALL, &entry.details[i]); |
249 issue_advice->push_back(entry); | 249 issue_advice->push_back(entry); |
250 } | 250 } |
251 | 251 |
252 if (!success) | 252 if (!success) |
253 issue_advice->clear(); | 253 issue_advice->clear(); |
254 | 254 |
255 return success; | 255 return success; |
256 } | 256 } |
OLD | NEW |