diff --git a/ios/chrome/browser/ui/settings/address_bar_preference/address_bar_preference_view_controller.h b/ios/chrome/browser/ui/settings/address_bar_preference/address_bar_preference_view_controller.h index 5227c18275c574..f0ccfd1b581992 100644 --- a/ios/chrome/browser/ui/settings/address_bar_preference/address_bar_preference_view_controller.h +++ b/ios/chrome/browser/ui/settings/address_bar_preference/address_bar_preference_view_controller.h @@ -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 + : SettingsRootTableViewController @property(nonatomic, weak) id prefServiceDelegate; diff --git a/ios/chrome/browser/ui/settings/address_bar_preference/address_bar_preference_view_controller.mm b/ios/chrome/browser/ui/settings/address_bar_preference/address_bar_preference_view_controller.mm index 0b9f8177cda22b..64d63ede0a9eb1 100644 --- a/ios/chrome/browser/ui/settings/address_bar_preference/address_bar_preference_view_controller.mm +++ b/ios/chrome/browser/ui/settings/address_bar_preference/address_bar_preference_view_controller.mm @@ -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" @@ -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 diff --git a/ios/chrome/browser/ui/settings/address_bar_preference/cells/address_bar_options_item.mm b/ios/chrome/browser/ui/settings/address_bar_preference/cells/address_bar_options_item.mm index 153a54e6068a00..6b9b25bdf8c15b 100644 --- a/ios/chrome/browser/ui/settings/address_bar_preference/cells/address_bar_options_item.mm +++ b/ios/chrome/browser/ui/settings/address_bar_preference/cells/address_bar_options_item.mm @@ -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" @@ -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]; } diff --git a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm index d4d65f136916cf..b57f01a711987e 100644 --- a/ios/chrome/browser/ui/settings/settings_table_view_controller.mm +++ b/ios/chrome/browser/ui/settings/settings_table_view_controller.mm @@ -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: diff --git a/tools/metrics/actions/actions.xml b/tools/metrics/actions/actions.xml index 14271c542c1a8e..c291fc84331b66 100644 --- a/tools/metrics/actions/actions.xml +++ b/tools/metrics/actions/actions.xml @@ -29790,6 +29790,49 @@ should be able to be added at any place in this file. + + christianxu@chromium.org + gambard@chromium.org + + Reported when user clicks the back button on the Address Bar Settings. iOS + only. + + + + + christianxu@chromium.org + gambard@chromium.org + + Reported when user selects bottom address bar in Address Bar Settings. iOS + only. + + + + + christianxu@chromium.org + gambard@chromium.org + + Reported when user dismisses the Address Bar Settings. iOS only. + + + + + christianxu@chromium.org + gambard@chromium.org + + Reported when user navigates to Address Bar Settings. iOS only. + + + + + christianxu@chromium.org + gambard@chromium.org + + Reported when user selects top address bar in Address Bar Settings. iOS + only. + + + gambard@chromium.org sczs@chromium.org