| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/autofill/autofill_dialog_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #include "base/strings/string_number_conversions.h" | 21 #include "base/strings/string_number_conversions.h" |
| 22 #include "base/strings/string_split.h" | 22 #include "base/strings/string_split.h" |
| 23 #include "base/strings/string_util.h" | 23 #include "base/strings/string_util.h" |
| 24 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
| 25 #include "base/time/time.h" | 25 #include "base/time/time.h" |
| 26 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 26 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 27 #include "chrome/browser/browser_process.h" | 27 #include "chrome/browser/browser_process.h" |
| 28 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 28 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 29 #include "chrome/browser/profiles/profile.h" | 29 #include "chrome/browser/profiles/profile.h" |
| 30 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" | 30 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" |
| 31 #include "chrome/browser/ui/autofill/autofill_dialog_input.h" |
| 31 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 32 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
| 32 #include "chrome/browser/ui/autofill/data_model_wrapper.h" | 33 #include "chrome/browser/ui/autofill/data_model_wrapper.h" |
| 33 #if !defined(OS_ANDROID) | 34 #if !defined(OS_ANDROID) |
| 34 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" | 35 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" |
| 35 #include "chrome/browser/ui/autofill/new_credit_card_bubble_controller.h" | 36 #include "chrome/browser/ui/autofill/new_credit_card_bubble_controller.h" |
| 36 #endif | 37 #endif |
| 37 #include "chrome/browser/ui/browser.h" | 38 #include "chrome/browser/ui/browser.h" |
| 38 #include "chrome/browser/ui/browser_finder.h" | 39 #include "chrome/browser/ui/browser_finder.h" |
| 39 #include "chrome/browser/ui/browser_navigator.h" | 40 #include "chrome/browser/ui/browser_navigator.h" |
| 40 #include "chrome/browser/ui/browser_window.h" | 41 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 AutofillMetrics::SECURITY_METRIC_CROSS_ORIGIN_FRAME); | 662 AutofillMetrics::SECURITY_METRIC_CROSS_ORIGIN_FRAME); |
| 662 } | 663 } |
| 663 | 664 |
| 664 // Fail if the author didn't specify autocomplete types. | 665 // Fail if the author didn't specify autocomplete types. |
| 665 if (!has_types) { | 666 if (!has_types) { |
| 666 callback_.Run(NULL); | 667 callback_.Run(NULL); |
| 667 delete this; | 668 delete this; |
| 668 return; | 669 return; |
| 669 } | 670 } |
| 670 | 671 |
| 671 common::BuildInputsForSection(SECTION_CC, | 672 inputs_builder_->BuildInputsForSection(SECTION_CC, &requested_cc_fields_); |
| 672 &requested_cc_fields_); | 673 inputs_builder_->BuildInputsForSection(SECTION_BILLING, |
| 673 common::BuildInputsForSection(SECTION_BILLING, | 674 &requested_billing_fields_); |
| 674 &requested_billing_fields_); | 675 inputs_builder_->BuildInputsForSection(SECTION_CC_BILLING, |
| 675 common::BuildInputsForSection(SECTION_CC_BILLING, | 676 &requested_cc_billing_fields_); |
| 676 &requested_cc_billing_fields_); | 677 inputs_builder_->BuildInputsForSection(SECTION_SHIPPING, |
| 677 common::BuildInputsForSection(SECTION_SHIPPING, | 678 &requested_shipping_fields_); |
| 678 &requested_shipping_fields_); | |
| 679 | 679 |
| 680 // Test whether we need to show the shipping section. If filling that section | 680 // Test whether we need to show the shipping section. If filling that section |
| 681 // would be a no-op, don't show it. | 681 // would be a no-op, don't show it. |
| 682 const DetailInputs& inputs = RequestedFieldsForSection(SECTION_SHIPPING); | 682 const DetailInputs& inputs = RequestedFieldsForSection(SECTION_SHIPPING); |
| 683 EmptyDataModelWrapper empty_wrapper; | 683 EmptyDataModelWrapper empty_wrapper; |
| 684 cares_about_shipping_ = empty_wrapper.FillFormStructure( | 684 cares_about_shipping_ = empty_wrapper.FillFormStructure( |
| 685 inputs, | 685 inputs, |
| 686 base::Bind(common::DetailInputMatchesField, SECTION_SHIPPING), | 686 base::Bind(common::DetailInputMatchesField, SECTION_SHIPPING), |
| 687 &form_structure_); | 687 &form_structure_); |
| 688 | 688 |
| (...skipping 1736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2425 suggested_shipping_(this), | 2425 suggested_shipping_(this), |
| 2426 cares_about_shipping_(true), | 2426 cares_about_shipping_(true), |
| 2427 input_showing_popup_(NULL), | 2427 input_showing_popup_(NULL), |
| 2428 weak_ptr_factory_(this), | 2428 weak_ptr_factory_(this), |
| 2429 has_accepted_legal_documents_(false), | 2429 has_accepted_legal_documents_(false), |
| 2430 is_submitting_(false), | 2430 is_submitting_(false), |
| 2431 choose_another_instrument_or_address_(false), | 2431 choose_another_instrument_or_address_(false), |
| 2432 wallet_server_validation_recoverable_(true), | 2432 wallet_server_validation_recoverable_(true), |
| 2433 data_was_passed_back_(false), | 2433 data_was_passed_back_(false), |
| 2434 was_ui_latency_logged_(false), | 2434 was_ui_latency_logged_(false), |
| 2435 card_generated_animation_(2000, 60, this) { | 2435 card_generated_animation_(2000, 60, this), |
| 2436 inputs_builder_(common::AutofillDialogInput::BuildInstance()) { |
| 2436 // TODO(estade): remove duplicates from |form_structure|? | 2437 // TODO(estade): remove duplicates from |form_structure|? |
| 2437 DCHECK(!callback_.is_null()); | 2438 DCHECK(!callback_.is_null()); |
| 2438 } | 2439 } |
| 2439 | 2440 |
| 2440 AutofillDialogView* AutofillDialogControllerImpl::CreateView() { | 2441 AutofillDialogView* AutofillDialogControllerImpl::CreateView() { |
| 2441 return AutofillDialogView::Create(this); | 2442 return AutofillDialogView::Create(this); |
| 2442 } | 2443 } |
| 2443 | 2444 |
| 2444 PersonalDataManager* AutofillDialogControllerImpl::GetManager() { | 2445 PersonalDataManager* AutofillDialogControllerImpl::GetManager() { |
| 2445 return PersonalDataManagerFactory::GetForProfile(profile_); | 2446 return PersonalDataManagerFactory::GetForProfile(profile_); |
| (...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3457 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 3458 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
| 3458 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 3459 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
| 3459 signin_helper_->StartWalletCookieValueFetch(); | 3460 signin_helper_->StartWalletCookieValueFetch(); |
| 3460 | 3461 |
| 3461 username_fetcher_.reset( | 3462 username_fetcher_.reset( |
| 3462 new wallet::WalletSigninHelper(this, request_context)); | 3463 new wallet::WalletSigninHelper(this, request_context)); |
| 3463 username_fetcher_->StartUserNameFetch(); | 3464 username_fetcher_->StartUserNameFetch(); |
| 3464 } | 3465 } |
| 3465 | 3466 |
| 3466 } // namespace autofill | 3467 } // namespace autofill |
| OLD | NEW |