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/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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 #include "content/public/browser/ssl_status.h" | 57 #include "content/public/browser/ssl_status.h" |
58 #include "content/public/browser/web_contents.h" | 58 #include "content/public/browser/web_contents.h" |
59 #include "content/public/common/origin_util.h" | 59 #include "content/public/common/origin_util.h" |
60 #include "extensions/features/features.h" | 60 #include "extensions/features/features.h" |
61 #include "google_apis/gaia/gaia_urls.h" | 61 #include "google_apis/gaia/gaia_urls.h" |
62 #include "net/base/url_util.h" | 62 #include "net/base/url_util.h" |
63 #include "net/http/transport_security_state.h" | 63 #include "net/http/transport_security_state.h" |
64 #include "net/url_request/url_request_context.h" | 64 #include "net/url_request/url_request_context.h" |
65 #include "third_party/re2/src/re2/re2.h" | 65 #include "third_party/re2/src/re2/re2.h" |
66 | 66 |
67 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) | |
68 #include "chrome/browser/browser_process.h" | |
69 #include "chrome/browser/safe_browsing/safe_browsing_service.h" | |
70 #include "components/safe_browsing/password_protection/password_protection_servi ce.h" | |
71 #endif | |
72 | |
67 #if defined(OS_ANDROID) | 73 #if defined(OS_ANDROID) |
68 #include "chrome/browser/android/tab_android.h" | 74 #include "chrome/browser/android/tab_android.h" |
69 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" | 75 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" |
70 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h " | 76 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h " |
71 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg ate_android.h" | 77 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg ate_android.h" |
72 #include "chrome/browser/password_manager/save_password_infobar_delegate_android .h" | 78 #include "chrome/browser/password_manager/save_password_infobar_delegate_android .h" |
73 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro id.h" | 79 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro id.h" |
74 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" | 80 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" |
75 #endif | 81 #endif |
76 | 82 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
169 password_manager::PasswordManagerInternalsServiceFactory:: | 175 password_manager::PasswordManagerInternalsServiceFactory:: |
170 GetForBrowserContext(profile_), | 176 GetForBrowserContext(profile_), |
171 base::Bind( | 177 base::Bind( |
172 &ContentPasswordManagerDriverFactory::RequestSendLoggingAvailability, | 178 &ContentPasswordManagerDriverFactory::RequestSendLoggingAvailability, |
173 base::Unretained(driver_factory_))); | 179 base::Unretained(driver_factory_))); |
174 | 180 |
175 saving_and_filling_passwords_enabled_.Init( | 181 saving_and_filling_passwords_enabled_.Init( |
176 password_manager::prefs::kCredentialsEnableService, GetPrefs()); | 182 password_manager::prefs::kCredentialsEnableService, GetPrefs()); |
177 ReportMetrics(*saving_and_filling_passwords_enabled_, this, profile_); | 183 ReportMetrics(*saving_and_filling_passwords_enabled_, this, profile_); |
178 driver_factory_->RequestSendLoggingAvailability(); | 184 driver_factory_->RequestSendLoggingAvailability(); |
185 | |
186 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) | |
187 if (CanSetPasswordProtectionService()) { | |
188 password_reuse_detection_manager_.SetPasswordProtectionService( | |
189 g_browser_process->safe_browsing_service() | |
190 ->password_protection_service() | |
191 ->GetWeakPtr()); | |
192 } | |
193 #endif | |
179 } | 194 } |
180 | 195 |
181 ChromePasswordManagerClient::~ChromePasswordManagerClient() {} | 196 ChromePasswordManagerClient::~ChromePasswordManagerClient() {} |
182 | 197 |
183 bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage() | 198 bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage() |
184 const { | 199 const { |
185 DCHECK(web_contents()); | 200 DCHECK(web_contents()); |
186 content::NavigationEntry* entry = | 201 content::NavigationEntry* entry = |
187 web_contents()->GetController().GetLastCommittedEntry(); | 202 web_contents()->GetController().GetLastCommittedEntry(); |
188 bool is_enabled = false; | 203 bool is_enabled = false; |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
614 browser_sync::ProfileSyncService* profile_sync_service = | 629 browser_sync::ProfileSyncService* profile_sync_service = |
615 ProfileSyncServiceFactory::GetForProfile(profile); | 630 ProfileSyncServiceFactory::GetForProfile(profile); |
616 if (!profile_sync_service || !profile_sync_service->IsSyncActive() || | 631 if (!profile_sync_service || !profile_sync_service->IsSyncActive() || |
617 profile_sync_service->IsUsingSecondaryPassphrase()) { | 632 profile_sync_service->IsUsingSecondaryPassphrase()) { |
618 return false; | 633 return false; |
619 } | 634 } |
620 | 635 |
621 return true; | 636 return true; |
622 } | 637 } |
623 | 638 |
639 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) | |
640 bool ChromePasswordManagerClient::CanSetPasswordProtectionService() { | |
641 if (g_browser_process && g_browser_process->safe_browsing_service() && | |
dvadym
2017/03/07 15:12:47
Nit: return g_browser_process && g_browser_process
Jialiu Lin
2017/03/07 18:02:15
Done.
| |
642 g_browser_process->safe_browsing_service() | |
643 ->password_protection_service()) { | |
644 return true; | |
645 } | |
646 return false; | |
647 } | |
648 #endif | |
649 | |
624 void ChromePasswordManagerClient::AnnotateNavigationEntry( | 650 void ChromePasswordManagerClient::AnnotateNavigationEntry( |
625 bool has_password_field) { | 651 bool has_password_field) { |
626 if (!ShouldAnnotateNavigationEntries(profile_)) | 652 if (!ShouldAnnotateNavigationEntries(profile_)) |
627 return; | 653 return; |
628 | 654 |
629 content::NavigationEntry* entry = | 655 content::NavigationEntry* entry = |
630 web_contents()->GetController().GetLastCommittedEntry(); | 656 web_contents()->GetController().GetLastCommittedEntry(); |
631 if (!entry) | 657 if (!entry) |
632 return; | 658 return; |
633 | 659 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
676 // static | 702 // static |
677 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { | 703 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
678 std::string scheme = url.scheme(); | 704 std::string scheme = url.scheme(); |
679 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 705 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
680 scheme) && | 706 scheme) && |
681 #if BUILDFLAG(ENABLE_EXTENSIONS) | 707 #if BUILDFLAG(ENABLE_EXTENSIONS) |
682 scheme != extensions::kExtensionScheme && | 708 scheme != extensions::kExtensionScheme && |
683 #endif | 709 #endif |
684 scheme != content::kChromeDevToolsScheme); | 710 scheme != content::kChromeDevToolsScheme); |
685 } | 711 } |
OLD | NEW |