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

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

Issue 2783773002: Link PasswordProtectionService to Profile and SB Service (Closed)
Patch Set: nit Created 3 years, 8 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 saving_and_filling_passwords_enabled_.Init( 199 saving_and_filling_passwords_enabled_.Init(
200 password_manager::prefs::kCredentialsEnableService, GetPrefs()); 200 password_manager::prefs::kCredentialsEnableService, GetPrefs());
201 ReportMetrics(*saving_and_filling_passwords_enabled_, this, profile_); 201 ReportMetrics(*saving_and_filling_passwords_enabled_, this, profile_);
202 driver_factory_->RequestSendLoggingAvailability(); 202 driver_factory_->RequestSendLoggingAvailability();
203 203
204 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) 204 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE)
205 if (CanSetPasswordProtectionService()) { 205 if (CanSetPasswordProtectionService()) {
206 password_reuse_detection_manager_.SetPasswordProtectionService( 206 password_reuse_detection_manager_.SetPasswordProtectionService(
207 g_browser_process->safe_browsing_service() 207 g_browser_process->safe_browsing_service()
208 ->password_protection_service() 208 ->GetPasswordProtectionService(profile_)
209 ->GetWeakPtr()); 209 ->GetWeakPtr());
210 } 210 }
211 #endif 211 #endif
212 } 212 }
213 213
214 ChromePasswordManagerClient::~ChromePasswordManagerClient() {} 214 ChromePasswordManagerClient::~ChromePasswordManagerClient() {}
215 215
216 bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage() 216 bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage()
217 const { 217 const {
218 DCHECK(web_contents()); 218 DCHECK(web_contents());
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
644 return false; 644 return false;
645 } 645 }
646 646
647 return true; 647 return true;
648 } 648 }
649 649
650 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) 650 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE)
651 bool ChromePasswordManagerClient::CanSetPasswordProtectionService() { 651 bool ChromePasswordManagerClient::CanSetPasswordProtectionService() {
652 return g_browser_process && g_browser_process->safe_browsing_service() && 652 return g_browser_process && g_browser_process->safe_browsing_service() &&
653 g_browser_process->safe_browsing_service() 653 g_browser_process->safe_browsing_service()
654 ->password_protection_service(); 654 ->GetPasswordProtectionService(profile_);
Nathan Parker 2017/03/30 21:38:12 When would this be null but safe_browsing_service(
Jialiu Lin 2017/03/30 23:23:04 Agree. As long as SafeBrowsingService is not null,
655 } 655 }
656 #endif 656 #endif
657 657
658 void ChromePasswordManagerClient::AnnotateNavigationEntry( 658 void ChromePasswordManagerClient::AnnotateNavigationEntry(
659 bool has_password_field) { 659 bool has_password_field) {
660 if (!ShouldAnnotateNavigationEntries(profile_)) 660 if (!ShouldAnnotateNavigationEntries(profile_))
661 return; 661 return;
662 662
663 content::NavigationEntry* entry = 663 content::NavigationEntry* entry =
664 web_contents()->GetController().GetLastCommittedEntry(); 664 web_contents()->GetController().GetLastCommittedEntry();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 // static 710 // static
711 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { 711 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) {
712 std::string scheme = url.scheme(); 712 std::string scheme = url.scheme();
713 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( 713 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme(
714 scheme) && 714 scheme) &&
715 #if BUILDFLAG(ENABLE_EXTENSIONS) 715 #if BUILDFLAG(ENABLE_EXTENSIONS)
716 scheme != extensions::kExtensionScheme && 716 scheme != extensions::kExtensionScheme &&
717 #endif 717 #endif
718 scheme != content::kChromeDevToolsScheme); 718 scheme != content::kChromeDevToolsScheme);
719 } 719 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698