| 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" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
| 14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
| 15 #include "base/memory/singleton.h" | 15 #include "base/memory/singleton.h" |
| 16 #include "base/metrics/field_trial.h" | 16 #include "base/metrics/field_trial.h" |
| 17 #include "base/metrics/histogram_macros.h" | 17 #include "base/metrics/histogram_macros.h" |
| 18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
| 19 #include "chrome/browser/browser_process.h" | 19 #include "chrome/browser/browser_process.h" |
| 20 #include "chrome/browser/browsing_data/browsing_data_helper.h" | 20 #include "chrome/browser/browsing_data/browsing_data_helper.h" |
| 21 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" | 21 #include "chrome/browser/metrics/chrome_metrics_service_accessor.h" |
| 22 #include "chrome/browser/password_manager/password_store_factory.h" | 22 #include "chrome/browser/password_manager/password_store_factory.h" |
| 23 #include "chrome/browser/prerender/prerender_contents.h" | 23 #include "chrome/browser/prerender/prerender_contents.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/signin/signin_manager_factory.h" | 25 #include "chrome/browser/signin/signin_manager_factory.h" |
| 26 #include "chrome/browser/sync/profile_sync_service_factory.h" | 26 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 27 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h
" | 27 #include "chrome/browser/ui/autofill/password_generation_popup_controller_impl.h
" |
| 28 #include "chrome/browser/ui/passwords/passwords_client_ui_delegate.h" | 28 #include "chrome/browser/ui/passwords/passwords_client_ui_delegate.h" |
| 29 #include "chrome/browser/vr/vr_tab_helper.h" |
| 29 #include "chrome/common/channel_info.h" | 30 #include "chrome/common/channel_info.h" |
| 30 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/common/url_constants.h" | 32 #include "chrome/common/url_constants.h" |
| 32 #include "components/autofill/content/browser/content_autofill_driver.h" | 33 #include "components/autofill/content/browser/content_autofill_driver.h" |
| 33 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | 34 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 34 #include "components/autofill/core/browser/password_generator.h" | 35 #include "components/autofill/core/browser/password_generator.h" |
| 35 #include "components/autofill/core/common/password_form.h" | 36 #include "components/autofill/core/common/password_form.h" |
| 36 #include "components/browser_sync/profile_sync_service.h" | 37 #include "components/browser_sync/profile_sync_service.h" |
| 37 #include "components/password_manager/content/browser/content_password_manager_d
river.h" | 38 #include "components/password_manager/content/browser/content_password_manager_d
river.h" |
| 38 #include "components/password_manager/content/browser/password_manager_internals
_service_factory.h" | 39 #include "components/password_manager/content/browser/password_manager_internals
_service_factory.h" |
| (...skipping 42 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" | 82 #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" | 83 #include "chrome/browser/password_manager/save_password_infobar_delegate_android
.h" |
| 83 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" | 84 #include "chrome/browser/password_manager/update_password_infobar_delegate_andro
id.h" |
| 84 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" | 85 #include "chrome/browser/ui/android/snackbars/auto_signin_prompt_controller.h" |
| 85 #endif | 86 #endif |
| 86 | 87 |
| 87 #if BUILDFLAG(ENABLE_EXTENSIONS) | 88 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 88 #include "extensions/common/constants.h" | 89 #include "extensions/common/constants.h" |
| 89 #endif | 90 #endif |
| 90 | 91 |
| 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 | |
| 96 using password_manager::ContentPasswordManagerDriverFactory; | 92 using password_manager::ContentPasswordManagerDriverFactory; |
| 97 using password_manager::PasswordManagerInternalsService; | 93 using password_manager::PasswordManagerInternalsService; |
| 98 using password_manager::PasswordManagerMetricsRecorder; | 94 using password_manager::PasswordManagerMetricsRecorder; |
| 99 using sessions::SerializedNavigationEntry; | 95 using sessions::SerializedNavigationEntry; |
| 100 | 96 |
| 101 // Shorten the name to spare line breaks. The code provides enough context | 97 // Shorten the name to spare line breaks. The code provides enough context |
| 102 // already. | 98 // already. |
| 103 typedef autofill::SavePasswordProgressLogger Logger; | 99 typedef autofill::SavePasswordProgressLogger Logger; |
| 104 | 100 |
| 105 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); | 101 DEFINE_WEB_CONTENTS_USER_DATA_KEY(ChromePasswordManagerClient); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 // TODO(gcasto): Determine if fix for crbug.com/388246 is relevant here. | 205 // TODO(gcasto): Determine if fix for crbug.com/388246 is relevant here. |
| 210 is_enabled = true; | 206 is_enabled = true; |
| 211 } else { | 207 } else { |
| 212 // Do not fill nor save password when a user is signing in for sync. This | 208 // Do not fill nor save password when a user is signing in for sync. This |
| 213 // is because users need to remember their password if they are syncing as | 209 // is because users need to remember their password if they are syncing as |
| 214 // this is effectively their master password. | 210 // this is effectively their master password. |
| 215 is_enabled = | 211 is_enabled = |
| 216 entry->GetURL().host_piece() != chrome::kChromeUIChromeSigninHost; | 212 entry->GetURL().host_piece() != chrome::kChromeUIChromeSigninHost; |
| 217 } | 213 } |
| 218 | 214 |
| 219 #if BUILDFLAG(ENABLE_VR) | |
| 220 // The password manager is disabled while VR (virtual reality) is being used, | 215 // The password manager is disabled while VR (virtual reality) is being used, |
| 221 // as the use of conventional UI elements might harm the user experience in | 216 // as the use of conventional UI elements might harm the user experience in |
| 222 // VR. | 217 // VR. |
| 223 is_enabled = is_enabled && !vr_shell::VrTabHelper::IsInVr(web_contents()); | 218 is_enabled = is_enabled && !vr::VrTabHelper::IsInVr(web_contents()); |
| 224 #endif // BUILDFLAG(ENABLE_VR) | |
| 225 | 219 |
| 226 if (log_manager_->IsLoggingActive()) { | 220 if (log_manager_->IsLoggingActive()) { |
| 227 password_manager::BrowserSavePasswordProgressLogger logger( | 221 password_manager::BrowserSavePasswordProgressLogger logger( |
| 228 log_manager_.get()); | 222 log_manager_.get()); |
| 229 logger.LogBoolean( | 223 logger.LogBoolean( |
| 230 Logger::STRING_PASSWORD_MANAGEMENT_ENABLED_FOR_CURRENT_PAGE, | 224 Logger::STRING_PASSWORD_MANAGEMENT_ENABLED_FOR_CURRENT_PAGE, |
| 231 is_enabled); | 225 is_enabled); |
| 232 } | 226 } |
| 233 return is_enabled; | 227 return is_enabled; |
| 234 } | 228 } |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 780 // static | 774 // static |
| 781 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { | 775 bool ChromePasswordManagerClient::CanShowBubbleOnURL(const GURL& url) { |
| 782 std::string scheme = url.scheme(); | 776 std::string scheme = url.scheme(); |
| 783 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( | 777 return (content::ChildProcessSecurityPolicy::GetInstance()->IsWebSafeScheme( |
| 784 scheme) && | 778 scheme) && |
| 785 #if BUILDFLAG(ENABLE_EXTENSIONS) | 779 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 786 scheme != extensions::kExtensionScheme && | 780 scheme != extensions::kExtensionScheme && |
| 787 #endif | 781 #endif |
| 788 scheme != content::kChromeDevToolsScheme); | 782 scheme != content::kChromeDevToolsScheme); |
| 789 } | 783 } |
| OLD | NEW |