Skip to content

Commit 8dbb6e3

Browse files
committed
[Passwords] Record ManagePasswordsReferrer in UMA Histogram
This change adds a new UMA Histogram that logs the referrer of a navigation to the manage passwords page. Logging is added in both native and Web UI. [email protected] (cherry picked from commit 08d6267) Bug: 904821 Change-Id: I727b0ace112f407121868d79181f523efecab511 Reviewed-on: https://chromium-review.googlesource.com/c/1355604 Commit-Queue: Jan Wilken Dörrie <[email protected]> Reviewed-by: Vasilii Sukhanov <[email protected]> Reviewed-by: Steven Bennetts <[email protected]> Reviewed-by: Demetrios Papadopoulos <[email protected]> Reviewed-by: Ilya Sherman <[email protected]> Cr-Original-Commit-Position: refs/heads/master@{#613150} Reviewed-on: https://chromium-review.googlesource.com/c/1361706 Reviewed-by: Jan Wilken Dörrie <[email protected]> Cr-Commit-Position: refs/branch-heads/3626@{#62} Cr-Branched-From: d897fb1-refs/heads/master@{#612437}
1 parent b1255a7 commit 8dbb6e3

File tree

12 files changed

+95
-9
lines changed

12 files changed

+95
-9
lines changed

chrome/browser/extensions/api/passwords_private/passwords_private_api.cc

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,31 @@
99
#include "base/bind.h"
1010
#include "base/bind_helpers.h"
1111
#include "base/location.h"
12+
#include "base/metrics/histogram_macros.h"
1213
#include "base/threading/thread_task_runner_handle.h"
1314
#include "base/values.h"
1415
#include "chrome/browser/extensions/api/passwords_private/passwords_private_delegate_factory.h"
1516
#include "chrome/common/extensions/api/passwords_private.h"
17+
#include "components/password_manager/core/browser/manage_passwords_referrer.h"
1618
#include "content/public/browser/web_contents.h"
1719
#include "extensions/browser/extension_function_registry.h"
1820

