OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ADDRESS_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ADDRESS_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 |
| 12 namespace base { |
| 13 class DictionaryValue; |
| 14 } |
| 15 |
| 16 namespace wallet { |
| 17 |
| 18 // TODO(ahutter): This address is a lot like chrome/browser/autofill/address.h. |
| 19 // There should be a super class that both extend from to clean up duplicated |
| 20 // code. See http://crbug.com/164463. |
| 21 |
| 22 // Address contains various address fields that have been populated from the |
| 23 // user's Online Wallet. |
| 24 class Address { |
| 25 public: |
| 26 Address(); |
| 27 // TODO(ahutter): Use additional fields (descriptive_name, is_post_box, |
| 28 // is_minimal_address, is_valid, is_default) when SaveToWallet is implemented. |
| 29 // See http://crbug.com/164284. |
| 30 Address(const std::string& country_name_code, |
| 31 const std::string& recipient_name, |
| 32 const std::string& address_line_1, |
| 33 const std::string& address_line_2, |
| 34 const std::string& locality_name, |
| 35 const std::string& administrative_area_name, |
| 36 const std::string& postal_code_number, |
| 37 const std::string& phone_number, |
| 38 const std::string& object_id); |
| 39 ~Address(); |
| 40 const std::string country_name_code() const { return country_name_code_; } |
| 41 const std::string recipient_name() const { return recipient_name_; } |
| 42 const std::string address_line_1() const { return address_line_1_; } |
| 43 const std::string address_line_2() const { return address_line_2_; } |
| 44 const std::string locality_name() const { return locality_name_; } |
| 45 const std::string admin_area_name() const { |
| 46 return administrative_area_name_; |
| 47 } |
| 48 const std::string postal_code_number() const { return postal_code_number_; } |
| 49 const std::string phone_number() const { return phone_number_; } |
| 50 const std::string object_id() const { return object_id_; } |
| 51 |
| 52 void set_country_name_code(const std::string& country_name_code) { |
| 53 country_name_code_ = country_name_code; |
| 54 } |
| 55 void set_recipient_name(const std::string& recipient_name) { |
| 56 recipient_name_ = recipient_name; |
| 57 } |
| 58 void set_address_line_1(const std::string& address_line_1) { |
| 59 address_line_1_ = address_line_1; |
| 60 } |
| 61 void set_address_line_2(const std::string& address_line_2) { |
| 62 address_line_2_ = address_line_2; |
| 63 } |
| 64 void set_locality_name(const std::string& locality_name) { |
| 65 locality_name_ = locality_name; |
| 66 } |
| 67 void set_admin_area_name(const std::string& administrative_area_name) { |
| 68 administrative_area_name_ = administrative_area_name; |
| 69 } |
| 70 void set_postal_code_number(const std::string& postal_code_number) { |
| 71 postal_code_number_ = postal_code_number; |
| 72 } |
| 73 void set_phone_number(const std::string& phone_number) { |
| 74 phone_number_ = phone_number; |
| 75 } |
| 76 void set_object_id(const std::string& object_id) { |
| 77 object_id_ = object_id; |
| 78 } |
| 79 |
| 80 // Returns null if input is invalid or a valid address that is selectable for |
| 81 // Google Wallet use. Caller owns returned pointer. |
| 82 static Address* CreateAddressWithID(const base::DictionaryValue& dictionary); |
| 83 |
| 84 // Returns null if input in invalid or a valid address that can only be used |
| 85 // for displaying to the user. Caller owns returned pointer. |
| 86 static Address* CreateDisplayAddress(const base::DictionaryValue& dictionary); |
| 87 |
| 88 bool operator==(const Address& other) const; |
| 89 bool operator!=(const Address& other) const; |
| 90 |
| 91 private: |
| 92 std::string country_name_code_; |
| 93 std::string recipient_name_; |
| 94 std::string address_line_1_; |
| 95 std::string address_line_2_; |
| 96 std::string locality_name_; |
| 97 std::string administrative_area_name_; |
| 98 std::string postal_code_number_; |
| 99 std::string phone_number_; |
| 100 std::string object_id_; |
| 101 DISALLOW_COPY_AND_ASSIGN(Address); |
| 102 }; |
| 103 |
| 104 } // end wallet namespace |
| 105 |
| 106 #endif // CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ADDRESS_H_ |
OLD | NEW |