| 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 "chrome/common/net/gaia/oauth2_mint_token_flow.h" | 5 #include "chrome/common/net/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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 net::EscapeUrlEncodedData(parameters_.client_id, true).c_str(), | 177 net::EscapeUrlEncodedData(parameters_.client_id, true).c_str(), |
| 178 net::EscapeUrlEncodedData(parameters_.extension_id, true).c_str()); | 178 net::EscapeUrlEncodedData(parameters_.extension_id, true).c_str()); |
| 179 } | 179 } |
| 180 | 180 |
| 181 void OAuth2MintTokenFlow::ProcessApiCallSuccess( | 181 void OAuth2MintTokenFlow::ProcessApiCallSuccess( |
| 182 const net::URLFetcher* source) { | 182 const net::URLFetcher* source) { |
| 183 // TODO(munjal): Change error code paths in this method to report an | 183 // TODO(munjal): Change error code paths in this method to report an |
| 184 // internal error. | 184 // internal error. |
| 185 std::string response_body; | 185 std::string response_body; |
| 186 source->GetResponseAsString(&response_body); | 186 source->GetResponseAsString(&response_body); |
| 187 base::JSONReader reader; | 187 scoped_ptr<base::Value> value(base::JSONReader::Read(response_body)); |
| 188 scoped_ptr<base::Value> value(reader.Read(response_body, false)); | |
| 189 DictionaryValue* dict = NULL; | 188 DictionaryValue* dict = NULL; |
| 190 if (!value.get() || !value->GetAsDictionary(&dict)) { | 189 if (!value.get() || !value->GetAsDictionary(&dict)) { |
| 191 ReportFailure(GoogleServiceAuthError::FromConnectionError(101)); | 190 ReportFailure(GoogleServiceAuthError::FromConnectionError(101)); |
| 192 return; | 191 return; |
| 193 } | 192 } |
| 194 | 193 |
| 195 std::string issue_advice; | 194 std::string issue_advice; |
| 196 if (!dict->GetString(kIssueAdviceKey, &issue_advice)) { | 195 if (!dict->GetString(kIssueAdviceKey, &issue_advice)) { |
| 197 ReportFailure(GoogleServiceAuthError::FromConnectionError(101)); | 196 ReportFailure(GoogleServiceAuthError::FromConnectionError(101)); |
| 198 return; | 197 return; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 262 |
| 264 Tokenize(detail, kDetailSeparators, &entry.details); | 263 Tokenize(detail, kDetailSeparators, &entry.details); |
| 265 issue_advice->push_back(entry); | 264 issue_advice->push_back(entry); |
| 266 } | 265 } |
| 267 | 266 |
| 268 if (!success) | 267 if (!success) |
| 269 issue_advice->clear(); | 268 issue_advice->clear(); |
| 270 | 269 |
| 271 return success; | 270 return success; |
| 272 } | 271 } |
| OLD | NEW |