Skip to content

Commit

Permalink
[iOS][Settings][M117] Add metrics for Address Bar settings page
Browse files Browse the repository at this point in the history
Add user action for the address bar settings page actions.
- Page shown
- Top address bar selected
- Bottom address bar selected
- Back button tapped
- Page dismissed

(cherry picked from commit 8e48a24)

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-Original-Commit-Position: refs/heads/main@{#1182121}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4771482
Cr-Commit-Position: refs/branch-heads/5938@{#129}
Cr-Branched-From: 2b50cb4-refs/heads/main@{#1181205}
  • Loading branch information
ChristianXuG authored and Chromium LUCI CQ committed Aug 15, 2023
1 parent 86405c7 commit 8b2c54e
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
#define IOS_CHROME_BROWSER_UI_SETTINGS_ADDRESS_BAR_PREFERENCE_ADDRESS_BAR_PREFERENCE_VIEW_CONTROLLER_H_

#import "ios/chrome/browser/ui/settings/address_bar_preference/address_bar_preference_consumer.h"
#import "ios/chrome/browser/ui/settings/settings_controller_protocol.h"
#import "ios/chrome/browser/ui/settings/settings_root_table_view_controller.h"

@protocol AddressBarPreferenceServiceDelegate;

// This class is the view controller for the address bar preference setting.
@interface AddressBarPreferenceViewController
: SettingsRootTableViewController <AddressBarPreferenceConsumer>
: SettingsRootTableViewController <AddressBarPreferenceConsumer,
SettingsControllerProtocol>

@property(nonatomic, weak) id<AddressBarPreferenceServiceDelegate>
prefServiceDelegate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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

#import "base/metrics/user_metrics.h"
#import "ios/chrome/browser/ui/settings/address_bar_preference/cells/address_bar_options_item.h"
#import "ios/chrome/grit/ios_strings.h"
#import "ui/base/l10n/l10n_util_mac.h"
Expand Down Expand Up @@ -67,4 +68,14 @@ - (void)setPreferenceForOmniboxAtBottom:(BOOL)omniboxAtBottom {
}
}

#pragma mark - SettingsControllerProtocol

- (void)reportDismissalUserAction {
base::RecordAction(base::UserMetricsAction("Settings.AddressBar.Dismissed"));
}

- (void)reportBackUserAction {
base::RecordAction(base::UserMetricsAction("Settings.AddressBar.Back"));
}

@end
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

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

#import "base/metrics/user_metrics.h"
#import "ios/chrome/browser/shared/ui/symbols/symbols.h"
#import "ios/chrome/browser/ui/settings/address_bar_preference/cells/address_bar_option_item_view.h"
#import "ios/chrome/browser/ui/settings/address_bar_preference/cells/address_bar_preference_service_delegate.h"
Expand Down Expand Up @@ -121,12 +122,22 @@ - (UIStackView*)addressBarPreferenceOptionsContent {
// Notifies the address bar preference service to update the state to top
// address bar.
- (void)onSelectTopAddressBar {
if (_topAddressBar.selected) {
return;
}
base::RecordAction(
base::UserMetricsAction("Settings.AddressBar.TopAddressBar"));
[_addressBarpreferenceServiceDelegate didSelectTopAddressBarPreference];
}

// Notifies the address bar preference service to update the state to bottom
// address bar.
- (void)onSelectBottomAddressBar {
if (_bottomAddressBar.selected) {
return;
}
base::RecordAction(
base::UserMetricsAction("Settings.AddressBar.BottomAddressBar"));
[_addressBarpreferenceServiceDelegate didSelectBottomAddressBarPreference];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1386,6 +1386,7 @@ - (void)tableView:(UITableView*)tableView
initWithBrowserState:_browserState];
break;
case SettingsItemTypeAddressBar:
base::RecordAction(base::UserMetricsAction("Settings.AddressBar.Opened"));
[self showAddressBarPreferenceSetting];
break;
case SettingsItemTypePasswords:
Expand Down
43 changes: 43 additions & 0 deletions tools/metrics/actions/actions.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29790,6 +29790,49 @@ should be able to be added at any place in this file.
</description>
</action>

<action name="Settings.AddressBar.Back">
<owner>christianxu@chromium.org</owner>
<owner>gambard@chromium.org</owner>
<description>
Reported when user clicks the back button on the Address Bar Settings. iOS
only.
</description>
</action>

<action name="Settings.AddressBar.BottomAddressBar">
<owner>christianxu@chromium.org</owner>
<owner>gambard@chromium.org</owner>
<description>
Reported when user selects bottom address bar in Address Bar Settings. iOS
only.
</description>
</action>

<action name="Settings.AddressBar.Dismissed">
<owner>christianxu@chromium.org</owner>
<owner>gambard@chromium.org</owner>
<description>
Reported when user dismisses the Address Bar Settings. iOS only.
</description>
</action>

<action name="Settings.AddressBar.Opened">
<owner>christianxu@chromium.org</owner>
<owner>gambard@chromium.org</owner>
<description>
Reported when user navigates to Address Bar Settings. iOS only.
</description>
</action>

<action name="Settings.AddressBar.TopAddressBar">
<owner>christianxu@chromium.org</owner>
<owner>gambard@chromium.org</owner>
<description>
Reported when user selects top address bar in Address Bar Settings. iOS
only.
</description>
</action>

<action name="Settings.Bandwidth">
<owner>gambard@chromium.org</owner>
<owner>sczs@chromium.org</owner>
Expand Down

0 comments on commit 8b2c54e

Please sign in to comment.