| 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 #include "chrome/browser/ui/webui/options/autofill_options_handler.h" | 5 #include "chrome/browser/ui/webui/options/autofill_options_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/bind_helpers.h" | 12 #include "base/bind_helpers.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/guid.h" | 14 #include "base/guid.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 #include "base/strings/string_number_conversions.h" | 18 #include "base/strings/string_number_conversions.h" |
| 19 #include "base/strings/string_split.h" | 19 #include "base/strings/string_split.h" |
| 20 #include "base/strings/utf_string_conversions.h" | 20 #include "base/strings/utf_string_conversions.h" |
| 21 #include "base/values.h" | 21 #include "base/values.h" |
| 22 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 22 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 23 #include "chrome/browser/browser_process.h" | 23 #include "chrome/browser/browser_process.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/ui/autofill/country_combobox_model.h" | 25 #include "chrome/browser/ui/autofill/country_combobox_model.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "chrome/grit/chromium_strings.h" | 27 #include "chrome/grit/chromium_strings.h" |
| 28 #include "chrome/grit/generated_resources.h" | 28 #include "chrome/grit/generated_resources.h" |
| 29 #include "components/autofill/content/browser/wallet/wallet_service_url.h" | |
| 30 #include "components/autofill/core/browser/autofill_country.h" | 29 #include "components/autofill/core/browser/autofill_country.h" |
| 31 #include "components/autofill/core/browser/autofill_data_util.h" | 30 #include "components/autofill/core/browser/autofill_data_util.h" |
| 32 #include "components/autofill/core/browser/autofill_profile.h" | 31 #include "components/autofill/core/browser/autofill_profile.h" |
| 33 #include "components/autofill/core/browser/credit_card.h" | 32 #include "components/autofill/core/browser/credit_card.h" |
| 33 #include "components/autofill/core/browser/payments/payments_service_url.h" |
| 34 #include "components/autofill/core/browser/personal_data_manager.h" | 34 #include "components/autofill/core/browser/personal_data_manager.h" |
| 35 #include "components/autofill/core/browser/phone_number_i18n.h" | 35 #include "components/autofill/core/browser/phone_number_i18n.h" |
| 36 #include "components/autofill/core/common/autofill_constants.h" | 36 #include "components/autofill/core/common/autofill_constants.h" |
| 37 #include "components/autofill/core/common/autofill_switches.h" | 37 #include "components/autofill/core/common/autofill_switches.h" |
| 38 #include "content/public/browser/web_ui.h" | 38 #include "content/public/browser/web_ui.h" |
| 39 #include "grit/components_strings.h" | 39 #include "grit/components_strings.h" |
| 40 #include "third_party/libaddressinput/messages.h" | 40 #include "third_party/libaddressinput/messages.h" |
| 41 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui
.h" | 41 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui
.h" |
| 42 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui
_component.h" | 42 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/address_ui
_component.h" |
| 43 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/localizati
on.h" | 43 #include "third_party/libaddressinput/src/cpp/include/libaddressinput/localizati
on.h" |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 | 237 |
| 238 localized_strings->SetString("helpUrl", autofill::kHelpURL); | 238 localized_strings->SetString("helpUrl", autofill::kHelpURL); |
| 239 | 239 |
| 240 personal_data_ = autofill::PersonalDataManagerFactory::GetForProfile( | 240 personal_data_ = autofill::PersonalDataManagerFactory::GetForProfile( |
| 241 Profile::FromWebUI(web_ui())); | 241 Profile::FromWebUI(web_ui())); |
| 242 | 242 |
| 243 SetAddressOverlayStrings(localized_strings); | 243 SetAddressOverlayStrings(localized_strings); |
| 244 SetCreditCardOverlayStrings(localized_strings); | 244 SetCreditCardOverlayStrings(localized_strings); |
| 245 | 245 |
| 246 localized_strings->SetString( | 246 localized_strings->SetString( |
| 247 "manageWalletAddressesUrl", | 247 "paymentsManageAddressesUrl", |
| 248 autofill::wallet::GetManageAddressesUrl(0).spec()); | 248 autofill::payments::GetManageAddressesUrl(0).spec()); |
| 249 localized_strings->SetString( | 249 localized_strings->SetString( |
| 250 "manageWalletPaymentMethodsUrl", | 250 "paymentsManageInstrumentsUrl", |
| 251 autofill::wallet::GetManageInstrumentsUrl(0).spec()); | 251 autofill::payments::GetManageInstrumentsUrl(0).spec()); |
| 252 } | 252 } |
| 253 | 253 |
| 254 void AutofillOptionsHandler::InitializeHandler() { | 254 void AutofillOptionsHandler::InitializeHandler() { |
| 255 // personal_data_ is NULL in guest mode on Chrome OS. | 255 // personal_data_ is NULL in guest mode on Chrome OS. |
| 256 if (personal_data_) | 256 if (personal_data_) |
| 257 personal_data_->AddObserver(this); | 257 personal_data_->AddObserver(this); |
| 258 } | 258 } |
| 259 | 259 |
| 260 void AutofillOptionsHandler::InitializePage() { | 260 void AutofillOptionsHandler::InitializePage() { |
| 261 if (personal_data_) | 261 if (personal_data_) |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 address->SetString(kLanguageCode, profile.language_code()); | 625 address->SetString(kLanguageCode, profile.language_code()); |
| 626 | 626 |
| 627 std::unique_ptr<base::ListValue> components(new base::ListValue); | 627 std::unique_ptr<base::ListValue> components(new base::ListValue); |
| 628 GetAddressComponents( | 628 GetAddressComponents( |
| 629 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)), | 629 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)), |
| 630 profile.language_code(), components.get(), nullptr); | 630 profile.language_code(), components.get(), nullptr); |
| 631 address->Set(kComponents, components.release()); | 631 address->Set(kComponents, components.release()); |
| 632 } | 632 } |
| 633 | 633 |
| 634 } // namespace options | 634 } // namespace options |
| OLD | NEW |