OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_autofill_client.h" | 5 #include "chrome/browser/ui/autofill/chrome_autofill_client.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" | 9 #include "chrome/browser/autofill/autofill_cc_infobar_delegate.h" |
10 #include "chrome/browser/autofill/personal_data_manager_factory.h" | 10 #include "chrome/browser/autofill/personal_data_manager_factory.h" |
(...skipping 19 matching lines...) Expand all Loading... | |
30 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 30 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" |
31 #endif | 31 #endif |
32 | 32 |
33 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); | 33 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); |
34 | 34 |
35 namespace autofill { | 35 namespace autofill { |
36 | 36 |
37 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) | 37 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) |
38 : content::WebContentsObserver(web_contents), web_contents_(web_contents) { | 38 : content::WebContentsObserver(web_contents), web_contents_(web_contents) { |
39 DCHECK(web_contents); | 39 DCHECK(web_contents); |
40 ZoomController* zoom_controller = | |
41 ZoomController::FromWebContents(web_contents); | |
42 // No ZoomControllers on Android. | |
43 if (zoom_controller) | |
44 zoom_controller->AddObserver(this); | |
40 #if defined(OS_MACOSX) && !defined(OS_IOS) | 45 #if defined(OS_MACOSX) && !defined(OS_IOS) |
41 RegisterForKeystoneNotifications(); | 46 RegisterForKeystoneNotifications(); |
42 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 47 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
43 } | 48 } |
44 | 49 |
45 ChromeAutofillClient::~ChromeAutofillClient() { | 50 ChromeAutofillClient::~ChromeAutofillClient() { |
46 // NOTE: It is too late to clean up the autofill popup; that cleanup process | 51 // NOTE: It is too late to clean up the autofill popup; that cleanup process |
47 // requires that the WebContents instance still be valid and it is not at | 52 // requires that the WebContents instance still be valid and it is not at |
48 // this point (in particular, the WebContentsImpl destructor has already | 53 // this point (in particular, the WebContentsImpl destructor has already |
49 // finished running and we are now in the base class destructor). | 54 // finished running and we are now in the base class destructor). |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 | 170 |
166 void ChromeAutofillClient::HideRequestAutocompleteDialog() { | 171 void ChromeAutofillClient::HideRequestAutocompleteDialog() { |
167 if (dialog_controller_.get()) | 172 if (dialog_controller_.get()) |
168 dialog_controller_->Hide(); | 173 dialog_controller_->Hide(); |
169 } | 174 } |
170 | 175 |
171 void ChromeAutofillClient::WebContentsDestroyed() { | 176 void ChromeAutofillClient::WebContentsDestroyed() { |
172 HideAutofillPopup(); | 177 HideAutofillPopup(); |
173 } | 178 } |
174 | 179 |
180 void ChromeAutofillClient::OnZoomChanged( | |
181 const ZoomController::ZoomChangedEventData& data) { | |
182 // TODO(wjmaclean) Decide if we want to hide the popup for any zoom event, not | |
183 // just zoom events for web_contents_. | |
Ilya Sherman
2014/07/09 21:52:43
What other zoom events are possible?
wjmaclean
2014/07/10 14:47:35
ZoomObservers are notified of the following:
1) ch
| |
184 if (data.web_contents == web_contents_) | |
185 HideAutofillPopup(); | |
186 } | |
187 | |
175 void ChromeAutofillClient::DetectAccountCreationForms( | 188 void ChromeAutofillClient::DetectAccountCreationForms( |
176 const std::vector<autofill::FormStructure*>& forms) { | 189 const std::vector<autofill::FormStructure*>& forms) { |
177 password_manager::PasswordGenerationManager* manager = | 190 password_manager::PasswordGenerationManager* manager = |
178 ChromePasswordManagerClient::GetGenerationManagerFromWebContents( | 191 ChromePasswordManagerClient::GetGenerationManagerFromWebContents( |
179 web_contents_); | 192 web_contents_); |
180 if (manager) | 193 if (manager) |
181 manager->DetectAccountCreationForms(forms); | 194 manager->DetectAccountCreationForms(forms); |
182 } | 195 } |
183 | 196 |
184 void ChromeAutofillClient::DidFillOrPreviewField( | 197 void ChromeAutofillClient::DidFillOrPreviewField( |
185 const base::string16& autofilled_value, | 198 const base::string16& autofilled_value, |
186 const base::string16& profile_full_name) { | 199 const base::string16& profile_full_name) { |
187 #if defined(OS_ANDROID) | 200 #if defined(OS_ANDROID) |
188 AutofillLoggerAndroid::DidFillOrPreviewField(autofilled_value, | 201 AutofillLoggerAndroid::DidFillOrPreviewField(autofilled_value, |
189 profile_full_name); | 202 profile_full_name); |
190 #endif // defined(OS_ANDROID) | 203 #endif // defined(OS_ANDROID) |
191 } | 204 } |
192 | 205 |
193 } // namespace autofill | 206 } // namespace autofill |
OLD | NEW |