1921
namespace extensions {
2022

23+
////////////////////////////////////////////////////////////////////////////////
24+
// PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction
25+
26+
PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction::
27+
~PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction() {}
28+
29+
ExtensionFunction::ResponseAction
30+
PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction::Run() {
31+
UMA_HISTOGRAM_ENUMERATION(
32+
"PasswordManager.ManagePasswordsReferrer",
33+
password_manager::ManagePasswordsReferrer::kChromeSettings);
34+
return RespondNow(NoArguments());
35+
}
36+
2137
////////////////////////////////////////////////////////////////////////////////
2238
// PasswordsPrivateRemoveSavedPasswordFunction
2339

chrome/browser/extensions/api/passwords_private/passwords_private_api.h

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,25 @@
1414

1515
namespace extensions {
1616

17+
class PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction
18+
: public UIThreadExtensionFunction {
19+
public:
20+
PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction() {}
21+
DECLARE_EXTENSION_FUNCTION(
22+
"passwordsPrivate.recordPasswordsPageAccessInSettings",
23+
PASSWORDSPRIVATE_RECORDPASSWORDSPAGEACCESSINSETTINGS);
24+
25+
protected:
26+
~PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction() override;
27+
28+
// ExtensionFunction overrides.
29+
ResponseAction Run() override;
30+
31+
private:
32+
DISALLOW_COPY_AND_ASSIGN(
33+
PasswordsPrivateRecordPasswordsPageAccessInSettingsFunction);
34+
};
35+
1736
class PasswordsPrivateRemoveSavedPasswordFunction :
1837
public UIThreadExtensionFunction {
1938
public:

chrome/browser/resources/settings/autofill_page/autofill_page.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ Polymer({
5959
* @private
6060
*/
6161
onPasswordsClick_: function() {
62+
PasswordManagerImpl.getInstance().recordPasswordsPageAccessInSettings();
6263
loadTimeData.getBoolean('navigateToGooglePasswordManager') ?
6364
settings.OpenWindowProxyImpl.getInstance().openURL(
6465
loadTimeData.getString('googlePasswordManagerUrl')) :

chrome/browser/resources/settings/autofill_page/password_manager_proxy.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ class PasswordManagerProxy {
3333
*/
3434
getSavedPasswordList(callback) {}
3535

36+
/**
37+
* Log that the Passwords page was accessed from the Chrome Settings WebUI.
38+
*/
39+
recordPasswordsPageAccessInSettings() {}
40+
3641
/**
3742
* Should remove the saved password and notify that the list has changed.
3843
* @param {number} id The id for the password entry being removed.
@@ -162,6 +167,11 @@ class PasswordManagerImpl {
162167
chrome.passwordsPrivate.getSavedPasswordList(callback);
163168
}
164169

170+
/** @override */
171+
recordPasswordsPageAccessInSettings() {
172+
chrome.passwordsPrivate.recordPasswordsPageAccessInSettings();
173+
}
174+
165175
/** @override */
166176
removeSavedPassword(id) {
167177
chrome.passwordsPrivate.removeSavedPassword(id);

chrome/browser/ui/passwords/manage_passwords_view_utils.cc

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <algorithm>
1010

1111
#include "base/feature_list.h"
12+
#include "base/metrics/histogram_macros.h"
1213
#include "base/strings/utf_string_conversions.h"
1314
#include "build/build_config.h"
1415
#include "chrome/browser/profiles/profile.h"
@@ -177,8 +178,8 @@ GURL GetGooglePasswordManagerURL(ManagePasswordsReferrer referrer) {
177178
return "password_context_menu";
178179
case ManagePasswordsReferrer::kPasswordDropdown:
179180
return "password_dropdown";
180-
case ManagePasswordsReferrer::kPasswordSaveConfirmation:
181-
return "password_save_confirmation";
181+
case ManagePasswordsReferrer::kPasswordGenerationConfirmation:
182+
return "password_generation_confirmation";
182183
case ManagePasswordsReferrer::kProfileChooser:
183184
return "profile_chooser";
184185
}
@@ -210,6 +211,8 @@ void NavigateToGooglePasswordManager(Profile* profile,
210211

211212
void NavigateToManagePasswordsPage(Browser* browser,
212213
ManagePasswordsReferrer referrer) {
214+
UMA_HISTOGRAM_ENUMERATION("PasswordManager.ManagePasswordsReferrer",
215+
referrer);
213216
if (ShouldManagePasswordsinGooglePasswordManager(browser->profile())) {
214217
NavigateToGooglePasswordManager(browser->profile(), referrer);
215218
} else {

chrome/browser/ui/views/passwords/password_save_confirmation_view.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ void PasswordSaveConfirmationView::StyledLabelLinkClicked(
4848
int event_flags) {
4949
DCHECK_EQ(range, model()->save_confirmation_link_range());
5050
model()->OnNavigateToPasswordManagerAccountDashboardLinkClicked(
51-
password_manager::ManagePasswordsReferrer::kPasswordSaveConfirmation);
51+
password_manager::ManagePasswordsReferrer::
52+
kPasswordGenerationConfirmation);
5253
CloseBubble();
5354
}
5455

chrome/common/extensions/api/passwords_private.idl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ namespace passwordsPrivate {
8484
callback EmptyCallback = void();
8585

8686
interface Functions {
87+
// Function that logs that the Passwords page was accessed from the Chrome
88+
// Settings WebUI.
89+
static void recordPasswordsPageAccessInSettings();
90+
8791
// Removes the saved password corresponding to |loginPair|. If no saved
8892
// password for this pair exists, this function is a no-op.
8993
//

components/password_manager/core/browser/manage_passwords_referrer.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,21 @@ namespace password_manager {
1111
// page.
1212
enum class ManagePasswordsReferrer {
1313
// Corresponds to Chrome's settings page.
14-
kChromeSettings,
14+
kChromeSettings = 0,
1515
// Corresponds to the manage passwords bubble when clicking the key icon.
16-
kManagePasswordsBubble,
16+
kManagePasswordsBubble = 1,
1717
// Corresponds to the context menu following a right click into a password
1818
// field.
19-
kPasswordContextMenu,
19+
kPasswordContextMenu = 2,
2020
// Corresponds to the password dropdown shown when clicking into a password
2121
// field.
22-
kPasswordDropdown,
22+
kPasswordDropdown = 3,
2323
// Corresponds to the bubble shown when clicking the key icon after a password
2424
// was generated.
25-
kPasswordSaveConfirmation,
25+
kPasswordGenerationConfirmation = 4,
2626
// Corresponds to the profile chooser next to the omnibar ("Autofill Home").
27-
kProfileChooser,
27+
kProfileChooser = 5,
28+
kMaxValue = kProfileChooser,
2829
};
2930

3031
} // namespace password_manager

extensions/browser/extension_function_histogram_value.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,8 @@ enum HistogramValue {
13571357
CRYPTOTOKENPRIVATE_CANPROXYTOWEBAUTHN = 1294,
13581358
INPUTMETHODPRIVATE_GETSETTING = 1295,
13591359
INPUTMETHODPRIVATE_SETSETTING = 1296,
1360+
FILEMANAGERPRIVATEINTERNAL_UNSHAREPATHWITHCROSTINI = 1297,
1361+
PASSWORDSPRIVATE_RECORDPASSWORDSPAGEACCESSINSETTINGS = 1298,
13601362
// Last entry: Add new entries above, then run:
13611363
// python tools/metrics/histograms/update_extension_histograms.py
13621364
ENUM_BOUNDARY

third_party/closure_compiler/externs/passwords_private.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,12 @@ chrome.passwordsPrivate.ExceptionEntry;
7878
*/
7979
chrome.passwordsPrivate.PasswordExportProgress;
8080

81+
/**
82+
* Function that logs that the Passwords page was accessed from the Chrome
83+
* Settings WebUI.
84+
*/
85+
chrome.passwordsPrivate.recordPasswordsPageAccessInSettings = function() {};
86+
8187
/**
8288
* Removes the saved password corresponding to |loginPair|. If no saved password
8389
* for this pair exists, this function is a no-op.

tools/metrics/histograms/enums.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17377,6 +17377,9 @@ Called by update_net_error_codes.py.-->
1737717377
<int value="1294" label="CRYPTOTOKENPRIVATE_CANPROXYTOWEBAUTHN"/>
1737817378
<int value="1295" label="INPUTMETHODPRIVATE_GETSETTING"/>
1737917379
<int value="1296" label="INPUTMETHODPRIVATE_SETSETTING"/>
17380+
<int value="1297" label="FILEMANAGERPRIVATEINTERNAL_UNSHAREPATHWITHCROSTINI"/>
17381+
<int value="1298"
17382+
label="PASSWORDSPRIVATE_RECORDPASSWORDSPAGEACCESSINSETTINGS"/>
1738017383
</enum>
1738117384

1738217385
<enum name="ExtensionIconState">
@@ -32226,6 +32229,15 @@ from previous Chrome versions.
3222632229
</int>
3222732230
</enum>
3222832231

32232+
<enum name="ManagePasswordsReferrer">
32233+
<int value="0" label="Chrome Settings"/>
32234+
<int value="1" label="Manage Passwords Bubble"/>
32235+
<int value="2" label="Password Context Manu"/>
32236+
<int value="3" label="Password Dropdown"/>
32237+
<int value="4" label="Password Generation Confirmation"/>
32238+
<int value="5" label="Profile Chooser"/>
32239+
</enum>
32240+
3222932241
<enum name="ManifestFetchResultType">
3223032242
<int value="0" label="Fetch succeeded"/>
3223132243
<int value="1" label="Fetch failed because of empty URL"/>

tools/metrics/histograms/histograms.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77632,6 +77632,17 @@ uploading your change for review.
7763277632
<summary>An error on LoginDatabase initialization.</summary>
7763377633
</histogram>
7763477634

77635+
<histogram name="PasswordManager.ManagePasswordsReferrer"
77636+
enum="ManagePasswordsReferrer">
77637+
<owner>[email protected]</owner>
77638+
<owner>[email protected]</owner>
77639+
<summary>
77640+
Referrer of a navigation to the &quot;Manage Passwords&quot; page. Recorded
77641+
when the user attempts to see their list of passwords, either via native or
77642+
Web UI.
77643+
</summary>
77644+
</histogram>
77645+
7763577646
<histogram name="PasswordManager.MediationOptional"
7763677647
enum="CredentialManagerGetResult">
7763777648
<owner>[email protected]</owner>

0 commit comments

Comments
 (0)