| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" | 81 #include "chrome/browser/password_manager/generated_password_saved_infobar_deleg
ate_android.h" |
| 82 #include "chrome/browser/password_manager/save_password_infobar_delegate_android
.h" | 82 #include "chrome/browser/password_manager/save_password_infobar_delegate_android
.h" |
| 83 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" | 83 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" |
| 84 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" | 84 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" |
| 85 #endif | 85 #endif |
| 86 | 86 |
| 87 #if BUILDFLAG(ENABLE_EXTENSIONS) | 87 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 88 #include "extensions/common/constants.h" | 88 #include "extensions/common/constants.h" |
| 89 #endif | 89 #endif |
| 90 | 90 |
| 91 #include "device/vr/features/features.h" |
| 92 #if BUILDFLAG(ENABLE_VR) |
| 93 #include "chrome/browser/android/vr_shell/vr_tab_helper.h" |
| 94 #endif // BUILDFLAG(ENABLE_VR) |
| 95 |
| 91 using password_manager::ContentPasswordManagerDriverFactory; | 96 using password_manager::ContentPasswordManagerDriverFactory; |
| 92 using password_manager::PasswordManagerInternalsService; | 97 using password_manager::PasswordManagerInternalsService; |
| 93 using sessions::SerializedNavigationEntry; | 98 using sessions::SerializedNavigationEntry; |
| 94 | 99 |
| 95 // Shorten the name to spare line breaks. The code provides enough context | 100 // Shorten the name to spare line breaks. The code provides enough context |
| 96 // already. | 101 // already. |
| 97 typedef autofill::SavePasswordProgressLogger Logger; | 102 typedef autofill::SavePasswordProgressLogger Logger; |
| 98 | 103 |
| 99 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); | 104 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); |
| 100 | 105 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 if (!entry) { | 207 if (!entry) { |
| 203 // TODO(gcasto): Determine if fix for crbug.com/388246 is relevant here. | 208 // TODO(gcasto): Determine if fix for crbug.com/388246 is relevant here. |
| 204 is_enabled = true; | 209 is_enabled = true; |
| 205 } else { | 210 } else { |
| 206 // Do not fill nor save password when a user is signing in for sync. This | 211 // Do not fill nor save password when a user is signing in for sync. This |
| 207 // is because users need to remember their password if they are syncing as | 212 // is because users need to remember their password if they are syncing as |
| 208 // this is effectively their master password. | 213 // this is effectively their master password. |
| 209 is_enabled = | 214 is_enabled = |
| 210 entry->GetURL().host_piece() != chrome::kChromeUIChromeSigninHost; | 215 entry->GetURL().host_piece() != chrome::kChromeUIChromeSigninHost; |
| 211 } | 216 } |
| 217 |
| 218 #if BUILDFLAG(ENABLE_VR) |
| 219 // The password manager is disabled while VR (virtual reality) is being used, |
| 220 // as the use of conventional UI elements might harm the user experience in |
| 221 // VR. |
| 222 is_enabled = is_enabled && !vr_shell::VrTabHelper::IsInVr(web_contents()); |
| 223 #endif // BUILDFLAG(ENABLE_VR) |
| 224 |
| 212 if (log_manager_->IsLoggingActive()) { | 225 if (log_manager_->IsLoggingActive()) { |
| 213 password_manager::BrowserSavePasswordProgressLogger logger( | 226 password_manager::BrowserSavePasswordProgressLogger logger( |
| 214 log_manager_.get()); | 227 log_manager_.get()); |
| 215 logger.LogBoolean( | 228 logger.LogBoolean( |
| 216 Logger::STRING_PASSWORD_MANAGEMENT_ENABLED_FOR_CURRENT_PAGE, | 229 Logger::STRING_PASSWORD_MANAGEMENT_ENABLED_FOR_CURRENT_PAGE, |
| 217 is_enabled); | 230 is_enabled); |
| 218 } | 231 } |
| 219 return is_enabled; | 232 return is_enabled; |
| 220 } | 233 } |
| 221 | 234 |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 // static | 753 // static |
| 741 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { | 754 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
| 742 std::string scheme = url.scheme(); | 755 std::string scheme = url.scheme(); |
| 743 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 756 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
| 744 scheme) && | 757 scheme) && |
| 745 #if BUILDFLAG(ENABLE_EXTENSIONS) | 758 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 746 scheme != extensions::kExtensionScheme && | 759 scheme != extensions::kExtensionScheme && |
| 747 #endif | 760 #endif |
| 748 scheme != content::kChromeDevToolsScheme); | 761 scheme != content::kChromeDevToolsScheme); |
| 749 } | 762 } |
| OLD | NEW |