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

Unified Diff: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc

Issue 17500003: Close web contents modal dialogs on content load start (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Compilation fixes, change "inhibit" variable names Created 7 years, 5 months 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
index 673293edfc58ba5da177e248cbf9ba67fc05f787..291b163fa6ae51ae4fdcbd9bcc12f3e78be24101 100644
--- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
+++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc
@@ -67,6 +67,7 @@
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
#include "grit/webkit_resources.h"
+#include "net/base/registry_controlled_domains/registry_controlled_domain.h"
#include "net/cert/cert_status_flags.h"
#include "ui/base/base_window.h"
#include "ui/base/l10n/l10n_util.h"
@@ -2016,6 +2017,20 @@ void AutofillDialogControllerImpl::Observe(
}
////////////////////////////////////////////////////////////////////////////////
+// content::WebContentsObserver implementation.
+
+void AutofillDialogControllerImpl::DidNavigateMainFrame(
+ const content::LoadCommittedDetails& details,
+ const content::FrameNavigateParams& params) {
+ // Close view if necessary.
+ if (!net::registry_controlled_domains::SameDomainOrHost(
+ details.previous_url, details.entry->GetURL(),
+ net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES)) {
+ Hide();
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
// SuggestionsMenuModelDelegate implementation.
void AutofillDialogControllerImpl::SuggestionItemSelected(
@@ -2285,7 +2300,8 @@ AutofillDialogControllerImpl::AutofillDialogControllerImpl(
const DialogType dialog_type,
const base::Callback<void(const FormStructure*,
const std::string&)>& callback)
- : profile_(Profile::FromBrowserContext(contents->GetBrowserContext())),
+ : WebContentsObserver(contents),
+ profile_(Profile::FromBrowserContext(contents->GetBrowserContext())),
contents_(contents),
initial_user_state_(AutofillMetrics::DIALOG_USER_STATE_UNKNOWN),
dialog_type_(dialog_type),

Powered by Google App Engine
This is Rietveld 408576698