Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: chrome/browser/password_manager/chrome_password_manager_client.cc

Issue 2833193002: Trigger Password Protection ping on username/password field on focus (Closed)
Patch Set: Address comments from mathp Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/password_manager/chrome_password_manager_client.h" 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "content/public/browser/navigation_handle.h" 58 #include "content/public/browser/navigation_handle.h"
59 #include "content/public/browser/render_view_host.h" 59 #include "content/public/browser/render_view_host.h"
60 #include "content/public/browser/ssl_status.h" 60 #include "content/public/browser/ssl_status.h"
61 #include "content/public/browser/web_contents.h" 61 #include "content/public/browser/web_contents.h"
62 #include "content/public/common/origin_util.h" 62 #include "content/public/common/origin_util.h"
63 #include "extensions/features/features.h" 63 #include "extensions/features/features.h"
64 #include "google_apis/gaia/gaia_urls.h" 64 #include "google_apis/gaia/gaia_urls.h"
65 #include "net/base/url_util.h" 65 #include "net/base/url_util.h"
66 #include "third_party/re2/src/re2/re2.h" 66 #include "third_party/re2/src/re2/re2.h"
67 67
68 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) 68 #if defined(SAFE_BROWSING_DB_LOCAL)
69 #include "chrome/browser/browser_process.h" 69 #include "chrome/browser/browser_process.h"
70 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 70 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
71 #include "components/safe_browsing/password_protection/password_protection_servi ce.h" 71 #include "components/safe_browsing/password_protection/password_protection_servi ce.h"
72 #endif 72 #endif
73 73
74 #if defined(OS_ANDROID) 74 #if defined(OS_ANDROID)
75 #include "chrome/browser/android/tab_android.h" 75 #include "chrome/browser/android/tab_android.h"
76 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" 76 #include "chrome/browser/password_manager/account_chooser_dialog_android.h"
77 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h " 77 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h "
78 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg ate_android.h" 78 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg ate_android.h"
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 403
404 #if defined(SAFE_BROWSING_DB_LOCAL) 404 #if defined(SAFE_BROWSING_DB_LOCAL)
405 safe_browsing::PasswordProtectionService* 405 safe_browsing::PasswordProtectionService*
406 ChromePasswordManagerClient::GetPasswordProtectionService() const { 406 ChromePasswordManagerClient::GetPasswordProtectionService() const {
407 if (g_browser_process && g_browser_process->safe_browsing_service()) { 407 if (g_browser_process && g_browser_process->safe_browsing_service()) {
408 return g_browser_process->safe_browsing_service() 408 return g_browser_process->safe_browsing_service()
409 ->GetPasswordProtectionService(profile_); 409 ->GetPasswordProtectionService(profile_);
410 } 410 }
411 return nullptr; 411 return nullptr;
412 } 412 }
413
414 void ChromePasswordManagerClient::CheckSafeBrowsingReputation(
415 const GURL& form_action,
416 const GURL& frame_url) {
417 safe_browsing::PasswordProtectionService* pps =
418 GetPasswordProtectionService();
419 if (pps)
420 pps->MaybeStartLowReputationRequest(GetMainFrameURL(), form_action,
estark 2017/05/02 14:09:38 optional nit: I usually see curly braces around bo
Jialiu Lin 2017/05/02 17:36:00 You're right. curly braces are needed here. Thanks
421 frame_url);
422 }
413 #endif 423 #endif
414 424
415 // TODO(crbug.com/706392): Fix password reuse detection for Android. 425 // TODO(crbug.com/706392): Fix password reuse detection for Android.
416 #if !defined(OS_ANDROID) 426 #if !defined(OS_ANDROID)
417 void ChromePasswordManagerClient::DidFinishNavigation( 427 void ChromePasswordManagerClient::DidFinishNavigation(
418 content::NavigationHandle* navigation_handle) { 428 content::NavigationHandle* navigation_handle) {
419 if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted()) 429 if (!navigation_handle->IsInMainFrame() || !navigation_handle->HasCommitted())
420 return; 430 return;
421 431
422 password_reuse_detection_manager_.DidNavigateMainFrame(GetMainFrameURL()); 432 password_reuse_detection_manager_.DidNavigateMainFrame(GetMainFrameURL());
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 // static 700 // static
691 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { 701 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) {
692 std::string scheme = url.scheme(); 702 std::string scheme = url.scheme();
693 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( 703 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme(
694 scheme) && 704 scheme) &&
695 #if BUILDFLAG(ENABLE_EXTENSIONS) 705 #if BUILDFLAG(ENABLE_EXTENSIONS)
696 scheme != extensions::kExtensionScheme && 706 scheme != extensions::kExtensionScheme &&
697 #endif 707 #endif
698 scheme != content::kChromeDevToolsScheme); 708 scheme != content::kChromeDevToolsScheme);
699 } 709 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698