| 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 const base::Callback<void(const FormStructure*)>& callback) { | 581 const base::Callback<void(const FormStructure*)>& callback) { |
| 582 return AutofillDialogControllerImpl::Create(contents, | 582 return AutofillDialogControllerImpl::Create(contents, |
| 583 form_structure, | 583 form_structure, |
| 584 source_url, | 584 source_url, |
| 585 callback); | 585 callback); |
| 586 } | 586 } |
| 587 | 587 |
| 588 void AutofillDialogControllerImpl::Show() { | 588 void AutofillDialogControllerImpl::Show() { |
| 589 dialog_shown_timestamp_ = base::Time::Now(); | 589 dialog_shown_timestamp_ = base::Time::Now(); |
| 590 | 590 |
| 591 content::NavigationEntry* entry = | 591 // Autocomplete is shown in response to a message from the renderer. As such, |
| 592 web_contents()->GetController().GetActiveEntry(); | 592 // it can only be made in the context of the current document and we must use |
| 593 const GURL& active_url = entry ? entry->GetURL() : web_contents()->GetURL(); | 593 // last committed URL for access checks. |
| 594 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin(); | 594 const GURL& current_url = web_contents()->GetLastCommittedURL(); |
| 595 invoked_from_same_origin_ = |
| 596 current_url.GetOrigin() == source_url_.GetOrigin(); |
| 595 | 597 |
| 596 // Log any relevant UI metrics and security exceptions. | 598 // Log any relevant UI metrics and security exceptions. |
| 597 GetMetricLogger().LogDialogUiEvent(AutofillMetrics::DIALOG_UI_SHOWN); | 599 GetMetricLogger().LogDialogUiEvent(AutofillMetrics::DIALOG_UI_SHOWN); |
| 598 | 600 |
| 599 GetMetricLogger().LogDialogSecurityMetric( | 601 GetMetricLogger().LogDialogSecurityMetric( |
| 600 AutofillMetrics::SECURITY_METRIC_DIALOG_SHOWN); | 602 AutofillMetrics::SECURITY_METRIC_DIALOG_SHOWN); |
| 601 | 603 |
| 602 // Determine what field types should be included in the dialog. | 604 // Determine what field types should be included in the dialog. |
| 603 // Note that RequestingCreditCardInfo() below relies on parsed field types. | 605 // Note that RequestingCreditCardInfo() below relies on parsed field types. |
| 604 bool has_types = false; | 606 bool has_types = false; |
| (...skipping 2918 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3523 view_->UpdateButtonStrip(); | 3525 view_->UpdateButtonStrip(); |
| 3524 } | 3526 } |
| 3525 | 3527 |
| 3526 void AutofillDialogControllerImpl::FetchWalletCookie() { | 3528 void AutofillDialogControllerImpl::FetchWalletCookie() { |
| 3527 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 3529 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
| 3528 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 3530 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
| 3529 signin_helper_->StartWalletCookieValueFetch(); | 3531 signin_helper_->StartWalletCookieValueFetch(); |
| 3530 } | 3532 } |
| 3531 | 3533 |
| 3532 } // namespace autofill | 3534 } // namespace autofill |
| OLD | NEW |