| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/content/browser/wallet/wallet_client.h" | 5 #include "components/autofill/content/browser/wallet/wallet_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.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/logging.h" | 10 #include "base/logging.h" |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 // HTTP_BAD_REQUEST means the arguments are invalid. No point retrying. | 583 // HTTP_BAD_REQUEST means the arguments are invalid. No point retrying. |
| 584 case net::HTTP_BAD_REQUEST: { | 584 case net::HTTP_BAD_REQUEST: { |
| 585 request_type_ = NO_PENDING_REQUEST; | 585 request_type_ = NO_PENDING_REQUEST; |
| 586 HandleWalletError(BAD_REQUEST); | 586 HandleWalletError(BAD_REQUEST); |
| 587 return; | 587 return; |
| 588 } | 588 } |
| 589 // HTTP_OK holds a valid response and HTTP_INTERNAL_SERVER_ERROR holds an | 589 // HTTP_OK holds a valid response and HTTP_INTERNAL_SERVER_ERROR holds an |
| 590 // error code and message for the user. | 590 // error code and message for the user. |
| 591 case net::HTTP_OK: | 591 case net::HTTP_OK: |
| 592 case net::HTTP_INTERNAL_SERVER_ERROR: { | 592 case net::HTTP_INTERNAL_SERVER_ERROR: { |
| 593 scoped_ptr<Value> message_value(base::JSONReader::Read(data)); | 593 scoped_ptr<base::Value> message_value(base::JSONReader::Read(data)); |
| 594 if (message_value.get() && | 594 if (message_value.get() && |
| 595 message_value->IsType(Value::TYPE_DICTIONARY)) { | 595 message_value->IsType(base::Value::TYPE_DICTIONARY)) { |
| 596 response_dict.reset( | 596 response_dict.reset( |
| 597 static_cast<base::DictionaryValue*>(message_value.release())); | 597 static_cast<base::DictionaryValue*>(message_value.release())); |
| 598 } | 598 } |
| 599 if (response_code == net::HTTP_INTERNAL_SERVER_ERROR) { | 599 if (response_code == net::HTTP_INTERNAL_SERVER_ERROR) { |
| 600 request_type_ = NO_PENDING_REQUEST; | 600 request_type_ = NO_PENDING_REQUEST; |
| 601 | 601 |
| 602 std::string error_type_string; | 602 std::string error_type_string; |
| 603 if (!response_dict->GetString(kErrorTypeKey, &error_type_string)) { | 603 if (!response_dict->GetString(kErrorTypeKey, &error_type_string)) { |
| 604 HandleWalletError(UNKNOWN_ERROR); | 604 HandleWalletError(UNKNOWN_ERROR); |
| 605 return; | 605 return; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 NOTREACHED(); | 805 NOTREACHED(); |
| 806 return AutofillMetrics::UNKNOWN_API_CALL; | 806 return AutofillMetrics::UNKNOWN_API_CALL; |
| 807 } | 807 } |
| 808 | 808 |
| 809 NOTREACHED(); | 809 NOTREACHED(); |
| 810 return AutofillMetrics::UNKNOWN_API_CALL; | 810 return AutofillMetrics::UNKNOWN_API_CALL; |
| 811 } | 811 } |
| 812 | 812 |
| 813 } // namespace wallet | 813 } // namespace wallet |
| 814 } // namespace autofill | 814 } // namespace autofill |
| OLD | NEW |