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 #ifndef CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ADDRESS_H_ | 5 #ifndef CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ADDRESS_H_ |
6 #define CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ADDRESS_H_ | 6 #define CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ADDRESS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/string16.h" |
| 13 #include "chrome/browser/autofill/field_types.h" |
12 | 14 |
13 namespace base { | 15 namespace base { |
14 class DictionaryValue; | 16 class DictionaryValue; |
15 } | 17 } |
16 | 18 |
17 namespace wallet { | 19 namespace wallet { |
18 | 20 |
19 // TODO(ahutter): This address is a lot like chrome/browser/autofill/address.h. | 21 // 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 | 22 // There should be a super class that both extend from to clean up duplicated |
21 // code. See http://crbug.com/164463. | 23 // code. See http://crbug.com/164463. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 82 |
81 // If an address is being upgraded, it will be sent to the server in a | 83 // If an address is being upgraded, it will be sent to the server in a |
82 // different format and with a few additional fields set, most importantly | 84 // different format and with a few additional fields set, most importantly |
83 // |object_id_|. | 85 // |object_id_|. |
84 scoped_ptr<base::DictionaryValue> ToDictionaryWithID() const; | 86 scoped_ptr<base::DictionaryValue> ToDictionaryWithID() const; |
85 | 87 |
86 // Newly created addresses will not have an associated |object_id_| and are | 88 // Newly created addresses will not have an associated |object_id_| and are |
87 // sent to the server in a slightly different format. | 89 // sent to the server in a slightly different format. |
88 scoped_ptr<base::DictionaryValue> ToDictionaryWithoutID() const; | 90 scoped_ptr<base::DictionaryValue> ToDictionaryWithoutID() const; |
89 | 91 |
| 92 // Returns a string that summarizes this address, suitable for display to |
| 93 // the user. |
| 94 string16 DisplayName() const; |
| 95 |
| 96 // Returns data appropriate for |type|. |
| 97 string16 GetInfo(AutofillFieldType type) const; |
| 98 |
90 // Returns an empty scoped_ptr if input is invalid or a valid address that is | 99 // Returns an empty scoped_ptr if input is invalid or a valid address that is |
91 // selectable for Google Wallet use. | 100 // selectable for Google Wallet use. |
92 static scoped_ptr<Address> | 101 static scoped_ptr<Address> |
93 CreateAddressWithID(const base::DictionaryValue& dictionary); | 102 CreateAddressWithID(const base::DictionaryValue& dictionary); |
94 | 103 |
95 // Returns an empty scoped_ptr if input in invalid or a valid address that | 104 // Returns an empty scoped_ptr if input in invalid or a valid address that |
96 // can only be used for displaying to the user. | 105 // can only be used for displaying to the user. |
97 static scoped_ptr<Address> | 106 static scoped_ptr<Address> |
98 CreateDisplayAddress(const base::DictionaryValue& dictionary); | 107 CreateDisplayAddress(const base::DictionaryValue& dictionary); |
99 | 108 |
(...skipping 10 matching lines...) Expand all Loading... |
110 std::string postal_code_number_; | 119 std::string postal_code_number_; |
111 std::string phone_number_; | 120 std::string phone_number_; |
112 std::string object_id_; | 121 std::string object_id_; |
113 DISALLOW_COPY_AND_ASSIGN(Address); | 122 DISALLOW_COPY_AND_ASSIGN(Address); |
114 }; | 123 }; |
115 | 124 |
116 } // namespace wallet | 125 } // namespace wallet |
117 | 126 |
118 #endif // CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ADDRESS_H_ | 127 #endif // CHROME_BROWSER_AUTOFILL_WALLET_WALLET_ADDRESS_H_ |
119 | 128 |
OLD | NEW |