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 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 const base::Callback<void(const FormStructure*)>& callback) { | 569 const base::Callback<void(const FormStructure*)>& callback) { |
570 return AutofillDialogControllerImpl::Create(contents, | 570 return AutofillDialogControllerImpl::Create(contents, |
571 form_structure, | 571 form_structure, |
572 source_url, | 572 source_url, |
573 callback); | 573 callback); |
574 } | 574 } |
575 | 575 |
576 void AutofillDialogControllerImpl::Show() { | 576 void AutofillDialogControllerImpl::Show() { |
577 dialog_shown_timestamp_ = base::Time::Now(); | 577 dialog_shown_timestamp_ = base::Time::Now(); |
578 | 578 |
579 content::NavigationEntry* entry = | 579 // The Autofill dialog is shown in response to a message from the renderer and |
580 web_contents()->GetController().GetActiveEntry(); | 580 // as such, it can only be made in the context of the current document. A call |
581 const GURL& active_url = entry ? entry->GetURL() : web_contents()->GetURL(); | 581 // to GetActiveEntry would return a pending entry, if there was one, which |
582 invoked_from_same_origin_ = active_url.GetOrigin() == source_url_.GetOrigin(); | 582 // would be a security bug. Therefore, we use the last committed URL for the |
| 583 // access checks. |
| 584 const GURL& current_url = web_contents()->GetLastCommittedURL(); |
| 585 invoked_from_same_origin_ = |
| 586 current_url.GetOrigin() == source_url_.GetOrigin(); |
583 | 587 |
584 // Log any relevant UI metrics and security exceptions. | 588 // Log any relevant UI metrics and security exceptions. |
585 GetMetricLogger().LogDialogUiEvent(AutofillMetrics::DIALOG_UI_SHOWN); | 589 GetMetricLogger().LogDialogUiEvent(AutofillMetrics::DIALOG_UI_SHOWN); |
586 | 590 |
587 GetMetricLogger().LogDialogSecurityMetric( | 591 GetMetricLogger().LogDialogSecurityMetric( |
588 AutofillMetrics::SECURITY_METRIC_DIALOG_SHOWN); | 592 AutofillMetrics::SECURITY_METRIC_DIALOG_SHOWN); |
589 | 593 |
590 // Determine what field types should be included in the dialog. | 594 // Determine what field types should be included in the dialog. |
591 // Note that RequestingCreditCardInfo() below relies on parsed field types. | 595 // Note that RequestingCreditCardInfo() below relies on parsed field types. |
592 bool has_types = false; | 596 bool has_types = false; |
(...skipping 2907 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3500 view_->UpdateButtonStrip(); | 3504 view_->UpdateButtonStrip(); |
3501 } | 3505 } |
3502 | 3506 |
3503 void AutofillDialogControllerImpl::FetchWalletCookie() { | 3507 void AutofillDialogControllerImpl::FetchWalletCookie() { |
3504 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); | 3508 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); |
3505 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); | 3509 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); |
3506 signin_helper_->StartWalletCookieValueFetch(); | 3510 signin_helper_->StartWalletCookieValueFetch(); |
3507 } | 3511 } |
3508 | 3512 |
3509 } // namespace autofill | 3513 } // namespace autofill |
OLD | NEW |