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") { ...@@ -544,7 +544,6 @@ android_library("chrome_java") {
"//chrome/browser:sharing_send_message_result_generated_enum", "//chrome/browser:sharing_send_message_result_generated_enum",
"//chrome/browser/notifications/scheduler/public:jni_enums", "//chrome/browser/notifications/scheduler/public:jni_enums",
"//chrome/browser/supervised_user/supervised_user_error_page:enums_srcjar", "//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/autofill_assistant/browser:autofill_assistant_enums_java",
"//components/browsing_data/core:browsing_data_utils_java", "//components/browsing_data/core:browsing_data_utils_java",
"//components/browsing_data/core:clear_browsing_data_tab_java", "//components/browsing_data/core:clear_browsing_data_tab_java",
......
...@@ -14,7 +14,6 @@ import androidx.annotation.IntDef; ...@@ -14,7 +14,6 @@ import androidx.annotation.IntDef;
import org.chromium.base.ContextUtils; import org.chromium.base.ContextUtils;
import org.chromium.base.IntentUtils; import org.chromium.base.IntentUtils;
import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.metrics.RecordHistogram;
import org.chromium.chrome.R; import org.chromium.chrome.R;
import org.chromium.chrome.browser.customtabs.CustomTabActivity; import org.chromium.chrome.browser.customtabs.CustomTabActivity;
import org.chromium.chrome.browser.firstrun.FirstRunStatus; import org.chromium.chrome.browser.firstrun.FirstRunStatus;
...@@ -73,18 +72,14 @@ public class AnnouncementNotificationManager { ...@@ -73,18 +72,14 @@ public class AnnouncementNotificationManager {
case IntentType.UNKNOWN: case IntentType.UNKNOWN:
break; break;
case IntentType.CLICK: case IntentType.CLICK:
recordHistogram(AnnouncementNotificationEvent.CLICK);
openUrl(context, url); openUrl(context, url);
break; break;
case IntentType.CLOSE: case IntentType.CLOSE:
recordHistogram(AnnouncementNotificationEvent.CLOSE);
break; break;
case IntentType.ACK: case IntentType.ACK:
recordHistogram(AnnouncementNotificationEvent.ACK);
close(); close();
break; break;
case IntentType.OPEN: case IntentType.OPEN:
recordHistogram(AnnouncementNotificationEvent.OPEN);
openUrl(context, url); openUrl(context, url);
close(); close();
break; break;
...@@ -118,11 +113,6 @@ public class AnnouncementNotificationManager { ...@@ -118,11 +113,6 @@ public class AnnouncementNotificationManager {
.cancel(ANNOUNCEMENT_NOTIFICATION_TAG, ANNOUNCEMENT_NOTIFICATION_ID); .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 @CalledByNative
private static void showNotification(String url) { private static void showNotification(String url) {
Context context = ContextUtils.getApplicationContext(); Context context = ContextUtils.getApplicationContext();
...@@ -157,8 +147,6 @@ public class AnnouncementNotificationManager { ...@@ -157,8 +147,6 @@ public class AnnouncementNotificationManager {
NotificationUmaTracker.getInstance().onNotificationShown( NotificationUmaTracker.getInstance().onNotificationShown(
NotificationUmaTracker.SystemNotificationType.ANNOUNCEMENT, NotificationUmaTracker.SystemNotificationType.ANNOUNCEMENT,
notification.getNotification()); notification.getNotification());
recordHistogram(AnnouncementNotificationEvent.SHOWN);
} }
@CalledByNative @CalledByNative
......
...@@ -8,8 +8,6 @@ if (is_android) { ...@@ -8,8 +8,6 @@ if (is_android) {
source_set("announcement_notification") { source_set("announcement_notification") {
sources = [ sources = [
"announcement_notification_metrics.cc",
"announcement_notification_metrics.h",
"announcement_notification_service.cc", "announcement_notification_service.cc",
"announcement_notification_service.h", "announcement_notification_service.h",
"announcement_notification_service_factory.cc", "announcement_notification_service_factory.cc",
...@@ -34,7 +32,6 @@ source_set("announcement_notification") { ...@@ -34,7 +32,6 @@ source_set("announcement_notification") {
"announcement_notification_delegate_android.cc", "announcement_notification_delegate_android.cc",
"announcement_notification_delegate_android.h", "announcement_notification_delegate_android.h",
] ]
deps += [ "//chrome/android:chrome_jni_headers" ]
} else { } else {
sources += [ sources += [
"announcement_notification_delegate.cc", "announcement_notification_delegate.cc",
...@@ -47,12 +44,6 @@ source_set("announcement_notification") { ...@@ -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") { source_set("unit_tests") {
testonly = true testonly = true
sources = [ "announcement_notification_service_unittest.cc" ] sources = [ "announcement_notification_service_unittest.cc" ]
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "chrome/browser/ui/browser_navigator.h" #include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_navigator_params.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_delegate.h"
#include "chrome/browser/updates/announcement_notification/announcement_notification_metrics.h"
namespace { namespace {
...@@ -26,7 +25,6 @@ AnnouncementNotificationHandler::~AnnouncementNotificationHandler() = default; ...@@ -26,7 +25,6 @@ AnnouncementNotificationHandler::~AnnouncementNotificationHandler() = default;
void AnnouncementNotificationHandler::OnShow( void AnnouncementNotificationHandler::OnShow(
Profile* profile, Profile* profile,
const std::string& notification_id) { const std::string& notification_id) {
RecordAnnouncementHistogram(AnnouncementNotificationEvent::kShown);
} }
void AnnouncementNotificationHandler::OnClose( void AnnouncementNotificationHandler::OnClose(
...@@ -35,7 +33,6 @@ void AnnouncementNotificationHandler::OnClose( ...@@ -35,7 +33,6 @@ void AnnouncementNotificationHandler::OnClose(
const std::string& notification_id, const std::string& notification_id,
bool by_user, bool by_user,
base::OnceClosure completed_closure) { base::OnceClosure completed_closure) {
RecordAnnouncementHistogram(AnnouncementNotificationEvent::kClose);
std::move(completed_closure).Run(); std::move(completed_closure).Run();
} }
...@@ -51,16 +48,12 @@ void AnnouncementNotificationHandler::OnClick( ...@@ -51,16 +48,12 @@ void AnnouncementNotificationHandler::OnClick(
// Open the announcement link when the user clicks the notification or clicks // Open the announcement link when the user clicks the notification or clicks
// the button to open. // the button to open.
if (button_index == kReviewButtonIndex || !action_index.has_value()) { if (button_index == kReviewButtonIndex || !action_index.has_value()) {
RecordAnnouncementHistogram(action_index.has_value()
? AnnouncementNotificationEvent::kOpen
: AnnouncementNotificationEvent::kClick);
OpenAnnouncement(profile); OpenAnnouncement(profile);
std::move(completed_closure).Run(); std::move(completed_closure).Run();
return; return;
} }
// Otherwise, close the notification. // Otherwise, close the notification.
RecordAnnouncementHistogram(AnnouncementNotificationEvent::kAck);
NotificationDisplayServiceFactory::GetInstance() NotificationDisplayServiceFactory::GetInstance()
->GetForProfile(profile) ->GetForProfile(profile)
->Close(NotificationHandler::Type::ANNOUNCEMENT, ->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 @@ ...@@ -14,7 +14,6 @@
#include "chrome/browser/profiles/profile_attributes_entry.h" #include "chrome/browser/profiles/profile_attributes_entry.h"
#include "chrome/browser/profiles/profile_attributes_storage.h" #include "chrome/browser/profiles/profile_attributes_storage.h"
#include "chrome/browser/profiles/profile_manager.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 "chrome/grit/generated_resources.h"
#include "components/pref_registry/pref_registry_syncable.h" #include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_service.h" #include "components/prefs/pref_service.h"
...@@ -90,8 +89,6 @@ class AnnouncementNotificationServiceImpl ...@@ -90,8 +89,6 @@ class AnnouncementNotificationServiceImpl
if (!IsFeatureEnabled()) if (!IsFeatureEnabled())
return; return;
RecordAnnouncementHistogram(AnnouncementNotificationEvent::kStart);
// No valid version Finch parameter. // No valid version Finch parameter.
if (!IsVersionValid(remote_version_)) if (!IsVersionValid(remote_version_))
return; return;
......
...@@ -53,6 +53,9 @@ reviews. Googlers can read more about this at go/gwsq-gerrit. ...@@ -53,6 +53,9 @@ reviews. Googlers can read more about this at go/gwsq-gerrit.
<histogram name="Notifications.Announcement.Events" <histogram name="Notifications.Announcement.Events"
enum="AnnouncementNotificationEvent" expires_after="2020-10-30"> enum="AnnouncementNotificationEvent" expires_after="2020-10-30">
<obsolete>
Deprecated as of 10/2020
</obsolete>
<owner>dtrainor@chromium.org</owner> <owner>dtrainor@chromium.org</owner>
<owner>xingliu@chromium.org</owner> <owner>xingliu@chromium.org</owner>
<summary> <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