diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc index a490e27cfeef7..bbed532663754 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_api.cc @@ -9,15 +9,31 @@ #include "base/bind.h" #include "base/bind_helpers.h" #include "base/location.h" +#include "base/metrics/histogram_macros.h" #include "base/threading/thread_task_runner_handle.h" #include "base/values.h" #include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.h" #include "chrome/common/extensions/api/passwords_private.h" +#include "components/password_manager/core/browser/manage_passwords_referrer.h" #include "content/public/browser/web_contents.h" #include "extensions/browser/extension_function_registry.h" namespace extensions { +//////////////////////////////////////////////////////////////////////////////// +// PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction + +PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction:: + ~PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction() {} + +ExtensionFunction::ResponseAction +PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction::Run() { + UMA_HISTOGRAM_ENUMERATION( + "PasswordManager.ManagePasswordsReferrer", + password_manager::ManagePasswordsReferrer::kChromeSettings); + return RespondNow(NoArguments()); +} + //////////////////////////////////////////////////////////////////////////////// // PasswordsPrivateRemoveSavedPasswordFunction diff --git a/chrome/browser/extensions/api/passwords_private/passwords_private_api.h b/chrome/browser/extensions/api/passwords_private/passwords_private_api.h index f541487c4f459..120a9967e7e21 100644 --- a/chrome/browser/extensions/api/passwords_private/passwords_private_api.h +++ b/chrome/browser/extensions/api/passwords_private/passwords_private_api.h @@ -14,6 +14,25 @@ namespace extensions { +class PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction + : public UIThreadExtensionFunction { + public: + PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction() {} + DECLARE_EXTENSION_FUNCTION( + "passwordsPrivate.recordPasswordsPageAccessInSettings", + PASSWORDSPRIVATE_RECORDPASSWORDSPAGEACCESSINSETTINGS); + + protected: + ~PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction() override; + + // ExtensionFunction overrides. + ResponseAction Run() override; + + private: + DISALLOW_COPY_AND_ASSIGN( + PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction); +}; + class PasswordsPrivateRemoveSavedPasswordFunction : public UIThreadExtensionFunction { public: diff --git a/chrome/browser/resources/settings/autofill_page/autofill_page.js b/chrome/browser/resources/settings/autofill_page/autofill_page.js index 8777ecac8addf..4e9c34370818e 100644 --- a/chrome/browser/resources/settings/autofill_page/autofill_page.js +++ b/chrome/browser/resources/settings/autofill_page/autofill_page.js @@ -59,6 +59,7 @@ Polymer({ * @private */ onPasswordsClick_: function() { + PasswordManagerImpl.getInstance().recordPasswordsPageAccessInSettings(); loadTimeData.getBoolean('navigateToGooglePasswordManager') ? settings.OpenWindowProxyImpl.getInstance().openURL( loadTimeData.getString('googlePasswordManagerUrl')) : diff --git a/chrome/browser/resources/settings/autofill_page/password_manager_proxy.js b/chrome/browser/resources/settings/autofill_page/password_manager_proxy.js index 6b108a23968e5..7c18929be5ee9 100644 --- a/chrome/browser/resources/settings/autofill_page/password_manager_proxy.js +++ b/chrome/browser/resources/settings/autofill_page/password_manager_proxy.js @@ -33,6 +33,11 @@ class PasswordManagerProxy { */ getSavedPasswordList(callback) {} + /** + * Log that the Passwords page was accessed from the Chrome Settings WebUI. + */ + recordPasswordsPageAccessInSettings() {} + /** * Should remove the saved password and notify that the list has changed. * @param {number} id The id for the password entry being removed. @@ -162,6 +167,11 @@ class PasswordManagerImpl { chrome.passwordsPrivate.getSavedPasswordList(callback); } + /** @override */ + recordPasswordsPageAccessInSettings() { + chrome.passwordsPrivate.recordPasswordsPageAccessInSettings(); + } + /** @override */ removeSavedPassword(id) { chrome.passwordsPrivate.removeSavedPassword(id); diff --git a/chrome/browser/ui/passwords/manage_passwords_view_utils.cc b/chrome/browser/ui/passwords/manage_passwords_view_utils.cc index 9ebd1d333677f..0a600f3da3162 100644 --- a/chrome/browser/ui/passwords/manage_passwords_view_utils.cc +++ b/chrome/browser/ui/passwords/manage_passwords_view_utils.cc @@ -9,6 +9,7 @@ #include #include "base/feature_list.h" +#include "base/metrics/histogram_macros.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/browser/profiles/profile.h" @@ -177,8 +178,8 @@ GURL GetGooglePasswordManagerURL(ManagePasswordsReferrer referrer) { return "password_context_menu"; case ManagePasswordsReferrer::kPasswordDropdown: return "password_dropdown"; - case ManagePasswordsReferrer::kPasswordSaveConfirmation: - return "password_save_confirmation"; + case ManagePasswordsReferrer::kPasswordGenerationConfirmation: + return "password_generation_confirmation"; case ManagePasswordsReferrer::kProfileChooser: return "profile_chooser"; } @@ -210,6 +211,8 @@ void NavigateToGooglePasswordManager(Profile* profile, void NavigateToManagePasswordsPage(Browser* browser, ManagePasswordsReferrer referrer) { + UMA_HISTOGRAM_ENUMERATION("PasswordManager.ManagePasswordsReferrer", + referrer); if (ShouldManagePasswordsinGooglePasswordManager(browser->profile())) { NavigateToGooglePasswordManager(browser->profile(), referrer); } else { diff --git a/chrome/browser/ui/views/passwords/password_save_confirmation_view.cc b/chrome/browser/ui/views/passwords/password_save_confirmation_view.cc index d35bcd34a42a8..e319957d538cc 100644 --- a/chrome/browser/ui/views/passwords/password_save_confirmation_view.cc +++ b/chrome/browser/ui/views/passwords/password_save_confirmation_view.cc @@ -48,7 +48,8 @@ void PasswordSaveConfirmationView::StyledLabelLinkClicked( int event_flags) { DCHECK_EQ(range, model()->save_confirmation_link_range()); model()->OnNavigateToPasswordManagerAccountDashboardLinkClicked( - password_manager::ManagePasswordsReferrer::kPasswordSaveConfirmation); + password_manager::ManagePasswordsReferrer:: + kPasswordGenerationConfirmation); CloseBubble(); } diff --git a/chrome/common/extensions/api/passwords_private.idl b/chrome/common/extensions/api/passwords_private.idl index a8e1085e53c1d..716d95a658f00 100644 --- a/chrome/common/extensions/api/passwords_private.idl +++ b/chrome/common/extensions/api/passwords_private.idl @@ -84,6 +84,10 @@ namespace passwordsPrivate { callback EmptyCallback = void(); interface Functions { + // Function that logs that the Passwords page was accessed from the Chrome + // Settings WebUI. + static void recordPasswordsPageAccessInSettings(); + // Removes the saved password corresponding to |loginPair|. If no saved // password for this pair exists, this function is a no-op. // diff --git a/components/password_manager/core/browser/manage_passwords_referrer.h b/components/password_manager/core/browser/manage_passwords_referrer.h index c4fbad5031897..7ab3edfc90663 100644 --- a/components/password_manager/core/browser/manage_passwords_referrer.h +++ b/components/password_manager/core/browser/manage_passwords_referrer.h @@ -11,20 +11,21 @@ namespace password_manager { // page. enum class ManagePasswordsReferrer { // Corresponds to Chrome's settings page. - kChromeSettings, + kChromeSettings = 0, // Corresponds to the manage passwords bubble when clicking the key icon. - kManagePasswordsBubble, + kManagePasswordsBubble = 1, // Corresponds to the context menu following a right click into a password // field. - kPasswordContextMenu, + kPasswordContextMenu = 2, // Corresponds to the password dropdown shown when clicking into a password // field. - kPasswordDropdown, + kPasswordDropdown = 3, // Corresponds to the bubble shown when clicking the key icon after a password // was generated. - kPasswordSaveConfirmation, + kPasswordGenerationConfirmation = 4, // Corresponds to the profile chooser next to the omnibar ("Autofill Home"). - kProfileChooser, + kProfileChooser = 5, + kMaxValue = kProfileChooser, }; } // namespace password_manager diff --git a/extensions/browser/extension_function_histogram_value.h b/extensions/browser/extension_function_histogram_value.h index d6caba79d0c41..541dace81d2c2 100644 --- a/extensions/browser/extension_function_histogram_value.h +++ b/extensions/browser/extension_function_histogram_value.h @@ -1357,6 +1357,8 @@ enum HistogramValue { CRYPTOTOKENPRIVATE_CANPROXYTOWEBAUTHN = 1294, INPUTMETHODPRIVATE_GETSETTING = 1295, INPUTMETHODPRIVATE_SETSETTING = 1296, + FILEMANAGERPRIVATEINTERNAL_UNSHAREPATHWITHCROSTINI = 1297, + PASSWORDSPRIVATE_RECORDPASSWORDSPAGEACCESSINSETTINGS = 1298, // Last entry: Add new entries above, then run: // python tools/metrics/histograms/update_extension_histograms.py ENUM_BOUNDARY diff --git a/third_party/closure_compiler/externs/passwords_private.js b/third_party/closure_compiler/externs/passwords_private.js index bbbbb003ba12e..72059978de254 100644 --- a/third_party/closure_compiler/externs/passwords_private.js +++ b/third_party/closure_compiler/externs/passwords_private.js @@ -78,6 +78,12 @@ chrome.passwordsPrivate.ExceptionEntry; */ chrome.passwordsPrivate.PasswordExportProgress; +/** + * Function that logs that the Passwords page was accessed from the Chrome + * Settings WebUI. + */ +chrome.passwordsPrivate.recordPasswordsPageAccessInSettings = function() {}; + /** * Removes the saved password corresponding to |loginPair|. If no saved password * for this pair exists, this function is a no-op. diff --git a/tools/metrics/histograms/enums.xml b/tools/metrics/histograms/enums.xml index 1abd8f248b131..1a4a1ede3dfde 100644 --- a/tools/metrics/histograms/enums.xml +++ b/tools/metrics/histograms/enums.xml @@ -17377,6 +17377,9 @@ Called by update_net_error_codes.py.--> + + @@ -32226,6 +32229,15 @@ from previous Chrome versions. + + + + + + + + + diff --git a/tools/metrics/histograms/histograms.xml b/tools/metrics/histograms/histograms.xml index 2c6a1a178aede..e14bd990aea6f 100644 --- a/tools/metrics/histograms/histograms.xml +++ b/tools/metrics/histograms/histograms.xml @@ -77632,6 +77632,17 @@ uploading your change for review. An error on LoginDatabase initialization. + + jdoerrie@chromium.org + vasilii@chromium.org + + Referrer of a navigation to the "Manage Passwords" page. Recorded + when the user attempts to see their list of passwords, either via native or + Web UI. + + + jdoerrie@chromium.org