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

Unified Diff: components/autofill/content/browser/autofill_driver_impl.cc

Issue 17893010: In components/autofill, move notification handling into content driver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to review Created 7 years, 6 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
« no previous file with comments | « components/autofill/content/browser/autofill_driver_impl.h ('k') | components/autofill/core/browser/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/autofill/content/browser/autofill_driver_impl.cc
diff --git a/components/autofill/content/browser/autofill_driver_impl.cc b/components/autofill/content/browser/autofill_driver_impl.cc
index 095822cb32c9a9e884a0f55bd845026818be2dfa..713bee7d4c7dfe7e3b245a98f077f50f89b644cd 100644
--- a/components/autofill/content/browser/autofill_driver_impl.cc
+++ b/components/autofill/content/browser/autofill_driver_impl.cc
@@ -8,7 +8,11 @@
#include "components/autofill/core/browser/autofill_manager.h"
#include "components/autofill/core/browser/autofill_manager_delegate.h"
#include "components/autofill/core/common/autofill_messages.h"
+#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/navigation_details.h"
+#include "content/public/browser/notification_service.h"
+#include "content/public/browser/notification_source.h"
+#include "content/public/browser/notification_types.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/frame_navigate_params.h"
#include "ipc/ipc_message_macros.h"
@@ -60,6 +64,15 @@ AutofillDriverImpl::AutofillDriverImpl(
this, delegate, app_locale, enable_download_manager)) {
SetAutofillExternalDelegate(scoped_ptr<AutofillExternalDelegate>(
new AutofillExternalDelegate(web_contents, autofill_manager_.get())));
+
+ registrar_.Add(this,
+ content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED,
+ content::Source<content::WebContents>(web_contents));
+ registrar_.Add(
+ this,
+ content::NOTIFICATION_NAV_ENTRY_COMMITTED,
+ content::Source<content::NavigationController>(
+ &(web_contents->GetController())));
}
AutofillDriverImpl::~AutofillDriverImpl() {}
@@ -144,4 +157,18 @@ void AutofillDriverImpl::SetAutofillManager(
autofill_manager_->SetExternalDelegate(autofill_external_delegate_.get());
}
+void AutofillDriverImpl::Observe(
+ int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) {
+ if (type == content::NOTIFICATION_WEB_CONTENTS_VISIBILITY_CHANGED) {
+ if (!*content::Details<bool>(details).ptr())
+ autofill_manager_->delegate()->HideAutofillPopup();
+ } else if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) {
+ autofill_manager_->delegate()->HideAutofillPopup();
+ } else {
+ NOTREACHED();
+ }
+}
+
} // namespace autofill
« no previous file with comments | « components/autofill/content/browser/autofill_driver_impl.h ('k') | components/autofill/core/browser/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698