diff options
author | Ben Murdoch <benm@google.com> | 2013-08-12 14:20:17 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2013-08-12 14:20:17 +0100 |
commit | ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16 (patch) | |
tree | aa3b1013e823cb7bdee9ece936928292f57b31f4 /components | |
parent | f7fa989080f1e63c6a8aa24d5434922d52d9f51e (diff) | |
download | chromium_org-ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16.tar.gz |
Merge from Chromium at DEPS revision r216972
This commit was generated by merge_to_master.py.
Change-Id: I01cb28d94e3fcf99e3624d75cafa50d929787ddd
Diffstat (limited to 'components')
57 files changed, 573 insertions, 167 deletions
diff --git a/components/autofill/content/browser/DEPS b/components/autofill/content/browser/DEPS index 0b9fb92371..fb768b60c2 100644 --- a/components/autofill/content/browser/DEPS +++ b/components/autofill/content/browser/DEPS @@ -9,7 +9,6 @@ include_rules = [ "+sql", "+third_party/libjingle", "+third_party/libphonenumber", # For phone number i18n. - "+webkit/plugins/webplugininfo.h", ] specific_include_rules = { diff --git a/components/autofill/content/browser/wallet/full_wallet.cc b/components/autofill/content/browser/wallet/full_wallet.cc index 28c47b31cc..f66b28a985 100644 --- a/components/autofill/content/browser/wallet/full_wallet.cc +++ b/components/autofill/content/browser/wallet/full_wallet.cc @@ -42,6 +42,7 @@ FullWallet::FullWallet(int expiration_month, FullWallet::~FullWallet() {} +// static scoped_ptr<FullWallet> FullWallet::CreateFullWallet(const DictionaryValue& dictionary) { const ListValue* required_actions_list; @@ -127,6 +128,32 @@ scoped_ptr<FullWallet> required_actions)); } +// static +scoped_ptr<FullWallet> + FullWallet::CreateFullWalletFromClearText( + int expiration_month, + int expiration_year, + const std::string& pan, + const std::string& cvn, + scoped_ptr<Address> billing_address, + scoped_ptr<Address> shipping_address) { + DCHECK(billing_address); + DCHECK(!pan.empty()); + DCHECK(!cvn.empty()); + + scoped_ptr<FullWallet> wallet(new FullWallet( + expiration_month, + expiration_year, + std::string(), // no iin -- clear text pan/cvn are set below. + std::string(), // no encrypted_rest -- clear text pan/cvn are set below. + billing_address.Pass(), + shipping_address.Pass(), + std::vector<RequiredAction>())); // no required actions in clear text. + wallet->pan_ = pan; + wallet->cvn_ = cvn; + return wallet.Pass(); +} + base::string16 FullWallet::GetInfo(const AutofillType& type) { switch (type.GetStorableType()) { case CREDIT_CARD_NUMBER: diff --git a/components/autofill/content/browser/wallet/full_wallet.h b/components/autofill/content/browser/wallet/full_wallet.h index 61e846a2c0..84cc82e383 100644 --- a/components/autofill/content/browser/wallet/full_wallet.h +++ b/components/autofill/content/browser/wallet/full_wallet.h @@ -41,6 +41,16 @@ class FullWallet { static scoped_ptr<FullWallet> CreateFullWallet(const base::DictionaryValue& dictionary); + // Returns a wallet built from the provided clear-text data. + // Data is not validated; |pan|, |cvn| and |billing_address| must be set. + static scoped_ptr<FullWallet> + CreateFullWalletFromClearText(int expiration_month, + int expiration_year, + const std::string& pan, + const std::string& cvn, + scoped_ptr<Address> billing_address, + scoped_ptr<Address> shipping_address); + // Returns corresponding data for |type|. base::string16 GetInfo(const AutofillType& type); @@ -80,6 +90,7 @@ class FullWallet { FRIEND_TEST_ALL_PREFIXES(FullWalletTest, RestLengthCorrectDecryptionTest); FRIEND_TEST_ALL_PREFIXES(FullWalletTest, RestLengthUnderDecryptionTest); FRIEND_TEST_ALL_PREFIXES(FullWalletTest, GetCreditCardInfo); + FullWallet(int expiration_month, int expiration_year, const std::string& iin, diff --git a/components/autofill/content/browser/wallet/full_wallet_unittest.cc b/components/autofill/content/browser/wallet/full_wallet_unittest.cc index 5225bc4795..6f662131ff 100644 --- a/components/autofill/content/browser/wallet/full_wallet_unittest.cc +++ b/components/autofill/content/browser/wallet/full_wallet_unittest.cc @@ -505,5 +505,26 @@ TEST_F(FullWalletTest, GetCreditCardInfo) { full_wallet.GetInfo(AutofillType(CREDIT_CARD_TYPE))); } +TEST_F(FullWalletTest, CreateFullWalletFromClearTextData) { + scoped_ptr<FullWallet> full_wallet = + FullWallet::CreateFullWalletFromClearText( + 11, 2012, + "5555555555554444", "123", + GetTestAddress(), GetTestShippingAddress()); + EXPECT_EQ(ASCIIToUTF16("5555555555554444"), + full_wallet->GetInfo(AutofillType(CREDIT_CARD_NUMBER))); + EXPECT_EQ(ASCIIToUTF16("MasterCard"), + full_wallet->GetInfo(AutofillType(CREDIT_CARD_TYPE))); + EXPECT_EQ(ASCIIToUTF16("123"), + full_wallet->GetInfo(AutofillType(CREDIT_CARD_VERIFICATION_CODE))); + EXPECT_EQ(ASCIIToUTF16("11/12"), + full_wallet->GetInfo( + AutofillType(CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR))); + EXPECT_TRUE(GetTestAddress()->EqualsIgnoreID( + *full_wallet->billing_address())); + EXPECT_TRUE(GetTestShippingAddress()->EqualsIgnoreID( + *full_wallet->shipping_address())); +} + } // namespace wallet } // namespace autofill diff --git a/components/autofill/content/browser/wallet/wallet_address.cc b/components/autofill/content/browser/wallet/wallet_address.cc index 9595c3c5ea..8ab59982f2 100644 --- a/components/autofill/content/browser/wallet/wallet_address.cc +++ b/components/autofill/content/browser/wallet/wallet_address.cc @@ -264,6 +264,16 @@ string16 Address::DisplayNameDetail() const { string16 Address::GetInfo(const AutofillType& type, const std::string& app_locale) const { + if (type.html_type() == HTML_TYPE_COUNTRY_CODE) { + DCHECK(IsStringASCII(country_name_code())); + return ASCIIToUTF16(country_name_code()); + } else if (type.html_type() == HTML_TYPE_STREET_ADDRESS) { + base::string16 address = address_line_1(); + if (!address_line_2().empty()) + address += ASCIIToUTF16(", ") + address_line_2(); + return address; + } + switch (type.GetStorableType()) { case NAME_FULL: return recipient_name(); diff --git a/components/autofill/content/browser/wallet/wallet_address_unittest.cc b/components/autofill/content/browser/wallet/wallet_address_unittest.cc index 6a09fa9936..9135f54570 100644 --- a/components/autofill/content/browser/wallet/wallet_address_unittest.cc +++ b/components/autofill/content/browser/wallet/wallet_address_unittest.cc @@ -409,5 +409,70 @@ TEST_F(WalletAddressTest, FromAutofillProfile) { } } +// Verifies that WalletAddress::GetInfo() can correctly return both country +// codes and localized country names. +TEST_F(WalletAddressTest, GetCountryInfo) { + Address address("FR", + ASCIIToUTF16("recipient_name"), + ASCIIToUTF16("address_line_1"), + ASCIIToUTF16("address_line_2"), + ASCIIToUTF16("locality_name"), + ASCIIToUTF16("administrative_area_name"), + ASCIIToUTF16("postal_code_number"), + ASCIIToUTF16("phone_number"), + "id1"); + + AutofillType type = AutofillType(HTML_TYPE_COUNTRY_CODE, HTML_MODE_NONE); + EXPECT_EQ(ASCIIToUTF16("FR"), address.GetInfo(type, "en-US")); + + type = AutofillType(HTML_TYPE_COUNTRY_NAME, HTML_MODE_NONE); + EXPECT_EQ(ASCIIToUTF16("France"), address.GetInfo(type, "en-US")); + + type = AutofillType(ADDRESS_HOME_COUNTRY); + EXPECT_EQ(ASCIIToUTF16("France"), address.GetInfo(type, "en-US")); +} + +// Verifies that WalletAddress::GetInfo() can correctly return a concatenated +// full street address. +TEST_F(WalletAddressTest, GetStreetAddress) { + // Address has both lines 1 and 2. + Address address1("FR", + ASCIIToUTF16("recipient_name"), + ASCIIToUTF16("address_line_1"), + ASCIIToUTF16("address_line_2"), + ASCIIToUTF16("locality_name"), + ASCIIToUTF16("administrative_area_name"), + ASCIIToUTF16("postal_code_number"), + ASCIIToUTF16("phone_number"), + "id1"); + AutofillType type = AutofillType(HTML_TYPE_STREET_ADDRESS, HTML_MODE_NONE); + EXPECT_EQ(ASCIIToUTF16("address_line_1, address_line_2"), + address1.GetInfo(type, "en-US")); + + // Address has only line 1. + Address address2("FR", + ASCIIToUTF16("recipient_name"), + ASCIIToUTF16("address_line_1"), + base::string16(), + ASCIIToUTF16("locality_name"), + ASCIIToUTF16("administrative_area_name"), + ASCIIToUTF16("postal_code_number"), + ASCIIToUTF16("phone_number"), + "id1"); + EXPECT_EQ(ASCIIToUTF16("address_line_1"), address2.GetInfo(type, "en-US")); + + // Address has no address lines. + Address address3("FR", + ASCIIToUTF16("recipient_name"), + base::string16(), + base::string16(), + ASCIIToUTF16("locality_name"), + ASCIIToUTF16("administrative_area_name"), + ASCIIToUTF16("postal_code_number"), + ASCIIToUTF16("phone_number"), + "id1"); + EXPECT_EQ(base::string16(), address3.GetInfo(type, "en-US")); +} + } // namespace wallet } // namespace autofill diff --git a/components/autofill/content/browser/wallet/wallet_client.cc b/components/autofill/content/browser/wallet/wallet_client.cc index 09afa604fb..bb5c525273 100644 --- a/components/autofill/content/browser/wallet/wallet_client.cc +++ b/components/autofill/content/browser/wallet/wallet_client.cc @@ -105,6 +105,8 @@ WalletClient::ErrorType StringToErrorType(const std::string& error_type) { &trimmed); if (LowerCaseEqualsASCII(trimmed, "buyer_account_error")) return WalletClient::BUYER_ACCOUNT_ERROR; + if (LowerCaseEqualsASCII(trimmed, "unsupported_merchant")) + return WalletClient::UNSUPPORTED_MERCHANT; if (LowerCaseEqualsASCII(trimmed, "internal_error")) return WalletClient::INTERNAL_ERROR; if (LowerCaseEqualsASCII(trimmed, "invalid_params")) @@ -113,9 +115,26 @@ WalletClient::ErrorType StringToErrorType(const std::string& error_type) { return WalletClient::SERVICE_UNAVAILABLE; if (LowerCaseEqualsASCII(trimmed, "unsupported_api_version")) return WalletClient::UNSUPPORTED_API_VERSION; + return WalletClient::UNKNOWN_ERROR; } +// Get the more specific WalletClient::ErrorType when the error is +// |BUYER_ACCOUNT_ERROR|. +WalletClient::ErrorType BuyerErrorStringToErrorType( + const std::string& buyer_error_type) { + std::string trimmed; + TrimWhitespaceASCII(buyer_error_type, + TRIM_ALL, + &trimmed); + if (LowerCaseEqualsASCII(trimmed, "bla_country_not_supported")) + return WalletClient::BUYER_LEGAL_ADDRESS_NOT_SUPPORTED; + if (LowerCaseEqualsASCII(trimmed, "buyer_kyc_error")) + return WalletClient::UNVERIFIED_KNOW_YOUR_CUSTOMER_STATUS; + + return WalletClient::BUYER_ACCOUNT_ERROR; +} + // Gets and parses required actions from a SaveToWallet response. Returns // false if any unknown required actions are seen and true otherwise. void GetRequiredActionsForSaveToWallet( @@ -161,16 +180,22 @@ AutofillMetrics::WalletErrorMetric ErrorTypeToUmaMetric( switch (error_type) { case WalletClient::BAD_REQUEST: return AutofillMetrics::WALLET_BAD_REQUEST; + case WalletClient::BUYER_LEGAL_ADDRESS_NOT_SUPPORTED: + return AutofillMetrics::WALLET_BUYER_LEGAL_ADDRESS_NOT_SUPPORTED; case WalletClient::BUYER_ACCOUNT_ERROR: return AutofillMetrics::WALLET_BUYER_ACCOUNT_ERROR; case WalletClient::INTERNAL_ERROR: return AutofillMetrics::WALLET_INTERNAL_ERROR; case WalletClient::INVALID_PARAMS: return AutofillMetrics::WALLET_INVALID_PARAMS; + case WalletClient::UNVERIFIED_KNOW_YOUR_CUSTOMER_STATUS: + return AutofillMetrics::WALLET_UNVERIFIED_KNOW_YOUR_CUSTOMER_STATUS; case WalletClient::SERVICE_UNAVAILABLE: return AutofillMetrics::WALLET_SERVICE_UNAVAILABLE; case WalletClient::UNSUPPORTED_API_VERSION: return AutofillMetrics::WALLET_UNSUPPORTED_API_VERSION; + case WalletClient::UNSUPPORTED_MERCHANT: + return AutofillMetrics::WALLET_UNSUPPORTED_MERCHANT; case WalletClient::MALFORMED_RESPONSE: return AutofillMetrics::WALLET_MALFORMED_RESPONSE; case WalletClient::NETWORK_ERROR: @@ -220,6 +245,7 @@ AutofillMetrics::WalletRequiredActionMetric RequiredActionToUmaMetric( const char kAcceptedLegalDocumentKey[] = "accepted_legal_document"; const char kApiKeyKey[] = "api_key"; const char kAuthResultKey[] = "auth_result"; +const char kBuyerErrorTypeKey[] = "wallet_error.buyer_error_type"; const char kEncryptedOtpKey[] = "encrypted_otp"; const char kErrorTypeKey[] = "wallet_error.error_type"; const char kFeatureKey[] = "feature"; @@ -669,13 +695,24 @@ void WalletClient::OnURLFetchComplete( if (response_code == net::HTTP_INTERNAL_SERVER_ERROR) { request_type_ = NO_PENDING_REQUEST; - std::string error_type; - if (!response_dict->GetString(kErrorTypeKey, &error_type)) { + std::string error_type_string; + if (!response_dict->GetString(kErrorTypeKey, &error_type_string)) { HandleWalletError(UNKNOWN_ERROR); return; } + WalletClient::ErrorType error_type = + StringToErrorType(error_type_string); + if (error_type == BUYER_ACCOUNT_ERROR) { + // If the error_type is |BUYER_ACCOUNT_ERROR|, then buyer_error_type + // field contains more specific information about the error. + std::string buyer_error_type_string; + if (response_dict->GetString(kBuyerErrorTypeKey, + &buyer_error_type_string)) { + error_type = BuyerErrorStringToErrorType(buyer_error_type_string); + } + } - HandleWalletError(StringToErrorType(error_type)); + HandleWalletError(error_type); return; } break; @@ -794,6 +831,9 @@ void WalletClient::HandleWalletError(WalletClient::ErrorType error_type) { case WalletClient::BAD_REQUEST: error_message = "WALLET_BAD_REQUEST"; break; + case WalletClient::BUYER_LEGAL_ADDRESS_NOT_SUPPORTED: + error_message = "WALLET_BUYER_LEGAL_ADDRESS_NOT_SUPPORTED"; + break; case WalletClient::BUYER_ACCOUNT_ERROR: error_message = "WALLET_BUYER_ACCOUNT_ERROR"; break; @@ -803,12 +843,18 @@ void WalletClient::HandleWalletError(WalletClient::ErrorType error_type) { case WalletClient::INVALID_PARAMS: error_message = "WALLET_INVALID_PARAMS"; break; + case WalletClient::UNVERIFIED_KNOW_YOUR_CUSTOMER_STATUS: + error_message = "WALLET_UNVERIFIED_KNOW_YOUR_CUSTOMER_STATUS"; + break; case WalletClient::SERVICE_UNAVAILABLE: error_message = "WALLET_SERVICE_UNAVAILABLE"; break; case WalletClient::UNSUPPORTED_API_VERSION: error_message = "WALLET_UNSUPPORTED_API_VERSION"; break; + case WalletClient::UNSUPPORTED_MERCHANT: + error_message = "WALLET_UNSUPPORTED_MERCHANT"; + break; case WalletClient::MALFORMED_RESPONSE: error_message = "WALLET_MALFORMED_RESPONSE"; break; diff --git a/components/autofill/content/browser/wallet/wallet_client.h b/components/autofill/content/browser/wallet/wallet_client.h index ecaae3d9c7..d4f9607312 100644 --- a/components/autofill/content/browser/wallet/wallet_client.h +++ b/components/autofill/content/browser/wallet/wallet_client.h @@ -75,8 +75,15 @@ class WalletClient : public net::URLFetcherDelegate { // The type of error returned by Online Wallet. enum ErrorType { // Errors to display to users. - BUYER_ACCOUNT_ERROR, // Risk deny, unsupported country, or account - // closed. + BUYER_ACCOUNT_ERROR, // Risk deny, unsupported country, or + // account closed. + BUYER_LEGAL_ADDRESS_NOT_SUPPORTED, // User's Buyer Legal Address is + // unsupported by Online Wallet. + UNVERIFIED_KNOW_YOUR_CUSTOMER_STATUS, // User's "know your customer" KYC + // state is not verified (either + // KYC_REFER or KYC_FAIL). + UNSUPPORTED_MERCHANT, // Merchant is blacklisted due to + // compliance violation. // API errors. BAD_REQUEST, // Request was very malformed or sent to the diff --git a/components/autofill/content/browser/wallet/wallet_client_unittest.cc b/components/autofill/content/browser/wallet/wallet_client_unittest.cc index 3f20337f71..031e5cd958 100644 --- a/components/autofill/content/browser/wallet/wallet_client_unittest.cc +++ b/components/autofill/content/browser/wallet/wallet_client_unittest.cc @@ -10,6 +10,7 @@ #include "base/strings/string_number_conversions.h" #include "base/strings/string_split.h" #include "base/strings/string_util.h" +#include "base/strings/stringprintf.h" #include "base/values.h" #include "chrome/test/base/testing_profile.h" #include "components/autofill/content/browser/autocheckout_steps.h" @@ -794,6 +795,58 @@ class WalletClientTest : public testing::Test { fetcher->delegate()->OnURLFetchComplete(fetcher); } + void TestWalletErrorCode( + const std::string& error_type_string, + const std::string& buyer_error_type_string, + WalletClient::ErrorType expected_error_type, + AutofillMetrics::WalletErrorMetric expected_autofill_metric) { + static const char kResponseTemplate[] = + "{" + " \"error_type\":\"APPLICATION_ERROR\"," + " \"error_detail\":\"error_detail\"," + " \"application_error\":\"application_error\"," + " \"debug_data\":" + " {" + " \"debug_message\":\"debug_message\"," + " \"stack_trace\":\"stack_trace\"" + " }," + " \"application_error_data\":\"application_error_data\"," + " \"wallet_error\":" + " {" + " \"error_type\":\"%s\"," + " %s" // Placeholder for |user_error_type|. + " \"error_detail\":\"error_detail\"," + " \"message_for_user\":" + " {" + " \"text\":\"text\"," + " \"subtext\":\"subtext\"," + " \"details\":\"details\"" + " }" + " }" + "}"; + EXPECT_CALL(delegate_, OnWalletError(expected_error_type)).Times(1); + delegate_.ExpectLogWalletApiCallDuration(AutofillMetrics::SEND_STATUS, 1); + delegate_.ExpectBaselineMetrics(); + delegate_.ExpectWalletErrorMetric(expected_autofill_metric); + + std::vector<AutocheckoutStatistic> statistics; + wallet_client_->SendAutocheckoutStatus(autofill::SUCCESS, + GURL(kMerchantUrl), + statistics, + "google_transaction_id"); + std::string buyer_error; + if (!buyer_error_type_string.empty()) { + buyer_error = base::StringPrintf("\"buyer_error_type\":\"%s\",", + buyer_error_type_string.c_str()); + } + std::string response = base::StringPrintf(kResponseTemplate, + error_type_string.c_str(), + buyer_error.c_str()); + VerifyAndFinishRequest(net::HTTP_INTERNAL_SERVER_ERROR, + kSendAutocheckoutStatusOfSuccessValidRequest, + response); + } + protected: content::TestBrowserThreadBundle thread_bundle_; scoped_ptr<WalletClient> wallet_client_; @@ -819,22 +872,98 @@ class WalletClientTest : public testing::Test { net::TestURLFetcherFactory factory_; }; -TEST_F(WalletClientTest, WalletError) { - EXPECT_CALL(delegate_, OnWalletError( - WalletClient::SERVICE_UNAVAILABLE)).Times(1); - delegate_.ExpectLogWalletApiCallDuration(AutofillMetrics::SEND_STATUS, 1); - delegate_.ExpectBaselineMetrics(); - delegate_.ExpectWalletErrorMetric( - AutofillMetrics::WALLET_SERVICE_UNAVAILABLE); - - std::vector<AutocheckoutStatistic> statistics; - wallet_client_->SendAutocheckoutStatus(autofill::SUCCESS, - GURL(kMerchantUrl), - statistics, - "google_transaction_id"); - VerifyAndFinishRequest(net::HTTP_INTERNAL_SERVER_ERROR, - kSendAutocheckoutStatusOfSuccessValidRequest, - kErrorResponse); +TEST_F(WalletClientTest, WalletErrorCodes) { + struct { + std::string error_type_string; + std::string buyer_error_type_string; + WalletClient::ErrorType expected_error_type; + AutofillMetrics::WalletErrorMetric expected_autofill_metric; + } test_cases[] = { + // General |BUYER_ACCOUNT_ERROR| with no |buyer_error_type_string|. + { + "buyer_account_error", + "", + WalletClient::BUYER_ACCOUNT_ERROR, + AutofillMetrics::WALLET_BUYER_ACCOUNT_ERROR + }, + // |BUYER_ACCOUNT_ERROR| with "buyer_legal_address_not_supported" in + // buyer_error_type field. + { + "buyer_account_error", + "bla_country_not_supported", + WalletClient::BUYER_LEGAL_ADDRESS_NOT_SUPPORTED, + AutofillMetrics::WALLET_BUYER_LEGAL_ADDRESS_NOT_SUPPORTED + }, + // |BUYER_ACCOUNT_ERROR| with KYC error code in buyer_error_type field. + { + "buyer_account_error", + "buyer_kyc_error", + WalletClient::UNVERIFIED_KNOW_YOUR_CUSTOMER_STATUS, + AutofillMetrics::WALLET_UNVERIFIED_KNOW_YOUR_CUSTOMER_STATUS + }, + // |BUYER_ACCOUNT_ERROR| with un-recognizable |buyer_error_type|. + { + "buyer_account_error", + "random_string", + WalletClient::BUYER_ACCOUNT_ERROR, + AutofillMetrics::WALLET_BUYER_ACCOUNT_ERROR + }, + // The following are other error types we could get from Wallet. + { + "unsupported_merchant", + "", + WalletClient::UNSUPPORTED_MERCHANT, + AutofillMetrics::WALLET_UNSUPPORTED_MERCHANT + }, + { + "internal_error", + "", + WalletClient::INTERNAL_ERROR, + AutofillMetrics::WALLET_INTERNAL_ERROR + }, + { + "invalid_params", + "", + WalletClient::INVALID_PARAMS, + AutofillMetrics::WALLET_INVALID_PARAMS + }, + { + "service_unavailable", + "", + WalletClient::SERVICE_UNAVAILABLE, + AutofillMetrics::WALLET_SERVICE_UNAVAILABLE + }, + { + "unsupported_api_version", + "", + WalletClient::UNSUPPORTED_API_VERSION, + AutofillMetrics::WALLET_UNSUPPORTED_API_VERSION + }, + // Any un-recognizable |error_type| is a |UNKNOWN_ERROR|. + { + "random_string_1", + "", + WalletClient::UNKNOWN_ERROR, + AutofillMetrics::WALLET_UNKNOWN_ERROR + }, + { + "random_string_2", + "", + WalletClient::UNKNOWN_ERROR, + AutofillMetrics::WALLET_UNKNOWN_ERROR + }, + }; + + for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { + SCOPED_TRACE( + base::StringPrintf("%s - %s", + test_cases[i].error_type_string.c_str(), + test_cases[i].buyer_error_type_string.c_str())); + TestWalletErrorCode(test_cases[i].error_type_string, + test_cases[i].buyer_error_type_string, + test_cases[i].expected_error_type, + test_cases[i].expected_autofill_metric); + } } TEST_F(WalletClientTest, WalletErrorResponseMissing) { diff --git a/components/autofill/core/browser/address.cc b/components/autofill/core/browser/address.cc index ca522f6d35..6f7f2a93ac 100644 --- a/components/autofill/core/browser/address.cc +++ b/components/autofill/core/browser/address.cc @@ -62,7 +62,7 @@ base::string16 Address::GetRawInfo(ServerFieldType type) const { return zip_code_; case ADDRESS_HOME_COUNTRY: - return country_code_; + return ASCIIToUTF16(country_code_); default: return base::string16(); @@ -89,8 +89,9 @@ void Address::SetRawInfo(ServerFieldType type, const base::string16& value) { break; case ADDRESS_HOME_COUNTRY: - DCHECK(value.empty() || value.length() == 2u); - country_code_ = value; + DCHECK(value.empty() || + (value.length() == 2u && IsStringASCII(value))); + country_code_ = UTF16ToASCII(value); break; case ADDRESS_HOME_ZIP: @@ -104,9 +105,18 @@ void Address::SetRawInfo(ServerFieldType type, const base::string16& value) { base::string16 Address::GetInfo(const AutofillType& type, const std::string& app_locale) const { + if (type.html_type() == HTML_TYPE_COUNTRY_CODE) { + return ASCIIToUTF16(country_code_); + } else if (type.html_type() == HTML_TYPE_STREET_ADDRESS) { + base::string16 address = line1_; + if (!line2_.empty()) + address += ASCIIToUTF16(", ") + line2_; + return address; + } + ServerFieldType storable_type = type.GetStorableType(); if (storable_type == ADDRESS_HOME_COUNTRY && !country_code_.empty()) - return AutofillCountry(UTF16ToASCII(country_code_), app_locale).name(); + return AutofillCountry(country_code_, app_locale).name(); return GetRawInfo(storable_type); } @@ -114,10 +124,26 @@ base::string16 Address::GetInfo(const AutofillType& type, bool Address::SetInfo(const AutofillType& type, const base::string16& value, const std::string& app_locale) { + if (type.html_type() == HTML_TYPE_COUNTRY_CODE) { + if (!value.empty() && (value.size() != 2u || !IsStringASCII(value))) { + country_code_ = std::string(); + return false; + } + + country_code_ = StringToUpperASCII(UTF16ToASCII(value)); + return true; + } else if (type.html_type() == HTML_TYPE_STREET_ADDRESS) { + // Don't attempt to parse the address into lines, since this is potentially + // a user-entered address in the user's own format, so the code would have + // to rely on iffy heuristics at best. Instead, just give up when importing + // addresses like this. + line1_ = line2_ = base::string16(); + return false; + } + ServerFieldType storable_type = type.GetStorableType(); if (storable_type == ADDRESS_HOME_COUNTRY && !value.empty()) { - country_code_ = - ASCIIToUTF16(AutofillCountry::GetCountryCode(value, app_locale)); + country_code_ = AutofillCountry::GetCountryCode(value, app_locale); return !country_code_.empty(); } @@ -132,7 +158,7 @@ void Address::GetMatchingTypes(const base::string16& text, // Check to see if the |text| canonicalized as a country name is a match. std::string country_code = AutofillCountry::GetCountryCode(text, app_locale); - if (!country_code.empty() && country_code_ == ASCIIToUTF16(country_code)) + if (!country_code.empty() && country_code_ == country_code) matching_types->insert(ADDRESS_HOME_COUNTRY); } diff --git a/components/autofill/core/browser/address.h b/components/autofill/core/browser/address.h index db1c731d14..f62c32ea09 100644 --- a/components/autofill/core/browser/address.h +++ b/components/autofill/core/browser/address.h @@ -42,13 +42,16 @@ class Address : public FormGroup { virtual void GetSupportedTypes( ServerFieldTypeSet* supported_types) const OVERRIDE; - // The address. + // The address, sans country info. base::string16 line1_; base::string16 line2_; base::string16 city_; base::string16 state_; - base::string16 country_code_; base::string16 zip_code_; + + // The ISO 3166 2-letter country code, or an empty string if there is no + // country data specified for this address. + std::string country_code_; }; } // namespace autofill diff --git a/components/autofill/core/browser/address_unittest.cc b/components/autofill/core/browser/address_unittest.cc index 8d2e920f99..b5bcfafaf5 100644 --- a/components/autofill/core/browser/address_unittest.cc +++ b/components/autofill/core/browser/address_unittest.cc @@ -4,33 +4,17 @@ #include <string> -#include "base/message_loop/message_loop.h" #include "base/strings/string16.h" #include "base/strings/utf_string_conversions.h" #include "components/autofill/core/browser/address.h" #include "components/autofill/core/browser/autofill_type.h" -#include "content/public/test/test_browser_thread.h" #include "testing/gtest/include/gtest/gtest.h" -using content::BrowserThread; - namespace autofill { -class AddressTest : public testing::Test { - public: - // In order to access the application locale -- which the tested functions do - // internally -- this test must run on the UI thread. - AddressTest() : ui_thread_(BrowserThread::UI, &message_loop_) {} - - private: - base::MessageLoopForUI message_loop_; - content::TestBrowserThread ui_thread_; - - DISALLOW_COPY_AND_ASSIGN(AddressTest); -}; - -// Test that country codes are properly decoded as country names. -TEST_F(AddressTest, GetCountry) { +// Test that country data can be properly returned as either a country code or a +// localized country name. +TEST(AddressTest, GetCountry) { Address address; EXPECT_EQ(base::string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); @@ -43,14 +27,26 @@ TEST_F(AddressTest, GetCountry) { AutofillType(ADDRESS_HOME_COUNTRY), ASCIIToUTF16("US"), "en-US"); country = address.GetInfo(AutofillType(ADDRESS_HOME_COUNTRY), "en-US"); EXPECT_EQ(ASCIIToUTF16("United States"), country); + country = address.GetInfo( + AutofillType(HTML_TYPE_COUNTRY_NAME, HTML_MODE_NONE), "en-US"); + EXPECT_EQ(ASCIIToUTF16("United States"), country); + country = address.GetInfo( + AutofillType(HTML_TYPE_COUNTRY_CODE, HTML_MODE_NONE), "en-US"); + EXPECT_EQ(ASCIIToUTF16("US"), country); address.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("CA")); country = address.GetInfo(AutofillType(ADDRESS_HOME_COUNTRY), "en-US"); EXPECT_EQ(ASCIIToUTF16("Canada"), country); + country = address.GetInfo( + AutofillType(HTML_TYPE_COUNTRY_NAME, HTML_MODE_NONE), "en-US"); + EXPECT_EQ(ASCIIToUTF16("Canada"), country); + country = address.GetInfo( + AutofillType(HTML_TYPE_COUNTRY_CODE, HTML_MODE_NONE), "en-US"); + EXPECT_EQ(ASCIIToUTF16("CA"), country); } // Test that we properly detect country codes appropriate for each country. -TEST_F(AddressTest, SetCountry) { +TEST(AddressTest, SetCountry) { Address address; EXPECT_EQ(base::string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); @@ -90,10 +86,31 @@ TEST_F(AddressTest, SetCountry) { country = address.GetInfo(AutofillType(ADDRESS_HOME_COUNTRY), "en-US"); EXPECT_EQ(base::string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); EXPECT_EQ(base::string16(), country); + + // Test setting the country based on an HTML field type. + AutofillType html_type_country_code = + AutofillType(HTML_TYPE_COUNTRY_CODE, HTML_MODE_NONE); + address.SetInfo(html_type_country_code, ASCIIToUTF16("US"), "en-US"); + country = address.GetInfo(AutofillType(ADDRESS_HOME_COUNTRY), "en-US"); + EXPECT_EQ(ASCIIToUTF16("US"), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); + EXPECT_EQ(ASCIIToUTF16("United States"), country); + + // Test case-insensitivity when setting the country based on an HTML field + // type. + address.SetInfo(html_type_country_code, ASCIIToUTF16("cA"), "en-US"); + country = address.GetInfo(AutofillType(ADDRESS_HOME_COUNTRY), "en-US"); + EXPECT_EQ(ASCIIToUTF16("CA"), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); + EXPECT_EQ(ASCIIToUTF16("Canada"), country); + + // Test setting the country based on invalid data with an HTML field type. + address.SetInfo(html_type_country_code, ASCIIToUTF16("unknown"), "en-US"); + country = address.GetInfo(AutofillType(ADDRESS_HOME_COUNTRY), "en-US"); + EXPECT_EQ(base::string16(), address.GetRawInfo(ADDRESS_HOME_COUNTRY)); + EXPECT_EQ(base::string16(), country); } // Test that we properly match typed values to stored country data. -TEST_F(AddressTest, IsCountry) { +TEST(AddressTest, IsCountry) { Address address; address.SetRawInfo(ADDRESS_HOME_COUNTRY, ASCIIToUTF16("US")); @@ -132,4 +149,50 @@ TEST_F(AddressTest, IsCountry) { EXPECT_EQ(0U, matching_types.size()); } +// Verifies that Address::GetInfo() can correctly return a concatenated full +// street address. +TEST(AddressTest, GetStreetAddress) { + // Address has no address lines. + Address address; + EXPECT_TRUE(address.GetRawInfo(ADDRESS_HOME_LINE1).empty()); + EXPECT_TRUE(address.GetRawInfo(ADDRESS_HOME_LINE2).empty()); + + AutofillType type = AutofillType(HTML_TYPE_STREET_ADDRESS, HTML_MODE_NONE); + EXPECT_EQ(base::string16(), address.GetInfo(type, "en-US")); + + // Address has only line 1. + address.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("123 Example Ave.")); + EXPECT_FALSE(address.GetRawInfo(ADDRESS_HOME_LINE1).empty()); + EXPECT_TRUE(address.GetRawInfo(ADDRESS_HOME_LINE2).empty()); + + EXPECT_EQ(ASCIIToUTF16("123 Example Ave."), + address.GetInfo(type, "en-US")); + + // Address has lines 1 and 2. + address.SetRawInfo(ADDRESS_HOME_LINE2, ASCIIToUTF16("Apt. 42")); + EXPECT_FALSE(address.GetRawInfo(ADDRESS_HOME_LINE1).empty()); + EXPECT_FALSE(address.GetRawInfo(ADDRESS_HOME_LINE2).empty()); + + EXPECT_EQ(ASCIIToUTF16("123 Example Ave., Apt. 42"), + address.GetInfo(type, "en-US")); +} + +// Verifies that Address::SetInfo() rejects setting data for +// HTML_TYPE_STREET_ADDRESS, as there is no good general way to parse that data +// into the consituent address lines. +TEST(AddressTest, SetStreetAddress) { + // Address has no address lines. + Address address; + address.SetRawInfo(ADDRESS_HOME_LINE1, ASCIIToUTF16("123 Example Ave.")); + address.SetRawInfo(ADDRESS_HOME_LINE2, ASCIIToUTF16("Apt. 42")); + EXPECT_FALSE(address.GetRawInfo(ADDRESS_HOME_LINE1).empty()); + EXPECT_FALSE(address.GetRawInfo(ADDRESS_HOME_LINE2).empty()); + + AutofillType type = AutofillType(HTML_TYPE_STREET_ADDRESS, HTML_MODE_NONE); + base::string16 street_address = ASCIIToUTF16("456 New St., Apt. 17"); + EXPECT_FALSE(address.SetInfo(type, street_address, "en-US")); + EXPECT_TRUE(address.GetRawInfo(ADDRESS_HOME_LINE1).empty()); + EXPECT_TRUE(address.GetRawInfo(ADDRESS_HOME_LINE2).empty()); +} + } // namespace autofill diff --git a/components/autofill/core/browser/autofill_manager_unittest.cc b/components/autofill/core/browser/autofill_manager_unittest.cc index e69ed0f23a..7aeb81ec6d 100644 --- a/components/autofill/core/browser/autofill_manager_unittest.cc +++ b/components/autofill/core/browser/autofill_manager_unittest.cc @@ -2159,7 +2159,7 @@ TEST_F(AutofillManagerTest, FillFormWithAuthorSpecifiedSections) { EXPECT_TRUE(response_data.user_submitted); ASSERT_EQ(11U, response_data.fields.size()); - ExpectFilledField("", "country", "United States", "text", + ExpectFilledField("", "country", "US", "text", response_data.fields[0]); ExpectFilledField("", "firstname", "", "text", response_data.fields[1]); ExpectFilledField("", "lastname", "", "text", response_data.fields[2]); diff --git a/components/autofill/core/browser/autofill_merge_unittest.cc b/components/autofill/core/browser/autofill_merge_unittest.cc index 21918d7c8b..e007a59d90 100644 --- a/components/autofill/core/browser/autofill_merge_unittest.cc +++ b/components/autofill/core/browser/autofill_merge_unittest.cc @@ -2,6 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <map> #include <vector> #include "base/basictypes.h" @@ -143,13 +144,22 @@ class AutofillMergeTest : public testing::Test, // sequentially, and fills |merged_profiles| with the serialized result. void MergeProfiles(const std::string& profiles, std::string* merged_profiles); + // Deserializes |str| into a field type. + ServerFieldType StringToFieldType(const std::string& str); + PersonalDataManagerMock personal_data_; private: + std::map<std::string, ServerFieldType> string_to_field_type_map_; + DISALLOW_COPY_AND_ASSIGN(AutofillMergeTest); }; AutofillMergeTest::AutofillMergeTest() : DataDrivenTest(GetTestDataDir()) { + for (size_t i = NO_SERVER_DATA; i < MAX_VALID_FIELD_TYPE; ++i) { + ServerFieldType field_type = static_cast<ServerFieldType>(i); + string_to_field_type_map_[AutofillType(field_type).ToString()] = field_type; + } } AutofillMergeTest::~AutofillMergeTest() { @@ -209,8 +219,7 @@ void AutofillMergeTest::MergeProfiles(const std::string& profiles, // into the field's name. AutofillField* field = const_cast<AutofillField*>(form_structure.field(i)); - ServerFieldType type = - AutofillType::StringToFieldType(UTF16ToUTF8(field->name)); + ServerFieldType type = StringToFieldType(UTF16ToUTF8(field->name)); field->set_heuristic_type(type); } @@ -227,6 +236,10 @@ void AutofillMergeTest::MergeProfiles(const std::string& profiles, *merged_profiles = SerializeProfiles(personal_data_.web_profiles()); } +ServerFieldType AutofillMergeTest::StringToFieldType(const std::string& str) { + return string_to_field_type_map_[str]; +} + TEST_F(AutofillMergeTest, DataDrivenMergeProfiles) { RunDataDrivenTest(GetInputDirectory(kTestName), GetOutputDirectory(kTestName), kFileNamePattern); diff --git a/components/autofill/core/browser/autofill_metrics.h b/components/autofill/core/browser/autofill_metrics.h index 05d3a8ddd5..d6ae790b39 100644 --- a/components/autofill/core/browser/autofill_metrics.h +++ b/components/autofill/core/browser/autofill_metrics.h @@ -329,6 +329,13 @@ class AutofillMetrics { WALLET_UNSUPPORTED_API_VERSION, // Catch all error type. WALLET_UNKNOWN_ERROR, + // The merchant has been blacklisted for Online Wallet due to some manner + // of compliance violation. + WALLET_UNSUPPORTED_MERCHANT, + // Buyer Legal Address has a country which is unsupported by Wallet. + WALLET_BUYER_LEGAL_ADDRESS_NOT_SUPPORTED, + // Wallet's Know Your Customer(KYC) action is pending/failed for this user. + WALLET_UNVERIFIED_KNOW_YOUR_CUSTOMER_STATUS, NUM_WALLET_ERROR_METRICS }; diff --git a/components/autofill/core/browser/autofill_type.cc b/components/autofill/core/browser/autofill_type.cc index c47a9dfb0c..f1e280ba9d 100644 --- a/components/autofill/core/browser/autofill_type.cc +++ b/components/autofill/core/browser/autofill_type.cc @@ -137,6 +137,7 @@ FieldTypeGroup AutofillType::group() const { case HTML_TYPE_ORGANIZATION: return COMPANY; + case HTML_TYPE_STREET_ADDRESS: case HTML_TYPE_ADDRESS_LINE1: case HTML_TYPE_ADDRESS_LINE2: case HTML_TYPE_LOCALITY: @@ -265,6 +266,9 @@ ServerFieldType AutofillType::GetStorableType() const { case HTML_TYPE_ORGANIZATION: return COMPANY_NAME; + case HTML_TYPE_STREET_ADDRESS: + return ADDRESS_HOME_LINE1; + case HTML_TYPE_ADDRESS_LINE1: return ADDRESS_HOME_LINE1; @@ -543,6 +547,8 @@ std::string AutofillType::ToString() const { return "HTML_TYPE_FAMILY_NAME"; case HTML_TYPE_ORGANIZATION: return "HTML_TYPE_ORGANIZATION"; + case HTML_TYPE_STREET_ADDRESS: + return "HTML_TYPE_STREET_ADDRESS"; case HTML_TYPE_ADDRESS_LINE1: return "HTML_TYPE_ADDRESS_LINE1"; case HTML_TYPE_ADDRESS_LINE2: @@ -603,101 +609,4 @@ std::string AutofillType::ToString() const { return std::string(); } -// static -ServerFieldType AutofillType::StringToFieldType(const std::string& str) { - if (str == "NO_SERVER_DATA") - return NO_SERVER_DATA; - if (str == "UNKNOWN_TYPE") - return UNKNOWN_TYPE; - if (str == "EMPTY_TYPE") - return EMPTY_TYPE; - if (str == "NAME_FIRST") - return NAME_FIRST; - if (str == "NAME_MIDDLE") - return NAME_MIDDLE; - if (str == "NAME_LAST") - return NAME_LAST; - if (str == "NAME_MIDDLE_INITIAL") - return NAME_MIDDLE_INITIAL; - if (str == "NAME_FULL") - return NAME_FULL; - if (str == "NAME_SUFFIX") - return NAME_SUFFIX; - if (str == "NAME_BILLING_FIRST") - return NAME_BILLING_FIRST; - if (str == "NAME_BILLING_MIDDLE") - return NAME_BILLING_MIDDLE; - if (str == "NAME_BILLING_LAST") - return NAME_BILLING_LAST; - if (str == "NAME_BILLING_MIDDLE_INITIAL") - return NAME_BILLING_MIDDLE_INITIAL; - if (str == "NAME_BILLING_FULL") - return NAME_BILLING_FULL; - if (str == "NAME_BILLING_SUFFIX") - return NAME_BILLING_SUFFIX; - if (str == "EMAIL_ADDRESS") - return EMAIL_ADDRESS; - if (str == "PHONE_HOME_NUMBER") - return PHONE_HOME_NUMBER; - if (str == "PHONE_HOME_CITY_CODE") - return PHONE_HOME_CITY_CODE; - if (str == "PHONE_HOME_COUNTRY_CODE") - return PHONE_HOME_COUNTRY_CODE; - if (str == "PHONE_HOME_CITY_AND_NUMBER") - return PHONE_HOME_CITY_AND_NUMBER; - if (str == "PHONE_HOME_WHOLE_NUMBER") - return PHONE_HOME_WHOLE_NUMBER; - if (str == "ADDRESS_HOME_LINE1") - return ADDRESS_HOME_LINE1; - if (str == "ADDRESS_HOME_LINE2") - return ADDRESS_HOME_LINE2; - if (str == "ADDRESS_HOME_APT_NUM") - return ADDRESS_HOME_APT_NUM; - if (str == "ADDRESS_HOME_CITY") - return ADDRESS_HOME_CITY; - if (str == "ADDRESS_HOME_STATE") - return ADDRESS_HOME_STATE; - if (str == "ADDRESS_HOME_ZIP") - return ADDRESS_HOME_ZIP; - if (str == "ADDRESS_HOME_COUNTRY") - return ADDRESS_HOME_COUNTRY; - if (str == "ADDRESS_BILLING_LINE1") - return ADDRESS_BILLING_LINE1; - if (str == "ADDRESS_BILLING_LINE2") - return ADDRESS_BILLING_LINE2; - if (str == "ADDRESS_BILLING_APT_NUM") - return ADDRESS_BILLING_APT_NUM; - if (str == "ADDRESS_BILLING_CITY") - return ADDRESS_BILLING_CITY; - if (str == "ADDRESS_BILLING_STATE") - return ADDRESS_BILLING_STATE; - if (str == "ADDRESS_BILLING_ZIP") - return ADDRESS_BILLING_ZIP; - if (str == "ADDRESS_BILLING_COUNTRY") - return ADDRESS_BILLING_COUNTRY; - if (str == "CREDIT_CARD_NAME") - return CREDIT_CARD_NAME; - if (str == "CREDIT_CARD_NUMBER") - return CREDIT_CARD_NUMBER; - if (str == "CREDIT_CARD_EXP_MONTH") - return CREDIT_CARD_EXP_MONTH; - if (str == "CREDIT_CARD_EXP_2_DIGIT_YEAR") - return CREDIT_CARD_EXP_2_DIGIT_YEAR; - if (str == "CREDIT_CARD_EXP_4_DIGIT_YEAR") - return CREDIT_CARD_EXP_4_DIGIT_YEAR; - if (str == "CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR") - return CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR; - if (str == "CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR") - return CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR; - if (str == "CREDIT_CARD_TYPE") - return CREDIT_CARD_TYPE; - if (str == "CREDIT_CARD_VERIFICATION_CODE") - return CREDIT_CARD_VERIFICATION_CODE; - if (str == "COMPANY_NAME") - return COMPANY_NAME; - - NOTREACHED() << "Unknown ServerFieldType " << str; - return UNKNOWN_TYPE; -} - } // namespace autofill diff --git a/components/autofill/core/browser/autofill_type.h b/components/autofill/core/browser/autofill_type.h index 653c02314f..41fa613b76 100644 --- a/components/autofill/core/browser/autofill_type.h +++ b/components/autofill/core/browser/autofill_type.h @@ -20,6 +20,8 @@ class AutofillType { AutofillType(const AutofillType& autofill_type); AutofillType& operator=(const AutofillType& autofill_type); + HtmlFieldType html_type() const { return html_type_; } + FieldTypeGroup group() const; // Returns true if both the |server_type_| and the |html_type_| are set to @@ -29,24 +31,19 @@ class AutofillType { // Maps |this| type to a field type that can be directly stored in an Autofill // data model (in the sense that it makes sense to call // |AutofillDataModel::SetRawInfo()| with the returned field type as the first - // parameter). + // parameter). Note that the returned type might not be exactly equivalent to + // |this| type. For example, there is no exact analogue to the + // 'street-address' HTML type hint among the storable field types. ServerFieldType GetStorableType() const; // Serializes |this| type to a string. std::string ToString() const; - // Maps |field_type| to a field type from ADDRESS_BILLING FieldTypeGroup if - // field type is an Address type. - // TODO(isherman): This method is only used by the - // AutofillDialogControllerImpl class. Consider moving it to a more focused - // location. + // Maps |field_type| to the corresponding billing field type if the field type + // is an address, name, or phone number type. static ServerFieldType GetEquivalentBillingFieldType( ServerFieldType field_type); - // TODO(isherman): This method is only used be a single test class. Move the - // logic into there or something, eh? - static ServerFieldType StringToFieldType(const std::string& str); - private: // The server-native field type, or UNKNOWN_TYPE if unset. ServerFieldType server_type_; diff --git a/components/autofill/core/browser/field_types.h b/components/autofill/core/browser/field_types.h index dc86ffd018..081a7a75c4 100644 --- a/components/autofill/core/browser/field_types.h +++ b/components/autofill/core/browser/field_types.h @@ -121,6 +121,7 @@ enum HtmlFieldType { HTML_TYPE_ORGANIZATION, // Address types. + HTML_TYPE_STREET_ADDRESS, HTML_TYPE_ADDRESS_LINE1, HTML_TYPE_ADDRESS_LINE2, HTML_TYPE_LOCALITY, // For U.S. addresses, corresponds to the city. diff --git a/components/autofill/core/browser/form_structure.cc b/components/autofill/core/browser/form_structure.cc index fd907dc009..0a534f8d84 100644 --- a/components/autofill/core/browser/form_structure.cc +++ b/components/autofill/core/browser/form_structure.cc @@ -212,6 +212,9 @@ HtmlFieldType FieldTypeFromAutocompleteAttributeValue( if (autocomplete_attribute_value == "organization") return HTML_TYPE_ORGANIZATION; + if (autocomplete_attribute_value == "street-address") + return HTML_TYPE_STREET_ADDRESS; + if (autocomplete_attribute_value == "address-line1") return HTML_TYPE_ADDRESS_LINE1; diff --git a/components/autofill/core/browser/personal_data_manager.h b/components/autofill/core/browser/personal_data_manager.h index b9ab979fdf..9b71aa55c5 100644 --- a/components/autofill/core/browser/personal_data_manager.h +++ b/components/autofill/core/browser/personal_data_manager.h @@ -26,6 +26,7 @@ class BrowserContext; } namespace autofill { +class AutofillInteractiveTest; class AutofillMetrics; class AutofillTest; class FormStructure; @@ -182,6 +183,7 @@ class PersonalDataManager : public WebDataServiceConsumer, FRIEND_TEST_ALL_PREFIXES(AutofillMetricsTest, AutofillIsEnabledAtStartup); FRIEND_TEST_ALL_PREFIXES(PersonalDataManagerTest, AggregateExistingAuxiliaryProfile); + friend class autofill::AutofillInteractiveTest; friend class autofill::AutofillTest; friend class autofill::PersonalDataManagerFactory; friend class PersonalDataManagerTest; diff --git a/components/autofill_content_browser.target.darwin-arm.mk b/components/autofill_content_browser.target.darwin-arm.mk index a29898a31d..7e8787a0fe 100644 --- a/components/autofill_content_browser.target.darwin-arm.mk +++ b/components/autofill_content_browser.target.darwin-arm.mk @@ -107,6 +107,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ @@ -242,6 +243,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ diff --git a/components/autofill_content_browser.target.darwin-mips.mk b/components/autofill_content_browser.target.darwin-mips.mk index 8e550a86ad..83d058b7fd 100644 --- a/components/autofill_content_browser.target.darwin-mips.mk +++ b/components/autofill_content_browser.target.darwin-mips.mk @@ -106,6 +106,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ @@ -240,6 +241,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ diff --git a/components/autofill_content_browser.target.darwin-x86.mk b/components/autofill_content_browser.target.darwin-x86.mk index a2c9ed209d..8760e97c96 100644 --- a/components/autofill_content_browser.target.darwin-x86.mk +++ b/components/autofill_content_browser.target.darwin-x86.mk @@ -109,6 +109,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ @@ -246,6 +247,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ diff --git a/components/autofill_content_browser.target.linux-arm.mk b/components/autofill_content_browser.target.linux-arm.mk index a29898a31d..7e8787a0fe 100644 --- a/components/autofill_content_browser.target.linux-arm.mk +++ b/components/autofill_content_browser.target.linux-arm.mk @@ -107,6 +107,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ @@ -242,6 +243,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ diff --git a/components/autofill_content_browser.target.linux-mips.mk b/components/autofill_content_browser.target.linux-mips.mk index 8e550a86ad..83d058b7fd 100644 --- a/components/autofill_content_browser.target.linux-mips.mk +++ b/components/autofill_content_browser.target.linux-mips.mk @@ -106,6 +106,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ @@ -240,6 +241,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ diff --git a/components/autofill_content_browser.target.linux-x86.mk b/components/autofill_content_browser.target.linux-x86.mk index a2c9ed209d..8760e97c96 100644 --- a/components/autofill_content_browser.target.linux-x86.mk +++ b/components/autofill_content_browser.target.linux-x86.mk @@ -109,6 +109,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ @@ -246,6 +247,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ diff --git a/components/autofill_content_renderer.target.darwin-arm.mk b/components/autofill_content_renderer.target.darwin-arm.mk index c3a932b5b5..607bd465d0 100644 --- a/components/autofill_content_renderer.target.darwin-arm.mk +++ b/components/autofill_content_renderer.target.darwin-arm.mk @@ -87,6 +87,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ '-DANDROID' \ @@ -192,6 +193,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ '-DANDROID' \ diff --git a/components/autofill_content_renderer.target.darwin-mips.mk b/components/autofill_content_renderer.target.darwin-mips.mk index e09cdbc54e..1bb72f6eee 100644 --- a/components/autofill_content_renderer.target.darwin-mips.mk +++ b/components/autofill_content_renderer.target.darwin-mips.mk @@ -86,6 +86,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ '-DANDROID' \ @@ -190,6 +191,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ '-DANDROID' \ diff --git a/components/autofill_content_renderer.target.darwin-x86.mk b/components/autofill_content_renderer.target.darwin-x86.mk index 5fef75e5cf..e9b88c57f8 100644 --- a/components/autofill_content_renderer.target.darwin-x86.mk +++ b/components/autofill_content_renderer.target.darwin-x86.mk @@ -89,6 +89,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ '-DANDROID' \ @@ -197,6 +198,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ '-DANDROID' \ diff --git a/components/autofill_content_renderer.target.linux-arm.mk b/components/autofill_content_renderer.target.linux-arm.mk index c3a932b5b5..607bd465d0 100644 --- a/components/autofill_content_renderer.target.linux-arm.mk +++ b/components/autofill_content_renderer.target.linux-arm.mk @@ -87,6 +87,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ '-DANDROID' \ @@ -192,6 +193,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ '-DANDROID' \ diff --git a/components/autofill_content_renderer.target.linux-mips.mk b/components/autofill_content_renderer.target.linux-mips.mk index e09cdbc54e..1bb72f6eee 100644 --- a/components/autofill_content_renderer.target.linux-mips.mk +++ b/components/autofill_content_renderer.target.linux-mips.mk @@ -86,6 +86,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ '-DANDROID' \ @@ -190,6 +191,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ '-DANDROID' \ diff --git a/components/autofill_content_renderer.target.linux-x86.mk b/components/autofill_content_renderer.target.linux-x86.mk index 5fef75e5cf..e9b88c57f8 100644 --- a/components/autofill_content_renderer.target.linux-x86.mk +++ b/components/autofill_content_renderer.target.linux-x86.mk @@ -89,6 +89,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ '-DANDROID' \ @@ -197,6 +198,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ '-DANDROID' \ diff --git a/components/autofill_core_browser.target.darwin-arm.mk b/components/autofill_core_browser.target.darwin-arm.mk index d69fa71b96..b7503b7067 100644 --- a/components/autofill_core_browser.target.darwin-arm.mk +++ b/components/autofill_core_browser.target.darwin-arm.mk @@ -128,6 +128,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ @@ -263,6 +264,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ diff --git a/components/autofill_core_browser.target.darwin-mips.mk b/components/autofill_core_browser.target.darwin-mips.mk index 643a01818f..e12ca1dec4 100644 --- a/components/autofill_core_browser.target.darwin-mips.mk +++ b/components/autofill_core_browser.target.darwin-mips.mk @@ -127,6 +127,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ @@ -261,6 +262,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ diff --git a/components/autofill_core_browser.target.darwin-x86.mk b/components/autofill_core_browser.target.darwin-x86.mk index 81fd1d1a92..826f78b29d 100644 --- a/components/autofill_core_browser.target.darwin-x86.mk +++ b/components/autofill_core_browser.target.darwin-x86.mk @@ -130,6 +130,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ @@ -267,6 +268,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ diff --git a/components/autofill_core_browser.target.linux-arm.mk b/components/autofill_core_browser.target.linux-arm.mk index d69fa71b96..b7503b7067 100644 --- a/components/autofill_core_browser.target.linux-arm.mk +++ b/components/autofill_core_browser.target.linux-arm.mk @@ -128,6 +128,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ @@ -263,6 +264,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ diff --git a/components/autofill_core_browser.target.linux-mips.mk b/components/autofill_core_browser.target.linux-mips.mk index 643a01818f..e12ca1dec4 100644 --- a/components/autofill_core_browser.target.linux-mips.mk +++ b/components/autofill_core_browser.target.linux-mips.mk @@ -127,6 +127,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ @@ -261,6 +262,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ diff --git a/components/autofill_core_browser.target.linux-x86.mk b/components/autofill_core_browser.target.linux-x86.mk index 81fd1d1a92..826f78b29d 100644 --- a/components/autofill_core_browser.target.linux-x86.mk +++ b/components/autofill_core_browser.target.linux-x86.mk @@ -130,6 +130,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ @@ -267,6 +268,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-DFEATURE_ENABLE_SSL' \ '-DFEATURE_ENABLE_VOICEMAIL' \ diff --git a/components/autofill_core_common.target.darwin-arm.mk b/components/autofill_core_common.target.darwin-arm.mk index e6d55055d3..49e5c78d1e 100644 --- a/components/autofill_core_common.target.darwin-arm.mk +++ b/components/autofill_core_common.target.darwin-arm.mk @@ -97,6 +97,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DPOSIX_AVOID_MMAP' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ @@ -207,6 +208,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DPOSIX_AVOID_MMAP' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ diff --git a/components/autofill_core_common.target.darwin-mips.mk b/components/autofill_core_common.target.darwin-mips.mk index 6ca808cbd3..3cab27f6f4 100644 --- a/components/autofill_core_common.target.darwin-mips.mk +++ b/components/autofill_core_common.target.darwin-mips.mk @@ -96,6 +96,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DPOSIX_AVOID_MMAP' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ @@ -205,6 +206,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DPOSIX_AVOID_MMAP' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ diff --git a/components/autofill_core_common.target.darwin-x86.mk b/components/autofill_core_common.target.darwin-x86.mk index 3de9cadf4b..5208989c54 100644 --- a/components/autofill_core_common.target.darwin-x86.mk +++ b/components/autofill_core_common.target.darwin-x86.mk @@ -99,6 +99,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -211,6 +212,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ diff --git a/components/autofill_core_common.target.linux-arm.mk b/components/autofill_core_common.target.linux-arm.mk index e6d55055d3..49e5c78d1e 100644 --- a/components/autofill_core_common.target.linux-arm.mk +++ b/components/autofill_core_common.target.linux-arm.mk @@ -97,6 +97,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DPOSIX_AVOID_MMAP' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ @@ -207,6 +208,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DPOSIX_AVOID_MMAP' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ diff --git a/components/autofill_core_common.target.linux-mips.mk b/components/autofill_core_common.target.linux-mips.mk index 6ca808cbd3..3cab27f6f4 100644 --- a/components/autofill_core_common.target.linux-mips.mk +++ b/components/autofill_core_common.target.linux-mips.mk @@ -96,6 +96,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DPOSIX_AVOID_MMAP' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ @@ -205,6 +206,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DPOSIX_AVOID_MMAP' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ diff --git a/components/autofill_core_common.target.linux-x86.mk b/components/autofill_core_common.target.linux-x86.mk index 3de9cadf4b..5208989c54 100644 --- a/components/autofill_core_common.target.linux-x86.mk +++ b/components/autofill_core_common.target.linux-x86.mk @@ -99,6 +99,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -211,6 +212,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ diff --git a/components/nacl/loader/nacl_sandbox_linux.cc b/components/nacl/loader/nacl_sandbox_linux.cc index 3041db67c7..c93aba7cd8 100644 --- a/components/nacl/loader/nacl_sandbox_linux.cc +++ b/components/nacl/loader/nacl_sandbox_linux.cc @@ -137,11 +137,6 @@ bool InitializeBpfSandbox() { content::InitializeSandbox(NaClBpfSandboxPolicy); if (sandbox_is_initialized) { RunSandboxSanityChecks(); - // TODO(jln): Find a way to fix this. - // The sandbox' SIGSYS handler trips NaCl, so we disable it. - // If SIGSYS is triggered it'll now execute the default action - // (CORE). This will make it hard to track down bugs and sandbox violations. - CHECK(signal(SIGSYS, SIG_DFL) != SIG_ERR); return true; } return false; diff --git a/components/visitedlink_renderer.target.darwin-arm.mk b/components/visitedlink_renderer.target.darwin-arm.mk index ebabeb0243..4930623000 100644 --- a/components/visitedlink_renderer.target.darwin-arm.mk +++ b/components/visitedlink_renderer.target.darwin-arm.mk @@ -81,6 +81,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -192,6 +193,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ diff --git a/components/visitedlink_renderer.target.darwin-mips.mk b/components/visitedlink_renderer.target.darwin-mips.mk index 7ce00dd8c2..00836e3201 100644 --- a/components/visitedlink_renderer.target.darwin-mips.mk +++ b/components/visitedlink_renderer.target.darwin-mips.mk @@ -80,6 +80,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -190,6 +191,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ diff --git a/components/visitedlink_renderer.target.darwin-x86.mk b/components/visitedlink_renderer.target.darwin-x86.mk index b734a558de..69f3038258 100644 --- a/components/visitedlink_renderer.target.darwin-x86.mk +++ b/components/visitedlink_renderer.target.darwin-x86.mk @@ -83,6 +83,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -197,6 +198,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ diff --git a/components/visitedlink_renderer.target.linux-arm.mk b/components/visitedlink_renderer.target.linux-arm.mk index ebabeb0243..4930623000 100644 --- a/components/visitedlink_renderer.target.linux-arm.mk +++ b/components/visitedlink_renderer.target.linux-arm.mk @@ -81,6 +81,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -192,6 +193,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ diff --git a/components/visitedlink_renderer.target.linux-mips.mk b/components/visitedlink_renderer.target.linux-mips.mk index 7ce00dd8c2..00836e3201 100644 --- a/components/visitedlink_renderer.target.linux-mips.mk +++ b/components/visitedlink_renderer.target.linux-mips.mk @@ -80,6 +80,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -190,6 +191,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ diff --git a/components/visitedlink_renderer.target.linux-x86.mk b/components/visitedlink_renderer.target.linux-x86.mk index b734a558de..69f3038258 100644 --- a/components/visitedlink_renderer.target.linux-x86.mk +++ b/components/visitedlink_renderer.target.linux-x86.mk @@ -83,6 +83,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -197,6 +198,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ diff --git a/components/web_contents_delegate_android.target.darwin-arm.mk b/components/web_contents_delegate_android.target.darwin-arm.mk index 1fca4535d9..8ff1cbd951 100644 --- a/components/web_contents_delegate_android.target.darwin-arm.mk +++ b/components/web_contents_delegate_android.target.darwin-arm.mk @@ -87,6 +87,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -196,6 +197,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ diff --git a/components/web_contents_delegate_android.target.darwin-mips.mk b/components/web_contents_delegate_android.target.darwin-mips.mk index 2966843578..953f1f2c62 100644 --- a/components/web_contents_delegate_android.target.darwin-mips.mk +++ b/components/web_contents_delegate_android.target.darwin-mips.mk @@ -86,6 +86,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -194,6 +195,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ diff --git a/components/web_contents_delegate_android.target.darwin-x86.mk b/components/web_contents_delegate_android.target.darwin-x86.mk index e15029a8de..0410db5c3e 100644 --- a/components/web_contents_delegate_android.target.darwin-x86.mk +++ b/components/web_contents_delegate_android.target.darwin-x86.mk @@ -88,6 +88,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -199,6 +200,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ diff --git a/components/web_contents_delegate_android.target.linux-arm.mk b/components/web_contents_delegate_android.target.linux-arm.mk index 1fca4535d9..8ff1cbd951 100644 --- a/components/web_contents_delegate_android.target.linux-arm.mk +++ b/components/web_contents_delegate_android.target.linux-arm.mk @@ -87,6 +87,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -196,6 +197,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ diff --git a/components/web_contents_delegate_android.target.linux-mips.mk b/components/web_contents_delegate_android.target.linux-mips.mk index 2966843578..953f1f2c62 100644 --- a/components/web_contents_delegate_android.target.linux-mips.mk +++ b/components/web_contents_delegate_android.target.linux-mips.mk @@ -86,6 +86,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -194,6 +195,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ diff --git a/components/web_contents_delegate_android.target.linux-x86.mk b/components/web_contents_delegate_android.target.linux-x86.mk index e15029a8de..0410db5c3e 100644 --- a/components/web_contents_delegate_android.target.linux-x86.mk +++ b/components/web_contents_delegate_android.target.linux-x86.mk @@ -88,6 +88,7 @@ MY_DEFS_Debug := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ @@ -199,6 +200,7 @@ MY_DEFS_Release := \ '-DSK_BUILD_FOR_ANDROID' \ '-DUSE_CHROMIUM_SKIA' \ '-DSK_USE_POSIX_THREADS' \ + '-DSK_DEFERRED_CANVAS_USES_FACTORIES=1' \ '-DU_USING_ICU_NAMESPACE=0' \ '-D__STDC_CONSTANT_MACROS' \ '-D__STDC_FORMAT_MACROS' \ |