Commit 42f02d90 authored by stkhapugin@chromium.org's avatar stkhapugin@chromium.org Committed by Commit Bot

[iOS] Record metric in the location bar share button.

Adds a histogram action recording on location bar share button tap. It
is the same histogram as for the share button in the toolbar.

Bug: 866449
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I89cef712fe6488619c88a35b5528924961d4835a
Reviewed-on: https://chromium-review.googlesource.com/1146727
Commit-Queue: Stepan Khapugin <stkhapugin@chromium.org>
Reviewed-by: default avatarGauthier Ambard <gambard@chromium.org>
Cr-Commit-Position: refs/heads/master@{#577167}
parent 5b2fbb09
......@@ -4,6 +4,7 @@
#import "ios/chrome/browser/ui/location_bar/location_bar_view_controller.h"
#include "base/metrics/user_metrics.h"
#include "components/strings/grit/components_strings.h"
#import "ios/chrome/browser/ui/commands/activity_service_commands.h"
#import "ios/chrome/browser/ui/commands/application_commands.h"
......@@ -348,6 +349,12 @@ typedef NS_ENUM(int, TrailingButtonState) {
action:@selector(sharePage)
forControlEvents:UIControlEventTouchUpInside];
// Add self as a target to collect the metrics.
[self.locationBarSteadyView.trailingButton
addTarget:self
action:@selector(shareButtonPressed)
forControlEvents:UIControlEventTouchUpInside];
[self.locationBarSteadyView.trailingButton
setImage:
[[UIImage imageNamed:@"location_bar_share"]
......@@ -395,6 +402,15 @@ typedef NS_ENUM(int, TrailingButtonState) {
[self.dispatcher startVoiceSearch];
}
// Called when the share button is pressed.
// The actual share dialog is opened by the dispatcher, only collect the metrics
// here.
- (void)shareButtonPressed {
base::RecordAction(base::UserMetricsAction("MobileToolbarShareMenu"));
}
#pragma mark - UIMenu
- (void)showLongPressMenu:(UILongPressGestureRecognizer*)sender {
if (sender.state == UIGestureRecognizerStateBegan) {
[self.locationBarSteadyView becomeFirstResponder];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment