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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 browser_sync::ProfileSyncService* profile_sync_service = | 628 browser_sync::ProfileSyncService* profile_sync_service = |
614 ProfileSyncServiceFactory::GetForProfile(profile); | 629 ProfileSyncServiceFactory::GetForProfile(profile); |
615 if (!profile_sync_service || !profile_sync_service->IsSyncActive() || | 630 if (!profile_sync_service || !profile_sync_service->IsSyncActive() || |
616 profile_sync_service->IsUsingSecondaryPassphrase()) { | 631 profile_sync_service->IsUsingSecondaryPassphrase()) { |
617 return false; | 632 return false; |
618 } | 633 } |
619 | 634 |
620 return true; | 635 return true; |
621 } | 636 } |
622 | 637 |
| 638 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) |
| 639 bool ChromePasswordManagerClient::CanSetPasswordProtectionService() { |
| 640 return g_browser_process && g_browser_process->safe_browsing_service() && |
| 641 g_browser_process->safe_browsing_service() |
| 642 ->password_protection_service(); |
| 643 } |
| 644 #endif |
| 645 |
623 void ChromePasswordManagerClient::AnnotateNavigationEntry( | 646 void ChromePasswordManagerClient::AnnotateNavigationEntry( |
624 bool has_password_field) { | 647 bool has_password_field) { |
625 if (!ShouldAnnotateNavigationEntries(profile_)) | 648 if (!ShouldAnnotateNavigationEntries(profile_)) |
626 return; | 649 return; |
627 | 650 |
628 content::NavigationEntry* entry = | 651 content::NavigationEntry* entry = |
629 web_contents()->GetController().GetLastCommittedEntry(); | 652 web_contents()->GetController().GetLastCommittedEntry(); |
630 if (!entry) | 653 if (!entry) |
631 return; | 654 return; |
632 | 655 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 // static | 698 // static |
676 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { | 699 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
677 std::string scheme = url.scheme(); | 700 std::string scheme = url.scheme(); |
678 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 701 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
679 scheme) && | 702 scheme) && |
680 #if BUILDFLAG(ENABLE_EXTENSIONS) | 703 #if BUILDFLAG(ENABLE_EXTENSIONS) |
681 scheme != extensions::kExtensionScheme && | 704 scheme != extensions::kExtensionScheme && |
682 #endif | 705 #endif |
683 scheme != content::kChromeDevToolsScheme); | 706 scheme != content::kChromeDevToolsScheme); |
684 } | 707 } |
OLD | NEW |