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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/guid.h" | 12 #include "base/guid.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
15 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "base/values.h" | 17 #include "base/values.h" |
18 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 18 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
20 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/sync/profile_sync_service.h" | |
22 #include "chrome/browser/sync/profile_sync_service_factory.h" | |
21 #include "chrome/browser/ui/autofill/country_combobox_model.h" | 23 #include "chrome/browser/ui/autofill/country_combobox_model.h" |
22 #include "chrome/common/url_constants.h" | 24 #include "chrome/common/url_constants.h" |
23 #include "chrome/grit/generated_resources.h" | 25 #include "chrome/grit/generated_resources.h" |
24 #include "components/autofill/content/browser/wallet/wallet_service_url.h" | 26 #include "components/autofill/content/browser/wallet/wallet_service_url.h" |
25 #include "components/autofill/core/browser/autofill_country.h" | 27 #include "components/autofill/core/browser/autofill_country.h" |
26 #include "components/autofill/core/browser/autofill_profile.h" | 28 #include "components/autofill/core/browser/autofill_profile.h" |
27 #include "components/autofill/core/browser/credit_card.h" | 29 #include "components/autofill/core/browser/credit_card.h" |
28 #include "components/autofill/core/browser/personal_data_manager.h" | 30 #include "components/autofill/core/browser/personal_data_manager.h" |
29 #include "components/autofill/core/browser/phone_number_i18n.h" | 31 #include "components/autofill/core/browser/phone_number_i18n.h" |
30 #include "components/autofill/core/common/autofill_constants.h" | 32 #include "components/autofill/core/common/autofill_constants.h" |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 IDS_AUTOFILL_OPTIONS_TITLE); | 334 IDS_AUTOFILL_OPTIONS_TITLE); |
333 | 335 |
334 localized_strings->SetString("helpUrl", autofill::kHelpURL); | 336 localized_strings->SetString("helpUrl", autofill::kHelpURL); |
335 | 337 |
336 personal_data_ = autofill::PersonalDataManagerFactory::GetForProfile( | 338 personal_data_ = autofill::PersonalDataManagerFactory::GetForProfile( |
337 Profile::FromWebUI(web_ui())); | 339 Profile::FromWebUI(web_ui())); |
338 | 340 |
339 SetAddressOverlayStrings(localized_strings); | 341 SetAddressOverlayStrings(localized_strings); |
340 SetCreditCardOverlayStrings(localized_strings); | 342 SetCreditCardOverlayStrings(localized_strings); |
341 | 343 |
344 ProfileSyncService* service = | |
345 ProfileSyncServiceFactory::GetInstance()->GetForProfile( | |
346 Profile::FromWebUI(web_ui())); | |
342 localized_strings->SetBoolean( | 347 localized_strings->SetBoolean( |
343 "enableAutofillWalletIntegration", false); | 348 "enableAutofillWalletIntegration", |
349 service->IsSyncEnabledAndLoggedIn() && | |
350 personal_data_->IsExperimentalWalletIntegrationEnabled()); | |
stevenjb
2015/02/26 23:26:11
It looks like personal_data_ is tested elsewhere i
| |
344 localized_strings->SetString( | 351 localized_strings->SetString( |
345 "manageWalletAddressesUrl", | 352 "manageWalletAddressesUrl", |
346 autofill::wallet::GetManageAddressesUrl(0).spec()); | 353 autofill::wallet::GetManageAddressesUrl(0).spec()); |
347 localized_strings->SetString( | 354 localized_strings->SetString( |
348 "manageWalletPaymentMethodsUrl", | 355 "manageWalletPaymentMethodsUrl", |
349 autofill::wallet::GetManageInstrumentsUrl(0).spec()); | 356 autofill::wallet::GetManageInstrumentsUrl(0).spec()); |
350 } | 357 } |
351 | 358 |
352 void AutofillOptionsHandler::InitializeHandler() { | 359 void AutofillOptionsHandler::InitializeHandler() { |
353 // personal_data_ is NULL in guest mode on Chrome OS. | 360 // personal_data_ is NULL in guest mode on Chrome OS. |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
732 scoped_ptr<base::ListValue> components(new base::ListValue); | 739 scoped_ptr<base::ListValue> components(new base::ListValue); |
733 GetAddressComponents( | 740 GetAddressComponents( |
734 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)), | 741 base::UTF16ToUTF8(profile.GetRawInfo(autofill::ADDRESS_HOME_COUNTRY)), |
735 profile.language_code(), | 742 profile.language_code(), |
736 components.get(), | 743 components.get(), |
737 NULL); | 744 NULL); |
738 address->Set(kComponents, components.release()); | 745 address->Set(kComponents, components.release()); |
739 } | 746 } |
740 | 747 |
741 } // namespace options | 748 } // namespace options |
OLD | NEW |