| 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 13 matching lines...) Expand all Loading... |
| 24 #include "components/autofill/content/browser/content_autofill_driver.h" | 24 #include "components/autofill/content/browser/content_autofill_driver.h" |
| 25 #include "components/autofill/content/common/autofill_messages.h" | 25 #include "components/autofill/content/common/autofill_messages.h" |
| 26 #include "components/autofill/core/common/autofill_pref_names.h" | 26 #include "components/autofill/core/common/autofill_pref_names.h" |
| 27 #include "content/public/browser/render_view_host.h" | 27 #include "content/public/browser/render_view_host.h" |
| 28 #include "ui/gfx/rect.h" | 28 #include "ui/gfx/rect.h" |
| 29 | 29 |
| 30 #if defined(OS_ANDROID) | 30 #if defined(OS_ANDROID) |
| 31 #include "chrome/browser/android/chromium_application.h" | 31 #include "chrome/browser/android/chromium_application.h" |
| 32 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 32 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" |
| 33 #else | 33 #else |
| 34 #include "chrome/browser/ui/zoom/zoom_controller.h" | 34 #include "extensions/browser/ui/zoom/zoom_controller.h" |
| 35 #endif | 35 #endif |
| 36 | 36 |
| 37 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); | 37 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); |
| 38 | 38 |
| 39 namespace autofill { | 39 namespace autofill { |
| 40 | 40 |
| 41 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) | 41 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) |
| 42 : content::WebContentsObserver(web_contents), web_contents_(web_contents) { | 42 : content::WebContentsObserver(web_contents), web_contents_(web_contents) { |
| 43 DCHECK(web_contents); | 43 DCHECK(web_contents); |
| 44 | 44 |
| 45 #if !defined(OS_ANDROID) | 45 #if !defined(OS_ANDROID) |
| 46 // Since ZoomController is also a WebContentsObserver, we need to be careful | 46 // Since ZoomController is also a WebContentsObserver, we need to be careful |
| 47 // about disconnecting from it since the relative order of destruction of | 47 // about disconnecting from it since the relative order of destruction of |
| 48 // WebContentsObservers is not guaranteed. ZoomController silently clears | 48 // WebContentsObservers is not guaranteed. ZoomController silently clears |
| 49 // its ZoomObserver list during WebContentsDestroyed() so there's no need | 49 // its ZoomObserver list during WebContentsDestroyed() so there's no need |
| 50 // to explicitly remove ourselves on destruction. | 50 // to explicitly remove ourselves on destruction. |
| 51 ZoomController* zoom_controller = | 51 extensions::ZoomController* zoom_controller = |
| 52 ZoomController::FromWebContents(web_contents); | 52 extensions::ZoomController::FromWebContents(web_contents); |
| 53 // There may not always be a ZoomController, e.g. in tests. | 53 // There may not always be a ZoomController, e.g. in tests. |
| 54 if (zoom_controller) | 54 if (zoom_controller) |
| 55 zoom_controller->AddObserver(this); | 55 zoom_controller->AddObserver(this); |
| 56 #endif | 56 #endif |
| 57 | 57 |
| 58 #if defined(OS_MACOSX) && !defined(OS_IOS) | 58 #if defined(OS_MACOSX) && !defined(OS_IOS) |
| 59 RegisterForKeystoneNotifications(); | 59 RegisterForKeystoneNotifications(); |
| 60 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 60 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
| 61 } | 61 } |
| 62 | 62 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 void ChromeAutofillClient::HideRequestAutocompleteDialog() { | 193 void ChromeAutofillClient::HideRequestAutocompleteDialog() { |
| 194 if (dialog_controller_.get()) | 194 if (dialog_controller_.get()) |
| 195 dialog_controller_->Hide(); | 195 dialog_controller_->Hide(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void ChromeAutofillClient::WebContentsDestroyed() { | 198 void ChromeAutofillClient::WebContentsDestroyed() { |
| 199 HideAutofillPopup(); | 199 HideAutofillPopup(); |
| 200 } | 200 } |
| 201 | 201 |
| 202 void ChromeAutofillClient::OnZoomChanged( | 202 void ChromeAutofillClient::OnZoomChanged( |
| 203 const ZoomController::ZoomChangedEventData& data) { | 203 const extensions::ZoomController::ZoomChangedEventData& data) { |
| 204 HideAutofillPopup(); | 204 HideAutofillPopup(); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void ChromeAutofillClient::DetectAccountCreationForms( | 207 void ChromeAutofillClient::DetectAccountCreationForms( |
| 208 const std::vector<autofill::FormStructure*>& forms) { | 208 const std::vector<autofill::FormStructure*>& forms) { |
| 209 password_manager::PasswordGenerationManager* manager = | 209 password_manager::PasswordGenerationManager* manager = |
| 210 ChromePasswordManagerClient::GetGenerationManagerFromWebContents( | 210 ChromePasswordManagerClient::GetGenerationManagerFromWebContents( |
| 211 web_contents_); | 211 web_contents_); |
| 212 if (manager) | 212 if (manager) |
| 213 manager->DetectAccountCreationForms(forms); | 213 manager->DetectAccountCreationForms(forms); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void ChromeAutofillClient::DidFillOrPreviewField( | 216 void ChromeAutofillClient::DidFillOrPreviewField( |
| 217 const base::string16& autofilled_value, | 217 const base::string16& autofilled_value, |
| 218 const base::string16& profile_full_name) { | 218 const base::string16& profile_full_name) { |
| 219 #if defined(OS_ANDROID) | 219 #if defined(OS_ANDROID) |
| 220 AutofillLoggerAndroid::DidFillOrPreviewField(autofilled_value, | 220 AutofillLoggerAndroid::DidFillOrPreviewField(autofilled_value, |
| 221 profile_full_name); | 221 profile_full_name); |
| 222 #endif // defined(OS_ANDROID) | 222 #endif // defined(OS_ANDROID) |
| 223 } | 223 } |
| 224 | 224 |
| 225 } // namespace autofill | 225 } // namespace autofill |
| OLD | NEW |