Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(661)

Side by Side Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 74563003: Removed some GetActiveEntry references in autofill (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/android/autofill/autofill_dialog_controller_android.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 645
644 SuggestionsUpdated(); 646 SuggestionsUpdated();
645 647
646 int show_count = 648 int show_count =
647 profile_->GetPrefs()->GetInteger(::prefs::kAutofillDialogShowCount); 649 profile_->GetPrefs()->GetInteger(::prefs::kAutofillDialogShowCount);
648 profile_->GetPrefs()->SetInteger(::prefs::kAutofillDialogShowCount, 650 profile_->GetPrefs()->SetInteger(::prefs::kAutofillDialogShowCount,
649 show_count + 1); 651 show_count + 1);
650 652
651 SubmitButtonDelayBegin(); 653 SubmitButtonDelayBegin();
652 654
653 if (account_chooser_model_.WalletIsSelected())
Charlie Reis 2013/11/16 19:13:16 Is this a merge conflict? I don't think you want
654 FetchWalletCookie();
655
656 // TODO(estade): don't show the dialog if the site didn't specify the right 655 // TODO(estade): don't show the dialog if the site didn't specify the right
657 // fields. First we must figure out what the "right" fields are. 656 // fields. First we must figure out what the "right" fields are.
658 view_.reset(CreateView()); 657 view_.reset(CreateView());
659 view_->Show(); 658 view_->Show();
660 GetManager()->AddObserver(this); 659 GetManager()->AddObserver(this);
661 660
662 if (!account_chooser_model_.WalletIsSelected()) 661 if (!account_chooser_model_.WalletIsSelected()) {
663 LogDialogLatencyToShow(); 662 LogDialogLatencyToShow();
663 } else {
Charlie Reis 2013/11/16 19:13:16 Another merge conflict?
664 // TODO(aruslan): UMA metrics for sign-in.
665 FetchWalletCookie();
666 }
664 } 667 }
665 668
666 void AutofillDialogControllerImpl::Hide() { 669 void AutofillDialogControllerImpl::Hide() {
667 if (view_) 670 if (view_)
668 view_->Hide(); 671 view_->Hide();
669 } 672 }
670 673
671 void AutofillDialogControllerImpl::TabActivated() { 674 void AutofillDialogControllerImpl::TabActivated() {
672 // If the user switched away from this tab and then switched back, reload the 675 // If the user switched away from this tab and then switched back, reload the
673 // Wallet items, in case they've changed. 676 // Wallet items, in case they've changed.
(...skipping 2848 matching lines...) Expand 10 before | Expand all | Expand 10 after
3522 view_->UpdateButtonStrip(); 3525 view_->UpdateButtonStrip();
3523 } 3526 }
3524 3527
3525 void AutofillDialogControllerImpl::FetchWalletCookie() { 3528 void AutofillDialogControllerImpl::FetchWalletCookie() {
3526 net::URLRequestContextGetter* request_context = profile_->GetRequestContext(); 3529 net::URLRequestContextGetter* request_context = profile_->GetRequestContext();
3527 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context)); 3530 signin_helper_.reset(new wallet::WalletSigninHelper(this, request_context));
3528 signin_helper_->StartWalletCookieValueFetch(); 3531 signin_helper_->StartWalletCookieValueFetch();
3529 } 3532 }
3530 3533
3531 } // namespace autofill 3534 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/browser/ui/android/autofill/autofill_dialog_controller_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698