Commit ade30687 authored by Xing Liu's avatar Xing Liu Committed by Commit Bot

Announcement notification: Delete metric.

This CL obsoletes the following metric:
Notifications.Announcement.Events.

Bug: 1130635
Change-Id: Id5fd616571e3b3c59b9bed483aa02e2c97b4b2e8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2486031Reviewed-by: default avatarMark Pearson <mpearson@chromium.org>
Reviewed-by: default avatarTommy Nyquist <nyquist@chromium.org>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Reviewed-by: default avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Xing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#819649}
parent eb417d2b
......@@ -544,7 +544,6 @@ android_library("chrome_java") {
"//chrome/browser:sharing_send_message_result_generated_enum",
"//chrome/browser/notifications/scheduler/public:jni_enums",
"//chrome/browser/supervised_user/supervised_user_error_page:enums_srcjar",
"//chrome/browser/updates/announcement_notification:jni_enums",
"//components/autofill_assistant/browser:autofill_assistant_enums_java",
"//components/browsing_data/core:browsing_data_utils_java",
"//components/browsing_data/core:clear_browsing_data_tab_java",
......
......@@ -14,7 +14,6 @@ import androidx.annotation.IntDef;
import org.chromium.base.ContextUtils;
import org.chromium.base.IntentUtils;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.R;
import org.chromium.chrome.browser.customtabs.CustomTabActivity;
import org.chromium.chrome.browser.firstrun.FirstRunStatus;
......@@ -73,18 +72,14 @@ public class AnnouncementNotificationManager {
case IntentType.UNKNOWN:
break;
case IntentType.CLICK:
recordHistogram(AnnouncementNotificationEvent.CLICK);
openUrl(context, url);
break;
case IntentType.CLOSE:
recordHistogram(AnnouncementNotificationEvent.CLOSE);
break;
case IntentType.ACK:
recordHistogram(AnnouncementNotificationEvent.ACK);
close();
break;
case IntentType.OPEN:
recordHistogram(AnnouncementNotificationEvent.OPEN);
openUrl(context, url);
close();
break;
......@@ -118,11 +113,6 @@ public class AnnouncementNotificationManager {
.cancel(ANNOUNCEMENT_NOTIFICATION_TAG, ANNOUNCEMENT_NOTIFICATION_ID);
}
private static void recordHistogram(@AnnouncementNotificationEvent int event) {
RecordHistogram.recordEnumeratedHistogram("Notifications.Announcement.Events", event,
AnnouncementNotificationEvent.MAX_VALUE + 1);
}
@CalledByNative
private static void showNotification(String url) {
Context context = ContextUtils.getApplicationContext();
......@@ -157,8 +147,6 @@ public class AnnouncementNotificationManager {
NotificationUmaTracker.getInstance().onNotificationShown(
NotificationUmaTracker.SystemNotificationType.ANNOUNCEMENT,
notification.getNotification());
recordHistogram(AnnouncementNotificationEvent.SHOWN);
}
@CalledByNative
......
......@@ -8,8 +8,6 @@ if (is_android) {
source_set("announcement_notification") {
sources = [
"announcement_notification_metrics.cc",
"announcement_notification_metrics.h",
"announcement_notification_service.cc",
"announcement_notification_service.h",
"announcement_notification_service_factory.cc",
......@@ -34,7 +32,6 @@ source_set("announcement_notification") {
"announcement_notification_delegate_android.cc",
"announcement_notification_delegate_android.h",
]
deps += [ "//chrome/android:chrome_jni_headers" ]
} else {
sources += [
"announcement_notification_delegate.cc",
......@@ -47,12 +44,6 @@ source_set("announcement_notification") {
}
}
if (is_android) {
java_cpp_enum("jni_enums") {
sources = [ "announcement_notification_metrics.h" ]
}
}
source_set("unit_tests") {
testonly = true
sources = [ "announcement_notification_service_unittest.cc" ]
......
......@@ -11,7 +11,6 @@
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.h"
#include "chrome/browser/updates/announcement_notification/announcement_notification_delegate.h"
#include "chrome/browser/updates/announcement_notification/announcement_notification_metrics.h"
namespace {
......@@ -26,7 +25,6 @@ AnnouncementNotificationHandler::~AnnouncementNotificationHandler() = default;
void AnnouncementNotificationHandler::OnShow(
Profile* profile,
const std::string& notification_id) {
RecordAnnouncementHistogram(AnnouncementNotificationEvent::kShown);
}
void AnnouncementNotificationHandler::OnClose(
......@@ -35,7 +33,6 @@ void AnnouncementNotificationHandler::OnClose(
const std::string& notification_id,
bool by_user,
base::OnceClosure completed_closure) {
RecordAnnouncementHistogram(AnnouncementNotificationEvent::kClose);
std::move(completed_closure).Run();
}
......@@ -51,16 +48,12 @@ void AnnouncementNotificationHandler::OnClick(
// Open the announcement link when the user clicks the notification or clicks
// the button to open.
if (button_index == kReviewButtonIndex || !action_index.has_value()) {
RecordAnnouncementHistogram(action_index.has_value()
? AnnouncementNotificationEvent::kOpen
: AnnouncementNotificationEvent::kClick);
OpenAnnouncement(profile);
std::move(completed_closure).Run();
return;
}
// Otherwise, close the notification.
RecordAnnouncementHistogram(AnnouncementNotificationEvent::kAck);
NotificationDisplayServiceFactory::GetInstance()
->GetForProfile(profile)
->Close(NotificationHandler::Type::ANNOUNCEMENT,
......
// Copyright 2020 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.
#include "chrome/browser/updates/announcement_notification/announcement_notification_metrics.h"
#include "base/metrics/histogram_macros.h"
void RecordAnnouncementHistogram(AnnouncementNotificationEvent event) {
UMA_HISTOGRAM_ENUMERATION("Notifications.Announcement.Events", event);
}
// Copyright 2020 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 CHROME_BROWSER_UPDATES_ANNOUNCEMENT_NOTIFICATION_ANNOUNCEMENT_NOTIFICATION_METRICS_H_
#define CHROME_BROWSER_UPDATES_ANNOUNCEMENT_NOTIFICATION_ANNOUNCEMENT_NOTIFICATION_METRICS_H_
// Used to record histograms, must match AnnouncementNotificationEvent in
// enums.xml. Cannot reuse or delete values.
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: (
// org.chromium.chrome.browser.announcement)
enum class AnnouncementNotificationEvent {
// Starts to check whether to show announcement notification.
kStart = 0,
// Notification is shown.
kShown = 1,
// Notification is clicked.
kClick = 2,
// Notification is closed.
kClose = 3,
// The acknowledge button is clicked.
kAck = 4,
// The open button is clicked.
kOpen = 5,
kMaxValue = kOpen,
};
// Records announcement notification event.
void RecordAnnouncementHistogram(AnnouncementNotificationEvent event);
#endif // CHROME_BROWSER_UPDATES_ANNOUNCEMENT_NOTIFICATION_ANNOUNCEMENT_NOTIFICATION_METRICS_H_
......@@ -14,7 +14,6 @@
#include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/updates/announcement_notification/announcement_notification_metrics.h"
#include "chrome/grit/generated_resources.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h"
......@@ -90,8 +89,6 @@ class AnnouncementNotificationServiceImpl
if (!IsFeatureEnabled())
return;
RecordAnnouncementHistogram(AnnouncementNotificationEvent::kStart);
// No valid version Finch parameter.
if (!IsVersionValid(remote_version_))
return;
......
......@@ -53,6 +53,9 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<histogram name="Notifications.Announcement.Events"
enum="AnnouncementNotificationEvent" expires_after="2020-10-30">
<obsolete>
Deprecated as of 10/2020
</obsolete>
<owner>dtrainor@chromium.org</owner>
<owner>xingliu@chromium.org</owner>
<summary>
......
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