Skip to content

Commit

Permalink
pciguard: Add metric for data access protection toggle
Browse files Browse the repository at this point in the history
Tracks an boolean histogram of whenever the user toggles the
"Data Access Protection" toggle in ChromeOS Settings Privacy page.

(cherry picked from commit 30812b0)

Bug: 1184050
Test: local
Change-Id: I66de1aae26ca8d086192cce2a71e63a0ace00b81
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2733744
Commit-Queue: Jimmy Gong <jimmyxgong@chromium.org>
Reviewed-by: Kyle Horimoto <khorimoto@chromium.org>
Reviewed-by: Regan Hsu <hsuregan@chromium.org>
Reviewed-by: Weilun Shi <sweilun@chromium.org>
Cr-Original-Commit-Position: refs/heads/master@{#860022}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2743639
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/4430@{#263}
Cr-Branched-From: e5ce7dc-refs/heads/master@{#857950}
  • Loading branch information
Jimmy Gong authored and Chromium LUCI CQ committed Mar 9, 2021
1 parent a8831db commit 1138fc2
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
value: {intValue: /** @type {number} */ (prefValue)}
};

// os_privacy_page/os_privacy_page.js
case 'cros.device.peripheral_data_access_enabled':
return {
setting:
chromeos.settings.mojom.Setting.kPeripheralDataAccessProtection,
value: {boolValue: /** @type {boolean} */ (prefValue)}
};

// pref to setting metric not implemented.
default:
return null;
Expand Down
12 changes: 10 additions & 2 deletions chrome/browser/ui/webui/settings/chromeos/privacy_section.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

#include "ash/constants/ash_features.h"
#include "base/feature_list.h"
#include "base/metrics/histogram_functions.h"
#include "base/no_destructor.h"
#include "build/branding_buildflags.h"
#include "chrome/browser/ash/login/quick_unlock/quick_unlock_utils.h"
Expand Down Expand Up @@ -276,8 +277,15 @@ std::string PrivacySection::GetSectionPath() const {

bool PrivacySection::LogMetric(mojom::Setting setting,
base::Value& value) const {
// Unimplemented.
return false;
switch (setting) {
case mojom::Setting::kPeripheralDataAccessProtection:
base::UmaHistogramBoolean(
"ChromeOS.Settings.Privacy.PeripheralDataAccessProtection",
value.GetBool());
return true;
default:
return false;
}
}

void PrivacySection::RegisterHierarchy(HierarchyGenerator* generator) const {
Expand Down
11 changes: 11 additions & 0 deletions tools/metrics/histograms/histograms_xml/chromeos/histograms.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1066,6 +1066,17 @@ incoming reviews. Googlers can read more about this at go/gwsq-gerrit.
</summary>
</histogram>

<histogram name="ChromeOS.Settings.Privacy.PeripheralDataAccessProtection"
enum="BooleanEnabled" expires_after="2021-11-30">
<owner>jimmyxgong@chromium.org</owner>
<owner>cros-peripherals@google.com</owner>
<summary>
Records when the users clicks on the Peripheral Data Access toggle. A true
value refers to the user enables peripheral data access protection (toggle
is turned on).
</summary>
</histogram>

<histogram name="ChromeOS.Settings.SearchLatency" units="ms"
expires_after="2021-10-01">
<owner>khorimoto@chromium.org</owner>
Expand Down

0 comments on commit 1138fc2

Please sign in to comment.