| 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 29 matching lines...) Expand all Loading... |
| 40 #include "components/browser_sync/profile_sync_service.h" | 40 #include "components/browser_sync/profile_sync_service.h" |
| 41 #include "components/password_manager/content/browser/content_password_manager_d
river.h" | 41 #include "components/password_manager/content/browser/content_password_manager_d
river.h" |
| 42 #include "components/prefs/pref_service.h" | 42 #include "components/prefs/pref_service.h" |
| 43 #include "components/signin/core/browser/profile_identity_provider.h" | 43 #include "components/signin/core/browser/profile_identity_provider.h" |
| 44 #include "components/signin/core/browser/signin_header_helper.h" | 44 #include "components/signin/core/browser/signin_header_helper.h" |
| 45 #include "components/signin/core/browser/signin_metrics.h" | 45 #include "components/signin/core/browser/signin_metrics.h" |
| 46 #include "components/user_prefs/user_prefs.h" | 46 #include "components/user_prefs/user_prefs.h" |
| 47 #include "content/public/browser/navigation_entry.h" | 47 #include "content/public/browser/navigation_entry.h" |
| 48 #include "content/public/browser/render_frame_host.h" | 48 #include "content/public/browser/render_frame_host.h" |
| 49 #include "content/public/browser/ssl_status.h" | 49 #include "content/public/browser/ssl_status.h" |
| 50 #include "content/public/common/origin_util.h" |
| 50 #include "ui/gfx/geometry/rect.h" | 51 #include "ui/gfx/geometry/rect.h" |
| 51 | 52 |
| 52 #if BUILDFLAG(ANDROID_JAVA_UI) | 53 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 53 #include "chrome/browser/android/chrome_application.h" | 54 #include "chrome/browser/android/chrome_application.h" |
| 54 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" | 55 #include "chrome/browser/ui/android/autofill/autofill_logger_android.h" |
| 55 #else | 56 #else |
| 56 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 57 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 57 #include "components/zoom/zoom_controller.h" | 58 #include "components/zoom/zoom_controller.h" |
| 58 #endif | 59 #endif |
| 59 | 60 |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 // Note: If changing the implementation below, also change | 359 // Note: If changing the implementation below, also change |
| 359 // AwAutofillClient::IsContextSecure. See crbug.com/505388 | 360 // AwAutofillClient::IsContextSecure. See crbug.com/505388 |
| 360 return navigation_entry->GetURL().SchemeIsCryptographic() && | 361 return navigation_entry->GetURL().SchemeIsCryptographic() && |
| 361 ssl_status.certificate && | 362 ssl_status.certificate && |
| 362 (!net::IsCertStatusError(ssl_status.cert_status) || | 363 (!net::IsCertStatusError(ssl_status.cert_status) || |
| 363 net::IsCertStatusMinorError(ssl_status.cert_status)) && | 364 net::IsCertStatusMinorError(ssl_status.cert_status)) && |
| 364 !(ssl_status.content_status & | 365 !(ssl_status.content_status & |
| 365 content::SSLStatus::RAN_INSECURE_CONTENT); | 366 content::SSLStatus::RAN_INSECURE_CONTENT); |
| 366 } | 367 } |
| 367 | 368 |
| 369 bool ChromeAutofillClient::IsTopLevelURLSecure() { |
| 370 return content::IsOriginSecure(web_contents()->GetVisibleURL()); |
| 371 } |
| 372 |
| 368 bool ChromeAutofillClient::ShouldShowSigninPromo() { | 373 bool ChromeAutofillClient::ShouldShowSigninPromo() { |
| 369 #if !defined(OS_ANDROID) | 374 #if !defined(OS_ANDROID) |
| 370 // Determine if we are in a valid context (on desktop platforms, we could be | 375 // Determine if we are in a valid context (on desktop platforms, we could be |
| 371 // in an app window with no Browser). | 376 // in an app window with no Browser). |
| 372 if (!chrome::FindBrowserWithWebContents(web_contents())) | 377 if (!chrome::FindBrowserWithWebContents(web_contents())) |
| 373 return false; | 378 return false; |
| 374 #endif | 379 #endif |
| 375 | 380 |
| 376 return signin::ShouldShowPromo( | 381 return signin::ShouldShowPromo( |
| 377 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); | 382 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); |
| 378 } | 383 } |
| 379 | 384 |
| 380 void ChromeAutofillClient::StartSigninFlow() { | 385 void ChromeAutofillClient::StartSigninFlow() { |
| 381 #if defined(OS_ANDROID) | 386 #if defined(OS_ANDROID) |
| 382 chrome::android::SigninPromoUtilAndroid::StartAccountSigninActivityForPromo( | 387 chrome::android::SigninPromoUtilAndroid::StartAccountSigninActivityForPromo( |
| 383 content::ContentViewCore::FromWebContents(web_contents()), | 388 content::ContentViewCore::FromWebContents(web_contents()), |
| 384 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); | 389 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); |
| 385 #else | 390 #else |
| 386 chrome::FindBrowserWithWebContents(web_contents()) | 391 chrome::FindBrowserWithWebContents(web_contents()) |
| 387 ->window() | 392 ->window() |
| 388 ->ShowAvatarBubbleFromAvatarButton( | 393 ->ShowAvatarBubbleFromAvatarButton( |
| 389 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, | 394 BrowserWindow::AVATAR_BUBBLE_MODE_SIGNIN, |
| 390 signin::ManageAccountsParams(), | 395 signin::ManageAccountsParams(), |
| 391 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); | 396 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); |
| 392 #endif | 397 #endif |
| 393 } | 398 } |
| 394 | 399 |
| 395 } // namespace autofill | 400 } // namespace autofill |
| OLD | NEW |