Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4120)

Unified Diff: chrome/browser/notifications/message_center_notification_manager.cc

Issue 23636010: Notifications: Add cross-platform UMA: ShowMessageCenter, ShowSettings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added the hash to chromeactions.txt Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/notifications/message_center_notification_manager.cc
diff --git a/chrome/browser/notifications/message_center_notification_manager.cc b/chrome/browser/notifications/message_center_notification_manager.cc
index 86b741f8f09f2a928546b27bc333161aaaa87dad..57b650431e08c870a39cf73f5e89e2694f3d1c5c 100644
--- a/chrome/browser/notifications/message_center_notification_manager.cc
+++ b/chrome/browser/notifications/message_center_notification_manager.cc
@@ -27,6 +27,7 @@
#include "ui/gfx/image/image_skia.h"
#include "ui/message_center/message_center_style.h"
#include "ui/message_center/message_center_tray.h"
+#include "ui/message_center/message_center_types.h"
#include "ui/message_center/notifier_settings.h"
namespace {
@@ -50,7 +51,6 @@ MessageCenterNotificationManager::MessageCenterNotificationManager(
first_run_pref_.Init(prefs::kMessageCenterShowedFirstRunBalloon, local_state);
#endif
- message_center_->SetDelegate(this);
message_center_->AddObserver(this);
message_center_->SetNotifierSettingsProvider(settings_provider_.get());
@@ -230,31 +230,6 @@ bool MessageCenterNotificationManager::UpdateNotification(
}
////////////////////////////////////////////////////////////////////////////////
-// MessageCenter::Delegate
-
-void MessageCenterNotificationManager::ShowSettings(
- const std::string& notification_id) {
- // The per-message-center Settings button passes an empty string.
- if (notification_id.empty()) {
- NOTIMPLEMENTED();
- return;
- }
-
- ProfileNotification* profile_notification =
- FindProfileNotification(notification_id);
- if (!profile_notification)
- return;
-
- Browser* browser =
- chrome::FindOrCreateTabbedBrowser(profile_notification->profile(),
- chrome::HOST_DESKTOP_TYPE_NATIVE);
- if (profile_notification->GetExtensionId().empty())
- chrome::ShowContentSettings(browser, CONTENT_SETTINGS_TYPE_NOTIFICATIONS);
- else
- chrome::ShowExtensions(browser, std::string());
-}
-
-////////////////////////////////////////////////////////////////////////////////
// MessageCenter::Observer
void MessageCenterNotificationManager::OnNotificationRemoved(
const std::string& notification_id,
@@ -272,13 +247,26 @@ void MessageCenterNotificationManager::OnNotificationRemoved(
#endif
}
-void MessageCenterNotificationManager::OnNotificationCenterClosed() {
- // When the center is open it halts all notifications, so we need to listen
- // for events indicating it's been closed.
- CheckAndShowNotifications();
+void MessageCenterNotificationManager::OnCenterVisibilityChanged(
+ message_center::Visibility visibility) {
+ switch (visibility) {
+ case message_center::VISIBILITY_TRANSIENT:
+ // When the center is open it halts all notifications, so we need to
+ // listen for events indicating it's been closed.
+ CheckAndShowNotifications();
#if defined(OS_WIN)
- CheckFirstRunTimer();
+ CheckFirstRunTimer();
#endif
+ break;
+ case message_center::VISIBILITY_MESSAGE_CENTER:
+ content::RecordAction(
+ content::UserMetricsAction("Notifications.ShowMessageCenter"));
+ break;
+ case message_center::VISIBILITY_SETTINGS:
+ content::RecordAction(
+ content::UserMetricsAction("Notifications.ShowSettings"));
+ break;
+ }
}
void MessageCenterNotificationManager::OnNotificationUpdated(

Powered by Google App Engine
This is Rietveld 408576698