| 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 14 matching lines...) Expand all Loading... |
| 25 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" | 25 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" |
| 26 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h" | 26 #include "chrome/browser/ui/autofill/credit_card_scanner_controller.h" |
| 27 #include "chrome/browser/ui/browser_finder.h" | 27 #include "chrome/browser/ui/browser_finder.h" |
| 28 #include "chrome/browser/ui/chrome_pages.h" | 28 #include "chrome/browser/ui/chrome_pages.h" |
| 29 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 29 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| 30 #include "chrome/browser/vr/vr_tab_helper.h" | 30 #include "chrome/browser/vr/vr_tab_helper.h" |
| 31 #include "chrome/browser/web_data_service_factory.h" | 31 #include "chrome/browser/web_data_service_factory.h" |
| 32 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 33 #include "components/autofill/content/browser/content_autofill_driver.h" | 33 #include "components/autofill/content/browser/content_autofill_driver.h" |
| 34 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | 34 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 35 #include "components/autofill/core/browser/popup_item_ids.h" |
| 35 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h" | 36 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h" |
| 36 #include "components/autofill/core/common/autofill_pref_names.h" | 37 #include "components/autofill/core/common/autofill_pref_names.h" |
| 37 #include "components/autofill/core/common/autofill_switches.h" | 38 #include "components/autofill/core/common/autofill_switches.h" |
| 38 #include "components/browser_sync/profile_sync_service.h" | 39 #include "components/browser_sync/profile_sync_service.h" |
| 39 #include "components/password_manager/content/browser/content_password_manager_d
river.h" | 40 #include "components/password_manager/content/browser/content_password_manager_d
river.h" |
| 41 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
| 40 #include "components/prefs/pref_service.h" | 42 #include "components/prefs/pref_service.h" |
| 41 #include "components/signin/core/browser/profile_identity_provider.h" | 43 #include "components/signin/core/browser/profile_identity_provider.h" |
| 42 #include "components/signin/core/browser/signin_header_helper.h" | 44 #include "components/signin/core/browser/signin_header_helper.h" |
| 43 #include "components/signin/core/browser/signin_metrics.h" | 45 #include "components/signin/core/browser/signin_metrics.h" |
| 44 #include "components/user_prefs/user_prefs.h" | 46 #include "components/user_prefs/user_prefs.h" |
| 45 #include "content/public/browser/navigation_entry.h" | 47 #include "content/public/browser/navigation_entry.h" |
| 46 #include "content/public/browser/render_frame_host.h" | 48 #include "content/public/browser/render_frame_host.h" |
| 47 #include "content/public/browser/ssl_status.h" | 49 #include "content/public/browser/ssl_status.h" |
| 48 #include "ui/gfx/geometry/rect.h" | 50 #include "ui/gfx/geometry/rect.h" |
| 49 | 51 |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 | 367 |
| 366 bool ChromeAutofillClient::ShouldShowSigninPromo() { | 368 bool ChromeAutofillClient::ShouldShowSigninPromo() { |
| 367 #if !defined(OS_ANDROID) | 369 #if !defined(OS_ANDROID) |
| 368 return false; | 370 return false; |
| 369 #else | 371 #else |
| 370 return signin::ShouldShowPromo( | 372 return signin::ShouldShowPromo( |
| 371 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); | 373 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); |
| 372 #endif | 374 #endif |
| 373 } | 375 } |
| 374 | 376 |
| 375 void ChromeAutofillClient::StartSigninFlow() { | 377 void ChromeAutofillClient::ExecuteCommand(int id) { |
| 378 if (id == autofill::POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE) { |
| 379 password_manager::metrics_util::LogShowedHttpNotSecureExplanation(); |
| 380 ShowHttpNotSecureExplanation(); |
| 381 } else if (id == autofill::POPUP_ITEM_ID_ALL_SAVED_PASSWORDS_ENTRY) { |
| 382 #if !defined(OS_ANDROID) |
| 383 chrome::ShowSettingsSubPage( |
| 384 chrome::FindBrowserWithWebContents(web_contents()), |
| 385 chrome::kPasswordManagerSubPage); |
| 386 #endif |
| 387 } else if (id == autofill::POPUP_ITEM_ID_CREDIT_CARD_SIGNIN_PROMO) { |
| 376 #if defined(OS_ANDROID) | 388 #if defined(OS_ANDROID) |
| 377 auto* window = web_contents()->GetNativeView()->GetWindowAndroid(); | 389 auto* window = web_contents()->GetNativeView()->GetWindowAndroid(); |
| 378 if (window) { | 390 if (window) { |
| 379 chrome::android::SigninPromoUtilAndroid::StartAccountSigninActivityForPromo( | 391 chrome::android::SigninPromoUtilAndroid:: |
| 380 window, signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); | 392 StartAccountSigninActivityForPromo( |
| 393 window, |
| 394 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); |
| 395 } |
| 396 #endif |
| 381 } | 397 } |
| 382 #endif | |
| 383 } | 398 } |
| 384 | 399 |
| 385 void ChromeAutofillClient::ShowHttpNotSecureExplanation() { | 400 void ChromeAutofillClient::ShowHttpNotSecureExplanation() { |
| 386 #if !defined(OS_ANDROID) | 401 #if !defined(OS_ANDROID) |
| 387 // On desktop platforms, open Page Info, which briefly explains the HTTP | 402 // On desktop platforms, open Page Info, which briefly explains the HTTP |
| 388 // warning message and provides a link to the Help Center for more details. | 403 // warning message and provides a link to the Help Center for more details. |
| 389 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); | 404 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); |
| 390 if (browser && chrome::ShowPageInfo(browser, web_contents())) | 405 if (browser && chrome::ShowPageInfo(browser, web_contents())) |
| 391 return; | 406 return; |
| 392 // Otherwise fall through to the section below that opens the URL directly. | 407 // Otherwise fall through to the section below that opens the URL directly. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 406 | 421 |
| 407 bool ChromeAutofillClient::IsAutofillSupported() { | 422 bool ChromeAutofillClient::IsAutofillSupported() { |
| 408 // VR browsing does not support popups at the moment. | 423 // VR browsing does not support popups at the moment. |
| 409 if (vr::VrTabHelper::IsInVr(web_contents())) | 424 if (vr::VrTabHelper::IsInVr(web_contents())) |
| 410 return false; | 425 return false; |
| 411 | 426 |
| 412 return true; | 427 return true; |
| 413 } | 428 } |
| 414 | 429 |
| 415 } // namespace autofill | 430 } // namespace autofill |
| OLD | NEW |