| 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 11 matching lines...) Expand all Loading... |
| 22 #include "base/rand_util.h" | 22 #include "base/rand_util.h" |
| 23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
| 24 #include "base/strings/string_split.h" | 24 #include "base/strings/string_split.h" |
| 25 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
| 26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
| 27 #include "base/time/time.h" | 27 #include "base/time/time.h" |
| 28 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 28 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
| 29 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| 31 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" | 31 #include "chrome/browser/ui/autofill/autofill_dialog_common.h" |
| 32 #include "chrome/browser/ui/autofill/autofill_dialog_i18n_input.h" |
| 32 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" | 33 #include "chrome/browser/ui/autofill/autofill_dialog_view.h" |
| 33 #include "chrome/browser/ui/autofill/data_model_wrapper.h" | 34 #include "chrome/browser/ui/autofill/data_model_wrapper.h" |
| 34 #if !defined(OS_ANDROID) | 35 #if !defined(OS_ANDROID) |
| 35 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" | 36 #include "chrome/browser/ui/autofill/generated_credit_card_bubble_controller.h" |
| 36 #include "chrome/browser/ui/autofill/new_credit_card_bubble_controller.h" | 37 #include "chrome/browser/ui/autofill/new_credit_card_bubble_controller.h" |
| 37 #endif | 38 #endif |
| 38 #include "chrome/browser/ui/browser.h" | 39 #include "chrome/browser/ui/browser.h" |
| 39 #include "chrome/browser/ui/browser_finder.h" | 40 #include "chrome/browser/ui/browser_finder.h" |
| 40 #include "chrome/browser/ui/browser_navigator.h" | 41 #include "chrome/browser/ui/browser_navigator.h" |
| 41 #include "chrome/browser/ui/browser_window.h" | 42 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 596 // access checks. | 597 // access checks. |
| 597 const GURL& current_url = web_contents()->GetLastCommittedURL(); | 598 const GURL& current_url = web_contents()->GetLastCommittedURL(); |
| 598 invoked_from_same_origin_ = | 599 invoked_from_same_origin_ = |
| 599 current_url.GetOrigin() == source_url_.GetOrigin(); | 600 current_url.GetOrigin() == source_url_.GetOrigin(); |
| 600 | 601 |
| 601 if (!invoked_from_same_origin_) { | 602 if (!invoked_from_same_origin_) { |
| 602 GetMetricLogger().LogDialogSecurityMetric( | 603 GetMetricLogger().LogDialogSecurityMetric( |
| 603 AutofillMetrics::SECURITY_METRIC_CROSS_ORIGIN_FRAME); | 604 AutofillMetrics::SECURITY_METRIC_CROSS_ORIGIN_FRAME); |
| 604 } | 605 } |
| 605 | 606 |
| 607 // TODO(dbeam): use GetManager()->GetDefaultCountryCodeForNewAddress() |
| 608 // instead when the country combobox is visible. http://crbug.com/331544 |
| 609 std::string country_code = "US"; |
| 606 common::BuildInputsForSection(SECTION_CC, | 610 common::BuildInputsForSection(SECTION_CC, |
| 611 country_code, |
| 607 &requested_cc_fields_); | 612 &requested_cc_fields_); |
| 608 common::BuildInputsForSection(SECTION_BILLING, | 613 common::BuildInputsForSection(SECTION_BILLING, |
| 614 country_code, |
| 609 &requested_billing_fields_); | 615 &requested_billing_fields_); |
| 610 common::BuildInputsForSection(SECTION_CC_BILLING, | 616 common::BuildInputsForSection(SECTION_CC_BILLING, |
| 617 country_code, |
| 611 &requested_cc_billing_fields_); | 618 &requested_cc_billing_fields_); |
| 612 common::BuildInputsForSection(SECTION_SHIPPING, | 619 common::BuildInputsForSection(SECTION_SHIPPING, |
| 620 country_code, |
| 613 &requested_shipping_fields_); | 621 &requested_shipping_fields_); |
| 614 | 622 |
| 615 // Test whether we need to show the shipping section. If filling that section | 623 // Test whether we need to show the shipping section. If filling that section |
| 616 // would be a no-op, don't show it. | 624 // would be a no-op, don't show it. |
| 617 const DetailInputs& inputs = RequestedFieldsForSection(SECTION_SHIPPING); | 625 const DetailInputs& inputs = RequestedFieldsForSection(SECTION_SHIPPING); |
| 618 cares_about_shipping_ = EmptyDataModelWrapper().FillFormStructure( | 626 cares_about_shipping_ = EmptyDataModelWrapper().FillFormStructure( |
| 619 inputs, | 627 inputs, |
| 620 base::Bind(common::DetailInputMatchesField, SECTION_SHIPPING), | 628 base::Bind(common::DetailInputMatchesField, SECTION_SHIPPING), |
| 621 &form_structure_); | 629 &form_structure_); |
| 622 | 630 |
| (...skipping 2912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3535 view_->UpdateButtonStrip(); | 3543 view_->UpdateButtonStrip(); |
| 3536 } | 3544 } |
| 3537 | 3545 |
| 3538 void AutofillDialogControllerImpl::FetchWalletCookie() { | 3546 void AutofillDialogControllerImpl::FetchWalletCookie() { |
| 3539 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 3547 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
| 3540 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 3548 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
| 3541 signin_helper_->StartWalletCookieValueFetch(); | 3549 signin_helper_->StartWalletCookieValueFetch(); |
| 3542 } | 3550 } |
| 3543 | 3551 |
| 3544 } // namespace autofill | 3552 } // namespace autofill |
| OLD | NEW |