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