Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[iOS] Fix the Activity Metrics provider filter.
Moved the Activity Bucket provider filter to a different directory, as well as registering the metrics provider. (cherry picked from commit 45a1e91) Bug: 1446085 Change-Id: Ic742f81c71dd367df2ce3c84cc37fc6fd8ce66cf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4601889 Reviewed-by: Sergio Collazos <sczs@chromium.org> Commit-Queue: Sergio Collazos <sczs@chromium.org> Auto-Submit: Guillem Perez <guiperez@google.com> Cr-Original-Commit-Position: refs/heads/main@{#1157857} Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4721947 Commit-Queue: Guillem Perez <guiperez@google.com> Cr-Commit-Position: refs/branch-heads/5790@{#1843} Cr-Branched-From: 1d71a33-refs/heads/main@{#1148114}
- Loading branch information
Guillem Perez
authored and
Chromium LUCI CQ
committed
Jul 26, 2023
1 parent
0ae27a0
commit 8ad26ff
Showing
11 changed files
with
69 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
ios/chrome/browser/metrics/ios_feed_activity_metrics_provider.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// 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_IOS_FEED_ACTIVITY_METRICS_PROVIDER_H_ | ||
#define IOS_CHROME_BROWSER_METRICS_IOS_FEED_ACTIVITY_METRICS_PROVIDER_H_ | ||
|
||
#include "components/metrics/metrics_provider.h" | ||
|
||
NSString* const kActivityBucketKey = @"FeedActivityBucket"; | ||
const char kAllFeedsActivityBucketsByProviderHistogram[] = | ||
"ContentSuggestions.Feed.AllFeeds.Activity.ByProvider"; | ||
|
||
class IOSFeedActivityMetricsProvider : public metrics::MetricsProvider { | ||
public: | ||
explicit IOSFeedActivityMetricsProvider(); | ||
IOSFeedActivityMetricsProvider(const IOSFeedActivityMetricsProvider&) = | ||
delete; | ||
IOSFeedActivityMetricsProvider& operator=( | ||
const IOSFeedActivityMetricsProvider&) = delete; | ||
|
||
~IOSFeedActivityMetricsProvider() override; | ||
|
||
// metrics::MetricsProvider | ||
void ProvideCurrentSessionData( | ||
metrics::ChromeUserMetricsExtension* uma_proto) override; | ||
}; | ||
|
||
#endif // IOS_CHROME_BROWSER_METRICS_IOS_FEED_ACTIVITY_METRICS_PROVIDER_H_ |
24 changes: 24 additions & 0 deletions
24
ios/chrome/browser/metrics/ios_feed_activity_metrics_provider.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// 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/ios_feed_activity_metrics_provider.h" | ||
#import "base/mac/foundation_util.h" | ||
#import "base/metrics/histogram_functions.h" | ||
|
||
#if !defined(__has_feature) || !__has_feature(objc_arc) | ||
#error "This file requires ARC support." | ||
#endif | ||
|
||
IOSFeedActivityMetricsProvider::IOSFeedActivityMetricsProvider() {} | ||
|
||
IOSFeedActivityMetricsProvider::~IOSFeedActivityMetricsProvider() {} | ||
|
||
void IOSFeedActivityMetricsProvider::ProvideCurrentSessionData( | ||
metrics::ChromeUserMetricsExtension* uma_proto) { | ||
// Retrieve activity bucket from storage. | ||
int activityBucket = (int)[[NSUserDefaults standardUserDefaults] | ||
integerForKey:kActivityBucketKey]; | ||
base::UmaHistogramExactLinear(kAllFeedsActivityBucketsByProviderHistogram, | ||
activityBucket, 4); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
25 changes: 0 additions & 25 deletions
25
ios/chrome/browser/ui/ntp/metrics/feed_metrics_provider.mm
This file was deleted.
Oops, something went wrong.