Chromium Code Reviews| 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 13 matching lines...) Expand all Loading... | |
| 24 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" | 24 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
| 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/web_data_service_factory.h" | 30 #include "chrome/browser/web_data_service_factory.h" |
| 31 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
| 32 #include "components/autofill/content/browser/content_autofill_driver.h" | 32 #include "components/autofill/content/browser/content_autofill_driver.h" |
| 33 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | 33 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 34 #include "components/autofill/core/browser/popup_item_ids.h" | |
| 34 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h" | 35 #include "components/autofill/core/browser/ui/card_unmask_prompt_view.h" |
| 35 #include "components/autofill/core/common/autofill_pref_names.h" | 36 #include "components/autofill/core/common/autofill_pref_names.h" |
| 36 #include "components/autofill/core/common/autofill_switches.h" | 37 #include "components/autofill/core/common/autofill_switches.h" |
| 37 #include "components/browser_sync/profile_sync_service.h" | 38 #include "components/browser_sync/profile_sync_service.h" |
| 38 #include "components/password_manager/content/browser/content_password_manager_d river.h" | 39 #include "components/password_manager/content/browser/content_password_manager_d river.h" |
| 40 #include "components/password_manager/core/browser/password_manager_metrics_util .h" | |
| 39 #include "components/prefs/pref_service.h" | 41 #include "components/prefs/pref_service.h" |
| 40 #include "components/signin/core/browser/profile_identity_provider.h" | 42 #include "components/signin/core/browser/profile_identity_provider.h" |
| 41 #include "components/signin/core/browser/signin_header_helper.h" | 43 #include "components/signin/core/browser/signin_header_helper.h" |
| 42 #include "components/signin/core/browser/signin_metrics.h" | 44 #include "components/signin/core/browser/signin_metrics.h" |
| 43 #include "components/user_prefs/user_prefs.h" | 45 #include "components/user_prefs/user_prefs.h" |
| 44 #include "content/public/browser/navigation_entry.h" | 46 #include "content/public/browser/navigation_entry.h" |
| 45 #include "content/public/browser/render_frame_host.h" | 47 #include "content/public/browser/render_frame_host.h" |
| 46 #include "content/public/browser/ssl_status.h" | 48 #include "content/public/browser/ssl_status.h" |
| 47 #include "ui/gfx/geometry/rect.h" | 49 #include "ui/gfx/geometry/rect.h" |
| 48 | 50 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 | 370 |
| 369 bool ChromeAutofillClient::ShouldShowSigninPromo() { | 371 bool ChromeAutofillClient::ShouldShowSigninPromo() { |
| 370 #if !defined(OS_ANDROID) | 372 #if !defined(OS_ANDROID) |
| 371 return false; | 373 return false; |
| 372 #else | 374 #else |
| 373 return signin::ShouldShowPromo( | 375 return signin::ShouldShowPromo( |
| 374 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); | 376 Profile::FromBrowserContext(web_contents()->GetBrowserContext())); |
| 375 #endif | 377 #endif |
| 376 } | 378 } |
| 377 | 379 |
| 378 void ChromeAutofillClient::StartSigninFlow() { | 380 void ChromeAutofillClient::StartSigninFlow() { |
|
Evan Stade
2017/07/13 16:48:43
I believe you can make this one use ExecuteCommand
melandory
2017/07/25 15:08:50
Done.
| |
| 379 #if defined(OS_ANDROID) | 381 #if defined(OS_ANDROID) |
| 380 chrome::android::SigninPromoUtilAndroid::StartAccountSigninActivityForPromo( | 382 chrome::android::SigninPromoUtilAndroid::StartAccountSigninActivityForPromo( |
| 381 content::ContentViewCore::FromWebContents(web_contents()), | 383 content::ContentViewCore::FromWebContents(web_contents()), |
| 382 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); | 384 signin_metrics::AccessPoint::ACCESS_POINT_AUTOFILL_DROPDOWN); |
| 383 #endif | 385 #endif |
| 384 } | 386 } |
| 385 | 387 |
| 386 void ChromeAutofillClient::ShowHttpNotSecureExplanation() { | 388 void ChromeAutofillClient::ShowHttpNotSecureExplanation() { |
| 387 #if !defined(OS_ANDROID) | 389 #if !defined(OS_ANDROID) |
| 388 // On desktop platforms, open Page Info, which briefly explains the HTTP | 390 // On desktop platforms, open Page Info, which briefly explains the HTTP |
| 389 // warning message and provides a link to the Help Center for more details. | 391 // warning message and provides a link to the Help Center for more details. |
| 390 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); | 392 Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); |
| 391 if (browser && chrome::ShowPageInfo(browser, web_contents())) | 393 if (browser && chrome::ShowPageInfo(browser, web_contents())) |
| 392 return; | 394 return; |
| 393 // Otherwise fall through to the section below that opens the URL directly. | 395 // Otherwise fall through to the section below that opens the URL directly. |
| 394 #endif | 396 #endif |
| 395 | 397 |
| 396 // On Android, where Page Info does not (yet) contain a link to the Help | 398 // On Android, where Page Info does not (yet) contain a link to the Help |
| 397 // Center (https://crbug.com/679532), or in corner cases where Page Info is | 399 // Center (https://crbug.com/679532), or in corner cases where Page Info is |
| 398 // not shown (for example, no navigation entry), just launch the Help topic | 400 // not shown (for example, no navigation entry), just launch the Help topic |
| 399 // directly. | 401 // directly. |
| 400 const GURL kSecurityIndicatorHelpCenterUrl( | 402 const GURL kSecurityIndicatorHelpCenterUrl( |
| 401 "https://support.google.com/chrome/?p=ui_security_indicator"); | 403 "https://support.google.com/chrome/?p=ui_security_indicator"); |
| 402 web_contents()->OpenURL(content::OpenURLParams( | 404 web_contents()->OpenURL(content::OpenURLParams( |
| 403 GURL(kSecurityIndicatorHelpCenterUrl), content::Referrer(), | 405 GURL(kSecurityIndicatorHelpCenterUrl), content::Referrer(), |
| 404 WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, | 406 WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, |
| 405 false /* is_renderer_initiated */)); | 407 false /* is_renderer_initiated */)); |
| 406 } | 408 } |
| 407 | 409 |
| 410 bool ChromeAutofillClient::ExecuteCommand(int id) { | |
|
Evan Stade
2017/07/13 16:48:43
nit: please keep function implementations in the s
melandory
2017/07/25 15:08:50
Done.
| |
| 411 if (id == autofill::POPUP_ITEM_ID_HTTP_NOT_SECURE_WARNING_MESSAGE) { | |
| 412 password_manager::metrics_util::LogShowedHttpNotSecureExplanation(); | |
| 413 ShowHttpNotSecureExplanation(); | |
|
vasilii
2017/07/13 16:11:51
Should you drop ShowHttpNotSecureExplanation() fro
Evan Stade
2017/07/13 16:48:43
yes please
melandory
2017/07/25 15:08:50
Done.
| |
| 414 return true; | |
| 415 } else if (id == autofill::POPUP_ITEM_ID_ALL_SAVED_PASSWORDS_ENTRY) { | |
| 416 ShowPasswordsSettingsPage(); | |
| 417 return true; | |
| 418 } | |
| 419 return false; | |
| 420 } | |
| 421 | |
| 422 void ChromeAutofillClient::ShowPasswordsSettingsPage() { | |
|
Evan Stade
2017/07/13 16:48:43
doesn't seem worth adding this function since it's
melandory
2017/07/25 15:08:50
Done.
| |
| 423 #if !defined(OS_ANDROID) | |
| 424 chrome::ShowSettingsSubPage( | |
| 425 chrome::FindBrowserWithWebContents(web_contents()), | |
| 426 chrome::kPasswordManagerSubPage); | |
| 427 #endif | |
| 428 } | |
| 429 | |
| 408 } // namespace autofill | 430 } // namespace autofill |
| OLD | NEW |