OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/autofill/core/browser/payments/payments_client.h" | 5 #include "components/autofill/core/browser/payments/payments_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 std::string GetRequestContentType() override { return "application/json"; } | 233 std::string GetRequestContentType() override { return "application/json"; } |
234 | 234 |
235 std::string GetRequestContent() override { | 235 std::string GetRequestContent() override { |
236 base::DictionaryValue request_dict; | 236 base::DictionaryValue request_dict; |
237 scoped_ptr<base::DictionaryValue> context(new base::DictionaryValue()); | 237 scoped_ptr<base::DictionaryValue> context(new base::DictionaryValue()); |
238 context->SetString("language_code", app_locale_); | 238 context->SetString("language_code", app_locale_); |
239 request_dict.Set("context", context.Pass()); | 239 request_dict.Set("context", context.Pass()); |
240 | 240 |
241 std::string request_content; | 241 std::string request_content; |
242 base::JSONWriter::Write(request_dict, &request_content); | 242 base::JSONWriter::Write(request_dict, &request_content); |
243 VLOG(3) << "getsavecarddetails request body: " << request_content; | 243 VLOG(3) << "getdetailsforsavecard request body: " << request_content; |
244 return request_content; | 244 return request_content; |
245 } | 245 } |
246 | 246 |
247 void ParseResponse(scoped_ptr<base::DictionaryValue> response) override { | 247 void ParseResponse(scoped_ptr<base::DictionaryValue> response) override { |
248 response->GetString("context_token", &context_token_); | 248 response->GetString("context_token", &context_token_); |
249 base::DictionaryValue* unowned_legal_message; | 249 base::DictionaryValue* unowned_legal_message; |
250 if (response->GetDictionary("legal_message", &unowned_legal_message)) | 250 if (response->GetDictionary("legal_message", &unowned_legal_message)) |
251 legal_message_ = unowned_legal_message->CreateDeepCopy(); | 251 legal_message_ = unowned_legal_message->CreateDeepCopy(); |
252 } | 252 } |
253 | 253 |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 | 531 |
532 void PaymentsClient::SetOAuth2TokenAndStartRequest() { | 532 void PaymentsClient::SetOAuth2TokenAndStartRequest() { |
533 url_fetcher_->AddExtraRequestHeader(net::HttpRequestHeaders::kAuthorization + | 533 url_fetcher_->AddExtraRequestHeader(net::HttpRequestHeaders::kAuthorization + |
534 std::string(": Bearer ") + access_token_); | 534 std::string(": Bearer ") + access_token_); |
535 | 535 |
536 url_fetcher_->Start(); | 536 url_fetcher_->Start(); |
537 } | 537 } |
538 | 538 |
539 } // namespace payments | 539 } // namespace payments |
540 } // namespace autofill | 540 } // namespace autofill |
OLD | NEW |