diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-22 07:46:35 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-22 07:46:35 +0000 |
commit | 5f877331f7a9f3a917ceb378ffe7cb5315f2f0d0 (patch) | |
tree | bdea5c6ae76490b65fb2951a64e7bdeed312ab6a /components | |
parent | eac2b36333c3947f650e96c3b45e9afed616e4b3 (diff) | |
download | chromium_src-5f877331f7a9f3a917ceb378ffe7cb5315f2f0d0.zip chromium_src-5f877331f7a9f3a917ceb378ffe7cb5315f2f0d0.tar.gz chromium_src-5f877331f7a9f3a917ceb378ffe7cb5315f2f0d0.tar.bz2 |
Revert 201451 "Autofill:requestAutocomplete: Enable prompting fo..."
This change adds new static initializers in wallet_address.cc.
> Autofill:requestAutocomplete: Enable prompting for complete address when instrument being used doesn't have full address.
>
> BUG=173517
>
> Review URL: https://chromiumcodereview.appspot.com/15136002
TBR=ramankk@chromium.org
Review URL: https://codereview.chromium.org/15689005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@201460 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components')
7 files changed, 30 insertions, 83 deletions
diff --git a/components/autofill/browser/wallet/wallet_address.cc b/components/autofill/browser/wallet/wallet_address.cc index 041c3d7..d15c7ac 100644 --- a/components/autofill/browser/wallet/wallet_address.cc +++ b/components/autofill/browser/wallet/wallet_address.cc @@ -14,9 +14,6 @@ namespace autofill { namespace wallet { -const string16 kFullAddress = ASCIIToUTF16("FULL"); -const string16 kTrue = ASCIIToUTF16("true"); - namespace { Address* CreateAddressInternal(const base::DictionaryValue& dictionary, @@ -31,7 +28,7 @@ Address* CreateAddressInternal(const base::DictionaryValue& dictionary, string16 recipient_name; if (!dictionary.GetString("postal_address.recipient_name", &recipient_name)) { - DLOG(ERROR) << "Response from Google Wallet missing recipient name"; + DLOG(ERROR) << "Response from Google Wallet recipient name"; return NULL; } @@ -70,22 +67,15 @@ Address* CreateAddressInternal(const base::DictionaryValue& dictionary, DVLOG(1) << "Response from Google Wallet missing administrative area name"; } - string16 is_minimal_address; - if (!dictionary.GetString("is_minimal_address", &is_minimal_address)) - DVLOG(1) << "Response from Google Wallet missing is_minimal_address bit"; - - Address* address = new Address(country_name_code, - recipient_name, - address_line_1, - address_line_2, - locality_name, - administrative_area_name, - postal_code_number, - phone_number, - object_id); - address->set_is_complete_address(is_minimal_address != kTrue); - - return address; + return new Address(country_name_code, + recipient_name , + address_line_1, + address_line_2, + locality_name, + administrative_area_name, + postal_code_number, + phone_number, + object_id); } } // namespace @@ -101,8 +91,7 @@ Address::Address(const AutofillProfile& profile) locality_name_(profile.GetRawInfo(ADDRESS_HOME_CITY)), administrative_area_name_(profile.GetRawInfo(ADDRESS_HOME_STATE)), postal_code_number_(profile.GetRawInfo(ADDRESS_HOME_ZIP)), - phone_number_(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)), - is_complete_address_(true) {} + phone_number_(profile.GetRawInfo(PHONE_HOME_WHOLE_NUMBER)) {} Address::Address(const std::string& country_name_code, const string16& recipient_name, @@ -121,8 +110,7 @@ Address::Address(const std::string& country_name_code, administrative_area_name_(administrative_area_name), postal_code_number_(postal_code_number), phone_number_(phone_number), - object_id_(object_id), - is_complete_address_(true) {} + object_id_(object_id) {} Address::~Address() {} @@ -186,23 +174,15 @@ scoped_ptr<Address> Address::CreateDisplayAddress( if (!dictionary.GetString("phone_number", &phone_number)) DVLOG(1) << "Reponse from Google Wallet missing phone number"; - string16 address_state; - if (!dictionary.GetString("type", &address_state)) - DVLOG(1) << "Response from Google Wallet missing type/state of address"; - - scoped_ptr<Address> address( - new Address(country_code, - name, - address1, - address2, - city, - state, - postal_code, - phone_number, - std::string())); - address->set_is_complete_address(address_state == kFullAddress); - - return address.Pass(); + return scoped_ptr<Address>(new Address(country_code, + name, + address1, + address2, + city, + state, + postal_code, + phone_number, + std::string())); } scoped_ptr<base::DictionaryValue> Address::ToDictionaryWithID() const { @@ -299,8 +279,7 @@ bool Address::operator==(const Address& other) const { administrative_area_name_ == other.administrative_area_name_ && postal_code_number_ == other.postal_code_number_ && phone_number_ == other.phone_number_ && - object_id_ == other.object_id_ && - is_complete_address_ == other.is_complete_address_; + object_id_ == other.object_id_; } bool Address::operator!=(const Address& other) const { diff --git a/components/autofill/browser/wallet/wallet_address.h b/components/autofill/browser/wallet/wallet_address.h index 953af5a..937553e 100644 --- a/components/autofill/browser/wallet/wallet_address.h +++ b/components/autofill/browser/wallet/wallet_address.h @@ -60,8 +60,6 @@ class Address { static scoped_ptr<Address> CreateAddress( const base::DictionaryValue& dictionary); - // TODO(ahutter): Make obvious in the function name that this public method - // only works for shipping address and assumes existance of "postal_address". // Builds an Address from |dictionary|, which must have an "id" field. This // function is designed for use with shipping addresses. The function may fail // and return an empty pointer if its input is invalid. @@ -107,9 +105,6 @@ class Address { } const base::string16& phone_number() const { return phone_number_; } const std::string& object_id() const { return object_id_; } - bool is_complete_address() const { - return is_complete_address_; - } void set_country_name_code(const std::string& country_name_code) { country_name_code_ = country_name_code; @@ -139,9 +134,6 @@ class Address { void set_object_id(const std::string& object_id) { object_id_ = object_id; } - void set_is_complete_address(bool is_complete_address) { - is_complete_address_ = is_complete_address; - } bool operator==(const Address& other) const; bool operator!=(const Address& other) const; @@ -183,9 +175,6 @@ class Address { // Externalized Online Wallet id for this address. std::string object_id_; - // Server's understanding of this address as complete address or not. - bool is_complete_address_; - // This class is intentionally copyable. DISALLOW_ASSIGN(Address); }; diff --git a/components/autofill/browser/wallet/wallet_address_unittest.cc b/components/autofill/browser/wallet/wallet_address_unittest.cc index 476d3ab..7ac92f7 100644 --- a/components/autofill/browser/wallet/wallet_address_unittest.cc +++ b/components/autofill/browser/wallet/wallet_address_unittest.cc @@ -88,7 +88,6 @@ const char kValidAddress[] = "{" " \"id\":\"id\"," " \"phone_number\":\"phone_number\"," - " \"is_minimal_address\":\"true\"," " \"postal_address\":" " {" " \"recipient_name\":\"recipient_name\"," @@ -146,8 +145,7 @@ const char kClientValidAddress[] = " \"state\":\"state\"," " \"postal_code\":\"postal_code\"," " \"phone_number\":\"phone_number\"," - " \"country_code\":\"country_code\"," - " \"type\":\"FULL\"" + " \"country_code\":\"country_code\"" "}"; } // anonymous namespace @@ -216,7 +214,6 @@ TEST_F(WalletAddressTest, CreateAddressWithID) { ASCIIToUTF16("postal_code_number"), ASCIIToUTF16("phone_number"), "id"); - address.set_is_complete_address(false); ASSERT_EQ(address, *Address::CreateAddress(*dict_)); ASSERT_EQ(address, *Address::CreateAddressWithID(*dict_)); } diff --git a/components/autofill/browser/wallet/wallet_items.h b/components/autofill/browser/wallet/wallet_items.h index 215c41d..14c4521 100644 --- a/components/autofill/browser/wallet/wallet_items.h +++ b/components/autofill/browser/wallet/wallet_items.h @@ -108,8 +108,8 @@ class WalletItems { private: friend class WalletItemsTest; - friend scoped_ptr<MaskedInstrument> GetTestMaskedInstrumentWithIdAndAddress( - const std::string&, scoped_ptr<Address> address); + friend scoped_ptr<MaskedInstrument> GetTestMaskedInstrumentWithId( + const std::string&); FRIEND_TEST_ALL_PREFIXES(::autofill::WalletInstrumentWrapperTest, GetInfoCreditCardExpMonth); FRIEND_TEST_ALL_PREFIXES(::autofill::WalletInstrumentWrapperTest, diff --git a/components/autofill/browser/wallet/wallet_items_unittest.cc b/components/autofill/browser/wallet/wallet_items_unittest.cc index e4b62ee..7d1a2e3 100644 --- a/components/autofill/browser/wallet/wallet_items_unittest.cc +++ b/components/autofill/browser/wallet/wallet_items_unittest.cc @@ -34,8 +34,7 @@ const char kMaskedInstrument[] = " \"state\":\"state\"," " \"postal_code\":\"postal_code\"," " \"phone_number\":\"phone_number\"," - " \"country_code\":\"country_code\"," - " \"type\":\"FULL\"" + " \"country_code\":\"country_code\"" " }," " \"status\":\"VALID\"," " \"object_id\":\"object_id\"" @@ -314,8 +313,7 @@ const char kWalletItems[] = " \"state\":\"state\"," " \"postal_code\":\"postal_code\"," " \"phone_number\":\"phone_number\"," - " \"country_code\":\"country_code\"," - " \"type\":\"FULL\"" + " \"country_code\":\"country_code\"" " }," " \"status\":\"VALID\"," " \"object_id\":\"object_id\"" diff --git a/components/autofill/browser/wallet/wallet_test_util.cc b/components/autofill/browser/wallet/wallet_test_util.cc index 896fa91..f34e82a 100644 --- a/components/autofill/browser/wallet/wallet_test_util.cc +++ b/components/autofill/browser/wallet/wallet_test_util.cc @@ -28,9 +28,8 @@ int FutureYear() { } // namespace -scoped_ptr<WalletItems::MaskedInstrument> -GetTestMaskedInstrumentWithIdAndAddress( - const std::string& id, scoped_ptr<Address> address) { +scoped_ptr<WalletItems::MaskedInstrument> GetTestMaskedInstrumentWithId( + const std::string& id) { return scoped_ptr<WalletItems::MaskedInstrument>( new WalletItems::MaskedInstrument(ASCIIToUTF16("descriptive_name"), WalletItems::MaskedInstrument::VISA, @@ -38,16 +37,11 @@ GetTestMaskedInstrumentWithIdAndAddress( ASCIIToUTF16("1111"), 12, FutureYear(), - address.Pass(), + GetTestAddress(), WalletItems::MaskedInstrument::VALID, id)); } -scoped_ptr<WalletItems::MaskedInstrument> GetTestMaskedInstrumentWithId( - const std::string& id) { - return GetTestMaskedInstrumentWithIdAndAddress(id, GetTestAddress()); -} - scoped_ptr<Address> GetTestAddress() { return scoped_ptr<Address>(new Address("US", ASCIIToUTF16("recipient_name"), @@ -60,12 +54,6 @@ scoped_ptr<Address> GetTestAddress() { std::string())); } -scoped_ptr<Address> GetTestMinimalAddress() { - scoped_ptr<Address> address = GetTestAddress(); - address->set_is_complete_address(false); - return address.Pass(); -} - scoped_ptr<FullWallet> GetTestFullWallet() { base::Time::Exploded exploded; base::Time::Now().LocalExplode(&exploded); diff --git a/components/autofill/browser/wallet/wallet_test_util.h b/components/autofill/browser/wallet/wallet_test_util.h index 8b1db45..316c5d7 100644 --- a/components/autofill/browser/wallet/wallet_test_util.h +++ b/components/autofill/browser/wallet/wallet_test_util.h @@ -16,15 +16,11 @@ class FullWallet; class Instrument; scoped_ptr<Address> GetTestAddress(); -scoped_ptr<Address> GetTestMinimalAddress(); scoped_ptr<FullWallet> GetTestFullWallet(); scoped_ptr<Instrument> GetTestInstrument(); scoped_ptr<WalletItems::LegalDocument> GetTestLegalDocument(); scoped_ptr<WalletItems::MaskedInstrument> GetTestMaskedInstrument(); scoped_ptr<WalletItems::MaskedInstrument> GetTestNonDefaultMaskedInstrument(); -scoped_ptr<WalletItems::MaskedInstrument> - GetTestMaskedInstrumentWithIdAndAddress( - const std::string& id, scoped_ptr<Address> address); scoped_ptr<Address> GetTestSaveableAddress(); scoped_ptr<Address> GetTestShippingAddress(); scoped_ptr<Address> GetTestNonDefaultShippingAddress(); |