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 14 matching lines...) Expand all Loading... |
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 "components/password_manager/content/browser/content_password_manager_d
river.h" | 27 #include "components/password_manager/content/browser/content_password_manager_d
river.h" |
28 #include "content/public/browser/render_view_host.h" | 28 #include "content/public/browser/render_view_host.h" |
29 #include "ui/gfx/rect.h" | 29 #include "ui/gfx/rect.h" |
30 | 30 |
31 #if defined(OS_ANDROID) | 31 #if defined(OS_ANDROID) |
32 #include "chrome/browser/android/chromium_application.h" | 32 #include "chrome/browser/android/chromium_application.h" |
33 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 33 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" |
34 #else | 34 #else |
35 #include "chrome/browser/ui/zoom/zoom_controller.h" | 35 #include "components/ui/zoom/zoom_controller.h" |
36 #endif | 36 #endif |
37 | 37 |
38 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); | 38 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); |
39 | 39 |
40 namespace autofill { | 40 namespace autofill { |
41 | 41 |
42 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) | 42 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) |
43 : content::WebContentsObserver(web_contents), web_contents_(web_contents) { | 43 : content::WebContentsObserver(web_contents), web_contents_(web_contents) { |
44 DCHECK(web_contents); | 44 DCHECK(web_contents); |
45 | 45 |
46 #if !defined(OS_ANDROID) | 46 #if !defined(OS_ANDROID) |
47 // Since ZoomController is also a WebContentsObserver, we need to be careful | 47 // Since ZoomController is also a WebContentsObserver, we need to be careful |
48 // about disconnecting from it since the relative order of destruction of | 48 // about disconnecting from it since the relative order of destruction of |
49 // WebContentsObservers is not guaranteed. ZoomController silently clears | 49 // WebContentsObservers is not guaranteed. ZoomController silently clears |
50 // its ZoomObserver list during WebContentsDestroyed() so there's no need | 50 // its ZoomObserver list during WebContentsDestroyed() so there's no need |
51 // to explicitly remove ourselves on destruction. | 51 // to explicitly remove ourselves on destruction. |
52 ZoomController* zoom_controller = | 52 components::ZoomController* zoom_controller = |
53 ZoomController::FromWebContents(web_contents); | 53 components::ZoomController::FromWebContents(web_contents); |
54 // There may not always be a ZoomController, e.g. in tests. | 54 // There may not always be a ZoomController, e.g. in tests. |
55 if (zoom_controller) | 55 if (zoom_controller) |
56 zoom_controller->AddObserver(this); | 56 zoom_controller->AddObserver(this); |
57 #endif | 57 #endif |
58 | 58 |
59 #if defined(OS_MACOSX) && !defined(OS_IOS) | 59 #if defined(OS_MACOSX) && !defined(OS_IOS) |
60 RegisterForKeystoneNotifications(); | 60 RegisterForKeystoneNotifications(); |
61 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 61 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
62 } | 62 } |
63 | 63 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 void ChromeAutofillClient::HideRequestAutocompleteDialog() { | 194 void ChromeAutofillClient::HideRequestAutocompleteDialog() { |
195 if (dialog_controller_.get()) | 195 if (dialog_controller_.get()) |
196 dialog_controller_->Hide(); | 196 dialog_controller_->Hide(); |
197 } | 197 } |
198 | 198 |
199 void ChromeAutofillClient::WebContentsDestroyed() { | 199 void ChromeAutofillClient::WebContentsDestroyed() { |
200 HideAutofillPopup(); | 200 HideAutofillPopup(); |
201 } | 201 } |
202 | 202 |
203 void ChromeAutofillClient::OnZoomChanged( | 203 void ChromeAutofillClient::OnZoomChanged( |
204 const ZoomController::ZoomChangedEventData& data) { | 204 const components::ZoomController::ZoomChangedEventData& data) { |
205 HideAutofillPopup(); | 205 HideAutofillPopup(); |
206 } | 206 } |
207 | 207 |
208 void ChromeAutofillClient::DetectAccountCreationForms( | 208 void ChromeAutofillClient::DetectAccountCreationForms( |
209 content::RenderFrameHost* rfh, | 209 content::RenderFrameHost* rfh, |
210 const std::vector<autofill::FormStructure*>& forms) { | 210 const std::vector<autofill::FormStructure*>& forms) { |
211 password_manager::ContentPasswordManagerDriver::GetForRenderFrameHost(rfh) | 211 password_manager::ContentPasswordManagerDriver::GetForRenderFrameHost(rfh) |
212 ->GetPasswordGenerationManager() | 212 ->GetPasswordGenerationManager() |
213 ->DetectAccountCreationForms(forms); | 213 ->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 void ChromeAutofillClient::OnFirstUserGestureObserved() { | 225 void ChromeAutofillClient::OnFirstUserGestureObserved() { |
226 web_contents()->SendToAllFrames( | 226 web_contents()->SendToAllFrames( |
227 new AutofillMsg_FirstUserGestureObservedInTab(routing_id())); | 227 new AutofillMsg_FirstUserGestureObservedInTab(routing_id())); |
228 } | 228 } |
229 | 229 |
230 } // namespace autofill | 230 } // namespace autofill |
OLD | NEW |