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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 log_manager_.get()); | 201 log_manager_.get()); |
202 logger.LogBoolean( | 202 logger.LogBoolean( |
203 Logger::STRING_PASSWORD_MANAGEMENT_ENABLED_FOR_CURRENT_PAGE, | 203 Logger::STRING_PASSWORD_MANAGEMENT_ENABLED_FOR_CURRENT_PAGE, |
204 is_enabled); | 204 is_enabled); |
205 } | 205 } |
206 return is_enabled; | 206 return is_enabled; |
207 } | 207 } |
208 | 208 |
209 bool ChromePasswordManagerClient::IsSavingAndFillingEnabledForCurrentPage() | 209 bool ChromePasswordManagerClient::IsSavingAndFillingEnabledForCurrentPage() |
210 const { | 210 const { |
| 211 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 212 switches::kEnableAutomation)) { |
| 213 // Disable the password saving UI for automated tests. It obscures the |
| 214 // page, and there is no API to access (or dismiss) UI bubbles/infobars. |
| 215 return false; |
| 216 } |
211 // TODO(melandory): remove saving_and_filling_passwords_enabled_ check from | 217 // TODO(melandory): remove saving_and_filling_passwords_enabled_ check from |
212 // here once we decide to switch to new settings behavior for everyone. | 218 // here once we decide to switch to new settings behavior for everyone. |
213 return *saving_and_filling_passwords_enabled_ && !IsOffTheRecord() && | 219 return *saving_and_filling_passwords_enabled_ && !IsOffTheRecord() && |
214 IsFillingEnabledForCurrentPage(); | 220 IsFillingEnabledForCurrentPage(); |
215 } | 221 } |
216 | 222 |
217 bool ChromePasswordManagerClient::IsFillingEnabledForCurrentPage() const { | 223 bool ChromePasswordManagerClient::IsFillingEnabledForCurrentPage() const { |
218 return !DidLastPageLoadEncounterSSLErrors() && | 224 return !DidLastPageLoadEncounterSSLErrors() && |
219 IsPasswordManagementEnabledForCurrentPage(); | 225 IsPasswordManagementEnabledForCurrentPage(); |
220 } | 226 } |
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 // static | 676 // static |
671 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { | 677 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
672 std::string scheme = url.scheme(); | 678 std::string scheme = url.scheme(); |
673 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 679 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
674 scheme) && | 680 scheme) && |
675 #if BUILDFLAG(ENABLE_EXTENSIONS) | 681 #if BUILDFLAG(ENABLE_EXTENSIONS) |
676 scheme != extensions::kExtensionScheme && | 682 scheme != extensions::kExtensionScheme && |
677 #endif | 683 #endif |
678 scheme != content::kChromeDevToolsScheme); | 684 scheme != content::kChromeDevToolsScheme); |
679 } | 685 } |
OLD | NEW |