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