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 | |
73 #if defined(OS_ANDROID) | 67 #if defined(OS_ANDROID) |
74 #include "chrome/browser/android/tab_android.h" | 68 #include "chrome/browser/android/tab_android.h" |
75 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" | 69 #include "chrome/browser/password_manager/account_chooser_dialog_android.h" |
76 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h
" | 70 #include "chrome/browser/password_manager/auto_signin_first_run_dialog_android.h
" |
77 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" | 71 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" |
78 #include "chrome/browser/password_manager/save_password_infobar_delegate_android
.h" | 72 #include "chrome/browser/password_manager/save_password_infobar_delegate_android
.h" |
79 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" | 73 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" |
80 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" | 74 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" |
81 #endif | 75 #endif |
82 | 76 |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 password_manager::PasswordManagerInternalsServiceFactory:: | 169 password_manager::PasswordManagerInternalsServiceFactory:: |
176 GetForBrowserContext(profile_), | 170 GetForBrowserContext(profile_), |
177 base::Bind( | 171 base::Bind( |
178 &ContentPasswordManagerDriverFactory::RequestSendLoggingAvailability, | 172 &ContentPasswordManagerDriverFactory::RequestSendLoggingAvailability, |
179 base::Unretained(driver_factory_))); | 173 base::Unretained(driver_factory_))); |
180 | 174 |
181 saving_and_filling_passwords_enabled_.Init( | 175 saving_and_filling_passwords_enabled_.Init( |
182 password_manager::prefs::kCredentialsEnableService, GetPrefs()); | 176 password_manager::prefs::kCredentialsEnableService, GetPrefs()); |
183 ReportMetrics(*saving_and_filling_passwords_enabled_, this, profile_); | 177 ReportMetrics(*saving_and_filling_passwords_enabled_, this, profile_); |
184 driver_factory_->RequestSendLoggingAvailability(); | 178 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 | |
194 } | 179 } |
195 | 180 |
196 ChromePasswordManagerClient::~ChromePasswordManagerClient() {} | 181 ChromePasswordManagerClient::~ChromePasswordManagerClient() {} |
197 | 182 |
198 bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage() | 183 bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage() |
199 const { | 184 const { |
200 DCHECK(web_contents()); | 185 DCHECK(web_contents()); |
201 content::NavigationEntry* entry = | 186 content::NavigationEntry* entry = |
202 web_contents()->GetController().GetLastCommittedEntry(); | 187 web_contents()->GetController().GetLastCommittedEntry(); |
203 bool is_enabled = false; | 188 bool is_enabled = false; |
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 browser_sync::ProfileSyncService* profile_sync_service = | 614 browser_sync::ProfileSyncService* profile_sync_service = |
630 ProfileSyncServiceFactory::GetForProfile(profile); | 615 ProfileSyncServiceFactory::GetForProfile(profile); |
631 if (!profile_sync_service || !profile_sync_service->IsSyncActive() || | 616 if (!profile_sync_service || !profile_sync_service->IsSyncActive() || |
632 profile_sync_service->IsUsingSecondaryPassphrase()) { | 617 profile_sync_service->IsUsingSecondaryPassphrase()) { |
633 return false; | 618 return false; |
634 } | 619 } |
635 | 620 |
636 return true; | 621 return true; |
637 } | 622 } |
638 | 623 |
639 #if defined(SAFE_BROWSING_DB_LOCAL) || defined(SAFE_BROWSING_DB_REMOTE) | |
640 bool ChromePasswordManagerClient::CanSetPasswordProtectionService() { | |
641 return g_browser_process && g_browser_process->safe_browsing_service() && | |
642 g_browser_process->safe_browsing_service() | |
643 ->password_protection_service(); | |
644 } | |
645 #endif | |
646 | |
647 void ChromePasswordManagerClient::AnnotateNavigationEntry( | 624 void ChromePasswordManagerClient::AnnotateNavigationEntry( |
648 bool has_password_field) { | 625 bool has_password_field) { |
649 if (!ShouldAnnotateNavigationEntries(profile_)) | 626 if (!ShouldAnnotateNavigationEntries(profile_)) |
650 return; | 627 return; |
651 | 628 |
652 content::NavigationEntry* entry = | 629 content::NavigationEntry* entry = |
653 web_contents()->GetController().GetLastCommittedEntry(); | 630 web_contents()->GetController().GetLastCommittedEntry(); |
654 if (!entry) | 631 if (!entry) |
655 return; | 632 return; |
656 | 633 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 // static | 676 // static |
700 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { | 677 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
701 std::string scheme = url.scheme(); | 678 std::string scheme = url.scheme(); |
702 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 679 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
703 scheme) && | 680 scheme) && |
704 #if BUILDFLAG(ENABLE_EXTENSIONS) | 681 #if BUILDFLAG(ENABLE_EXTENSIONS) |
705 scheme != extensions::kExtensionScheme && | 682 scheme != extensions::kExtensionScheme && |
706 #endif | 683 #endif |
707 scheme != content::kChromeDevToolsScheme); | 684 scheme != content::kChromeDevToolsScheme); |
708 } | 685 } |
OLD | NEW |