Commit 9aac6f8a authored by edchin's avatar edchin Committed by Chromium LUCI CQ

[ios] Remove expired metric IOS.DragAndDrop.DragContent

This was originally created in Aug 2017 in this CL:
https://chromium-review.googlesource.com/603690

This metric is no longer being used and has already expired
9 months ago.

Per go/histogram-expiry-guidelines:
"If the histogram is not in use now,
but might be useful in the far future, remove it."

Change-Id: I6903617fcfaf8ca3d9c46433386d7ccca508105f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2580697
Auto-Submit: edchin <edchin@chromium.org>
Commit-Queue: Rohit Rao <rohitrao@chromium.org>
Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Reviewed-by: default avatarRohit Rao <rohitrao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#835326}
parent 0e3c4167
......@@ -6,7 +6,6 @@
#include "base/check.h"
#import "ios/chrome/browser/crash_report/crash_keys_helper.h"
#import "ios/chrome/browser/metrics/drag_and_drop_recorder.h"
#import "ios/chrome/browser/metrics/size_class_recorder.h"
#import "ios/chrome/browser/metrics/user_interface_style_recorder.h"
#import "ios/chrome/browser/ui/util/ui_util.h"
......@@ -20,7 +19,6 @@
UserInterfaceStyleRecorder* userInterfaceStyleRecorder API_AVAILABLE(
ios(13.0));
@property(nonatomic, strong) SizeClassRecorder* sizeClassRecorder;
@property(nonatomic, strong) DragAndDropRecorder* dragAndDropRecorder;
// Initializes the size class recorder. On iPad It starts tracking horizontal
// size class changes.
......@@ -39,7 +37,6 @@
// When not created via a nib, create the recorders immediately.
[self initializeSizeClassRecorder];
[self updateBreakpad];
_dragAndDropRecorder = [[DragAndDropRecorder alloc] initWithView:self];
if (@available(iOS 13, *)) {
_userInterfaceStyleRecorder = [[UserInterfaceStyleRecorder alloc]
initWithUserInterfaceStyle:self.traitCollection.userInterfaceStyle];
......
......@@ -180,8 +180,6 @@ source_set("metrics_browser_agent") {
source_set("metrics_internal") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"drag_and_drop_recorder.h",
"drag_and_drop_recorder.mm",
"first_user_action_recorder.cc",
"first_user_action_recorder.h",
"new_tab_page_uma.h",
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_METRICS_DRAG_AND_DROP_RECORDER_H_
#define IOS_CHROME_BROWSER_METRICS_DRAG_AND_DROP_RECORDER_H_
#import <UIKit/UIKit.h>
// Reports metrics for the drag and drop events on iOS 11+ for a given view.
// Should be attached to the top most UIWindow to not miss any event.
@interface DragAndDropRecorder : NSObject
// Default initializer. Does not retain |view|.
- (instancetype)initWithView:(UIView*)view NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
@end
#endif // IOS_CHROME_BROWSER_METRICS_DRAG_AND_DROP_RECORDER_H_
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/metrics/drag_and_drop_recorder.h"
#include "base/metrics/histogram_macros.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
// Reported metrics for the content of drag events.
enum DragContentForReporting {
UNKNOWN = 0,
IMAGE = 1,
URL = 2,
TEXT = 3,
COUNT
};
// Records metrics regarding the content of drag and drops.
void RecordDragAndDropContentHistogram(DragContentForReporting sample) {
// Wrapping the macro in a function because it expands to a lot of code and
// is called from multiple places.
UMA_HISTOGRAM_ENUMERATION("IOS.DragAndDrop.DragContent", sample,
DragContentForReporting::COUNT);
}
// Records the DragAndDrop.DragContent histogram for a given |dropSession|.
void RecordDragTypesForSession(id<UIDropSession> dropSession)
API_AVAILABLE(ios(11.0)) {
// Map keys must conform to the NSCopying protocol. Class doesn't declare
// that it does this, but Class does implement |copyWithZone:|, so the cast
// is safe.
static NSDictionary* classToSampleNameMap = @{
(id)[UIImage class] : @(DragContentForReporting::IMAGE),
(id)[NSURL class] : @(DragContentForReporting::URL),
(id)[NSString class] : @(DragContentForReporting::TEXT)
};
bool containsAKnownClass = false;
// Report a histogram for every item contained in |dropSession|.
for (Class klass in classToSampleNameMap) {
if ([dropSession canLoadObjectsOfClass:klass]) {
RecordDragAndDropContentHistogram(static_cast<DragContentForReporting>(
[classToSampleNameMap[klass] intValue]));
containsAKnownClass = true;
}
}
if (!containsAKnownClass) {
RecordDragAndDropContentHistogram(DragContentForReporting::UNKNOWN);
}
}
} // namespace
@interface DragAndDropRecorder ()<UIDropInteractionDelegate> {
// The currently active drop sessions.
NSHashTable* _dropSessions;
}
@end
@implementation DragAndDropRecorder
- (instancetype)initWithView:(UIView*)view {
self = [super init];
if (self) {
_dropSessions = [NSHashTable weakObjectsHashTable];
UIDropInteraction* dropInteraction =
[[UIDropInteraction alloc] initWithDelegate:self];
[view addInteraction:dropInteraction];
}
return self;
}
- (BOOL)dropInteraction:(UIDropInteraction*)interaction
canHandleSession:(id<UIDropSession>)session API_AVAILABLE(ios(11.0)) {
// |-dropInteraction:canHandleSession:| can be called multiple times for the
// same drop session.
// Maintain a set of weak references to these sessions to make sure metrics
// are recorded only once per drop session.
if (![_dropSessions containsObject:session]) {
[_dropSessions addObject:session];
RecordDragTypesForSession(session);
}
// Return "NO" as the goal of this UIDropInteractionDelegate is to report
// metrics and not intercept events.
return NO;
}
@end
......@@ -19605,6 +19605,9 @@ Called by update_document_policy_enum.py.-->
</enum>
<enum name="DragContent">
<obsolete>
Deprecated 12/2020.
</obsolete>
<int value="0" label="Unknown"/>
<int value="1" label="Image"/>
<int value="2" label="URL"/>
......@@ -281,6 +281,9 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<histogram name="IOS.DragAndDrop.DragContent" enum="DragContent"
expires_after="2020-03-01">
<obsolete>
Removed 12/2020 as it is no longer needed for analysis.
</obsolete>
<owner>jif@chromium.org</owner>
<summary>
The type of content that the user is dragging into Chrome. Because a drag
......
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