Chromium Code Reviews| 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..c25337685029e76c061d9d560a1469fac5e9de7b 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 WebContentsObservers, we need to be careful |
|
Avi (use Gerrit)
2014/07/10 17:39:26
s/WebContentsObservers/WebContentsObserver/
|
| + // 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 = |