Chromium Code Reviews| 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 // TODO(melandory): remove saving_and_filling_passwords_enabled_ check from | 211 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 212 // here once we decide to switch to new settings behavior for everyone. | 212 switches::kEnableAutomation)) { |
| 213 return *saving_and_filling_passwords_enabled_ && !IsOffTheRecord() && | 213 // Disable the password saving UI for automated tests. It obscures the |
| 214 IsFillingEnabledForCurrentPage(); | 214 // page, and there is no API to access (or dismiss) UI bubbles/infobars. |
|
samuong
2017/03/03 00:03:05
I didn't want to add the HasSwitch check to this v
vabr (Chromium)
2017/03/04 20:00:20
Adding the test for kEnableAutomation as a separat
samuong
2017/03/06 18:32:01
Done.
| |
| 215 return false; | |
| 216 } | |
| 217 if (!*saving_and_filling_passwords_enabled_) { | |
| 218 // TODO(melandory): remove saving_and_filling_passwords_enabled_ check from | |
| 219 // here once we decide to switch to new settings behavior for everyone. | |
| 220 return false; | |
| 221 } | |
| 222 if (IsOffTheRecord()) | |
| 223 return false; | |
| 224 return IsFillingEnabledForCurrentPage(); | |
| 215 } | 225 } |
| 216 | 226 |
| 217 bool ChromePasswordManagerClient::IsFillingEnabledForCurrentPage() const { | 227 bool ChromePasswordManagerClient::IsFillingEnabledForCurrentPage() const { |
| 218 return !DidLastPageLoadEncounterSSLErrors() && | 228 return !DidLastPageLoadEncounterSSLErrors() && |
| 219 IsPasswordManagementEnabledForCurrentPage(); | 229 IsPasswordManagementEnabledForCurrentPage(); |
| 220 } | 230 } |
| 221 | 231 |
| 222 bool ChromePasswordManagerClient::IsHSTSActiveForHost( | 232 bool ChromePasswordManagerClient::IsHSTSActiveForHost( |
| 223 const GURL& origin) const { | 233 const GURL& origin) const { |
| 224 if (!origin.is_valid()) | 234 if (!origin.is_valid()) |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 670 // static | 680 // static |
| 671 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { | 681 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
| 672 std::string scheme = url.scheme(); | 682 std::string scheme = url.scheme(); |
| 673 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 683 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
| 674 scheme) && | 684 scheme) && |
| 675 #if BUILDFLAG(ENABLE_EXTENSIONS) | 685 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 676 scheme != extensions::kExtensionScheme && | 686 scheme != extensions::kExtensionScheme && |
| 677 #endif | 687 #endif |
| 678 scheme != content::kChromeDevToolsScheme); | 688 scheme != content::kChromeDevToolsScheme); |
| 679 } | 689 } |
| OLD | NEW |