Skip to content

Commit 8e48a24

Browse files
ChristianXuGChromium LUCI CQ
authored and
Chromium LUCI CQ
committed
[iOS][Settings] Add metrics for Address Bar settings page
Add user action for the address bar settings page actions. - Page shown - Top address bar selected - Bottom address bar selected Bug: 1470688 Change-Id: I2c835f1d1f57c1b924412838647faf869ba8f7df Low-Coverage-Reason: UI with no existing coverage. Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4757059 Reviewed-by: Elly FJ <ellyjones@chromium.org> Reviewed-by: Gauthier Ambard <gambard@chromium.org> Commit-Queue: Christian Xu <christianxu@chromium.org> Auto-Submit: Christian Xu <christianxu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1182121}
1 parent 77dbd4d commit 8e48a24

File tree

5 files changed

+69
-1
lines changed

5 files changed

+69
-1
lines changed

ios/chrome/browser/ui/settings/address_bar_preference/address_bar_preference_view_controller.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@
66
#define IOS_CHROME_BROWSER_UI_SETTINGS_ADDRESS_BAR_PREFERENCE_ADDRESS_BAR_PREFERENCE_VIEW_CONTROLLER_H_
77

88
#import "ios/chrome/browser/ui/settings/address_bar_preference/address_bar_preference_consumer.h"
9+
#import "ios/chrome/browser/ui/settings/settings_controller_protocol.h"
910
#import "ios/chrome/browser/ui/settings/settings_root_table_view_controller.h"
1011

1112
@protocol AddressBarPreferenceServiceDelegate;
1213

1314
// This class is the view controller for the address bar preference setting.
1415
@interface AddressBarPreferenceViewController
15-
: SettingsRootTableViewController <AddressBarPreferenceConsumer>
16+
: SettingsRootTableViewController <AddressBarPreferenceConsumer,
17+
SettingsControllerProtocol>
1618

1719
@property(nonatomic, weak) id<AddressBarPreferenceServiceDelegate>
1820
prefServiceDelegate;

ios/chrome/browser/ui/settings/address_bar_preference/address_bar_preference_view_controller.mm

+11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#import "ios/chrome/browser/ui/settings/address_bar_preference/address_bar_preference_view_controller.h"
66

7+
#import "base/metrics/user_metrics.h"
78
#import "ios/chrome/browser/ui/settings/address_bar_preference/cells/address_bar_options_item.h"
89
#import "ios/chrome/grit/ios_strings.h"
910
#import "ui/base/l10n/l10n_util_mac.h"
@@ -67,4 +68,14 @@ - (void)setPreferenceForOmniboxAtBottom:(BOOL)omniboxAtBottom {
6768
}
6869
}
6970

71+
#pragma mark - SettingsControllerProtocol
72+
73+
- (void)reportDismissalUserAction {
74+
base::RecordAction(base::UserMetricsAction("Settings.AddressBar.Dismissed"));
75+
}
76+
77+
- (void)reportBackUserAction {
78+
base::RecordAction(base::UserMetricsAction("Settings.AddressBar.Back"));
79+
}
80+
7081
@end

ios/chrome/browser/ui/settings/address_bar_preference/cells/address_bar_options_item.mm

+11
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#import "ios/chrome/browser/ui/settings/address_bar_preference/cells/address_bar_options_item.h"
66

7+
#import "base/metrics/user_metrics.h"
78
#import "ios/chrome/browser/shared/ui/symbols/symbols.h"
89
#import "ios/chrome/browser/ui/settings/address_bar_preference/cells/address_bar_option_item_view.h"
910
#import "ios/chrome/browser/ui/settings/address_bar_preference/cells/address_bar_preference_service_delegate.h"
@@ -121,12 +122,22 @@ - (UIStackView*)addressBarPreferenceOptionsContent {
121122
// Notifies the address bar preference service to update the state to top
122123
// address bar.
123124
- (void)onSelectTopAddressBar {
125+
if (_topAddressBar.selected) {
126+
return;
127+
}
128+
base::RecordAction(
129+
base::UserMetricsAction("Settings.AddressBar.TopAddressBar"));
124130
[_addressBarpreferenceServiceDelegate didSelectTopAddressBarPreference];
125131
}
126132

127133
// Notifies the address bar preference service to update the state to bottom
128134
// address bar.
129135
- (void)onSelectBottomAddressBar {
136+
if (_bottomAddressBar.selected) {
137+
return;
138+
}
139+
base::RecordAction(
140+
base::UserMetricsAction("Settings.AddressBar.BottomAddressBar"));
130141
[_addressBarpreferenceServiceDelegate didSelectBottomAddressBarPreference];
131142
}
132143

ios/chrome/browser/ui/settings/settings_table_view_controller.mm

+1
Original file line numberDiff line numberDiff line change
@@ -1386,6 +1386,7 @@ - (void)tableView:(UITableView*)tableView
13861386
initWithBrowserState:_browserState];
13871387
break;
13881388
case SettingsItemTypeAddressBar:
1389+
base::RecordAction(base::UserMetricsAction("Settings.AddressBar.Opened"));
13891390
[self showAddressBarPreferenceSetting];
13901391
break;
13911392
case SettingsItemTypePasswords:

tools/metrics/actions/actions.xml

+43
Original file line numberDiff line numberDiff line change
@@ -29826,6 +29826,49 @@ should be able to be added at any place in this file.
2982629826
</description>
2982729827
</action>
2982829828

29829+
<action name="Settings.AddressBar.Back">
29830+
<owner>christianxu@chromium.org</owner>
29831+
<owner>gambard@chromium.org</owner>
29832+
<description>
29833+
Reported when user clicks the back button on the Address Bar Settings. iOS
29834+
only.
29835+
</description>
29836+
</action>
29837+
29838+
<action name="Settings.AddressBar.BottomAddressBar">
29839+
<owner>christianxu@chromium.org</owner>
29840+
<owner>gambard@chromium.org</owner>
29841+
<description>
29842+
Reported when user selects bottom address bar in Address Bar Settings. iOS
29843+
only.
29844+
</description>
29845+
</action>
29846+
29847+
<action name="Settings.AddressBar.Dismissed">
29848+
<owner>christianxu@chromium.org</owner>
29849+
<owner>gambard@chromium.org</owner>
29850+
<description>
29851+
Reported when user dismisses the Address Bar Settings. iOS only.
29852+
</description>
29853+
</action>
29854+
29855+
<action name="Settings.AddressBar.Opened">
29856+
<owner>christianxu@chromium.org</owner>
29857+
<owner>gambard@chromium.org</owner>
29858+
<description>
29859+
Reported when user navigates to Address Bar Settings. iOS only.
29860+
</description>
29861+
</action>
29862+
29863+
<action name="Settings.AddressBar.TopAddressBar">
29864+
<owner>christianxu@chromium.org</owner>
29865+
<owner>gambard@chromium.org</owner>
29866+
<description>
29867+
Reported when user selects top address bar in Address Bar Settings. iOS
29868+
only.
29869+
</description>
29870+
</action>
29871+
2982929872
<action name="Settings.Bandwidth">
2983029873
<owner>gambard@chromium.org</owner>
2983129874
<owner>sczs@chromium.org</owner>

0 commit comments

Comments
 (0)