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

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

Issue 377423002: Make ChromeAutofillClient a ZoomObserver. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo in comment. Created 6 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
« no previous file with comments | « chrome/browser/ui/autofill/chrome_autofill_client.h ('k') | chrome/browser/ui/tab_helpers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/autofill/chrome_autofill_client.cc
diff --git a/chrome/browser/ui/autofill/chrome_autofill_client.cc b/chrome/browser/ui/autofill/chrome_autofill_client.cc
index d848917132c9be6350cbc02e862f67818941a729..628e2e86c9be4e62bbc50beac1a7a6aba41db7f1 100644
--- a/chrome/browser/ui/autofill/chrome_autofill_client.cc
+++ b/chrome/browser/ui/autofill/chrome_autofill_client.cc
@@ -18,6 +18,7 @@
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/chrome_pages.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
+#include "chrome/browser/ui/zoom/zoom_controller.h"
#include "chrome/browser/webdata/web_data_service_factory.h"
#include "chrome/common/url_constants.h"
#include "components/autofill/content/browser/content_autofill_driver.h"
@@ -37,6 +38,16 @@ namespace autofill {
ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents)
: content::WebContentsObserver(web_contents), web_contents_(web_contents) {
DCHECK(web_contents);
+ // Since ZoomController is also a WebContentsObserver, we need to be careful
+ // about disconnecting from it since the relative order of destruction of
+ // WebContentsObservers is not guaranteed. ZoomController silently clears
+ // its ZoomObserver list during WebContentsDestroyed() so there's no need
+ // to explicitly remove ourselves on destruction.
+ ZoomController* zoom_controller =
+ ZoomController::FromWebContents(web_contents);
+ // There may not always be a ZoomController, e.g. on Android.
+ if (zoom_controller)
+ zoom_controller->AddObserver(this);
#if defined(OS_MACOSX) && !defined(OS_IOS)
RegisterForKeystoneNotifications();
#endif // defined(OS_MACOSX) && !defined(OS_IOS)
@@ -172,6 +183,11 @@ void ChromeAutofillClient::WebContentsDestroyed() {
HideAutofillPopup();
}
+void ChromeAutofillClient::OnZoomChanged(
+ const ZoomController::ZoomChangedEventData& data) {
+ HideAutofillPopup();
+}
+
void ChromeAutofillClient::DetectAccountCreationForms(
const std::vector<autofill::FormStructure*>& forms) {
password_manager::PasswordGenerationManager* manager =
« no previous file with comments | « chrome/browser/ui/autofill/chrome_autofill_client.h ('k') | chrome/browser/ui/tab_helpers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698