| 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 <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 #include "components/user_prefs/user_prefs.h" | 45 #include "components/user_prefs/user_prefs.h" |
| 46 #include "content/public/browser/navigation_entry.h" | 46 #include "content/public/browser/navigation_entry.h" |
| 47 #include "content/public/browser/render_frame_host.h" | 47 #include "content/public/browser/render_frame_host.h" |
| 48 #include "ui/gfx/geometry/rect.h" | 48 #include "ui/gfx/geometry/rect.h" |
| 49 | 49 |
| 50 #if BUILDFLAG(ANDROID_JAVA_UI) | 50 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 51 #include "chrome/browser/android/chrome_application.h" | 51 #include "chrome/browser/android/chrome_application.h" |
| 52 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 52 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" |
| 53 #else | 53 #else |
| 54 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 54 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 55 #include "components/ui/zoom/zoom_controller.h" | 55 #include "components/zoom/zoom_controller.h" |
| 56 #endif | 56 #endif |
| 57 | 57 |
| 58 #if defined(OS_ANDROID) | 58 #if defined(OS_ANDROID) |
| 59 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m
obile.h" | 59 #include "components/autofill/core/browser/autofill_save_card_infobar_delegate_m
obile.h" |
| 60 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h" | 60 #include "components/autofill/core/browser/autofill_save_card_infobar_mobile.h" |
| 61 #include "components/infobars/core/infobar.h" | 61 #include "components/infobars/core/infobar.h" |
| 62 #endif | 62 #endif |
| 63 | 63 |
| 64 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); | 64 DEFINE_WEB_CONTENTS_USER_DATA_KEY(autofill::ChromeAutofillClient); |
| 65 | 65 |
| 66 namespace autofill { | 66 namespace autofill { |
| 67 | 67 |
| 68 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) | 68 ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) |
| 69 : content::WebContentsObserver(web_contents), | 69 : content::WebContentsObserver(web_contents), |
| 70 unmask_controller_( | 70 unmask_controller_( |
| 71 user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()), | 71 user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()), |
| 72 Profile::FromBrowserContext(web_contents->GetBrowserContext()) | 72 Profile::FromBrowserContext(web_contents->GetBrowserContext()) |
| 73 ->IsOffTheRecord()) { | 73 ->IsOffTheRecord()) { |
| 74 DCHECK(web_contents); | 74 DCHECK(web_contents); |
| 75 | 75 |
| 76 #if !BUILDFLAG(ANDROID_JAVA_UI) | 76 #if !BUILDFLAG(ANDROID_JAVA_UI) |
| 77 // Since ZoomController is also a WebContentsObserver, we need to be careful | 77 // Since ZoomController is also a WebContentsObserver, we need to be careful |
| 78 // about disconnecting from it since the relative order of destruction of | 78 // about disconnecting from it since the relative order of destruction of |
| 79 // WebContentsObservers is not guaranteed. ZoomController silently clears | 79 // WebContentsObservers is not guaranteed. ZoomController silently clears |
| 80 // its ZoomObserver list during WebContentsDestroyed() so there's no need | 80 // its ZoomObserver list during WebContentsDestroyed() so there's no need |
| 81 // to explicitly remove ourselves on destruction. | 81 // to explicitly remove ourselves on destruction. |
| 82 ui_zoom::ZoomController* zoom_controller = | 82 zoom::ZoomController* zoom_controller = |
| 83 ui_zoom::ZoomController::FromWebContents(web_contents); | 83 zoom::ZoomController::FromWebContents(web_contents); |
| 84 // There may not always be a ZoomController, e.g. in tests. | 84 // There may not always be a ZoomController, e.g. in tests. |
| 85 if (zoom_controller) | 85 if (zoom_controller) |
| 86 zoom_controller->AddObserver(this); | 86 zoom_controller->AddObserver(this); |
| 87 #endif | 87 #endif |
| 88 } | 88 } |
| 89 | 89 |
| 90 ChromeAutofillClient::~ChromeAutofillClient() { | 90 ChromeAutofillClient::~ChromeAutofillClient() { |
| 91 // NOTE: It is too late to clean up the autofill popup; that cleanup process | 91 // NOTE: It is too late to clean up the autofill popup; that cleanup process |
| 92 // requires that the WebContents instance still be valid and it is not at | 92 // requires that the WebContents instance still be valid and it is not at |
| 93 // this point (in particular, the WebContentsImpl destructor has already | 93 // this point (in particular, the WebContentsImpl destructor has already |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 272 #endif | 272 #endif |
| 273 | 273 |
| 274 HideAutofillPopup(); | 274 HideAutofillPopup(); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void ChromeAutofillClient::WebContentsDestroyed() { | 277 void ChromeAutofillClient::WebContentsDestroyed() { |
| 278 HideAutofillPopup(); | 278 HideAutofillPopup(); |
| 279 } | 279 } |
| 280 | 280 |
| 281 void ChromeAutofillClient::OnZoomChanged( | 281 void ChromeAutofillClient::OnZoomChanged( |
| 282 const ui_zoom::ZoomController::ZoomChangedEventData& data) { | 282 const zoom::ZoomController::ZoomChangedEventData& data) { |
| 283 HideAutofillPopup(); | 283 HideAutofillPopup(); |
| 284 } | 284 } |
| 285 | 285 |
| 286 void ChromeAutofillClient::PropagateAutofillPredictions( | 286 void ChromeAutofillClient::PropagateAutofillPredictions( |
| 287 content::RenderFrameHost* rfh, | 287 content::RenderFrameHost* rfh, |
| 288 const std::vector<autofill::FormStructure*>& forms) { | 288 const std::vector<autofill::FormStructure*>& forms) { |
| 289 password_manager::ContentPasswordManagerDriver* driver = | 289 password_manager::ContentPasswordManagerDriver* driver = |
| 290 password_manager::ContentPasswordManagerDriver::GetForRenderFrameHost( | 290 password_manager::ContentPasswordManagerDriver::GetForRenderFrameHost( |
| 291 rfh); | 291 rfh); |
| 292 if (driver) { | 292 if (driver) { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 ssl_status = navigation_entry->GetSSL(); | 331 ssl_status = navigation_entry->GetSSL(); |
| 332 // Note: If changing the implementation below, also change | 332 // Note: If changing the implementation below, also change |
| 333 // AwAutofillClient::IsContextSecure. See crbug.com/505388 | 333 // AwAutofillClient::IsContextSecure. See crbug.com/505388 |
| 334 return ssl_status.security_style == content::SECURITY_STYLE_AUTHENTICATED && | 334 return ssl_status.security_style == content::SECURITY_STYLE_AUTHENTICATED && |
| 335 !(ssl_status.content_status & | 335 !(ssl_status.content_status & |
| 336 content::SSLStatus::RAN_INSECURE_CONTENT); | 336 content::SSLStatus::RAN_INSECURE_CONTENT); |
| 337 } | 337 } |
| 338 | 338 |
| 339 } // namespace autofill | 339 } // namespace autofill |
| OLD | NEW |