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

Unified Diff: ui/message_center/message_center_tray.cc

Issue 1334363002: [Eraser] First pass at removing the notification center panel. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: peter comments Created 5 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
« no previous file with comments | « ui/message_center/message_center.gyp ('k') | ui/message_center/message_center_tray_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/message_center/message_center_tray.cc
diff --git a/ui/message_center/message_center_tray.cc b/ui/message_center/message_center_tray.cc
index 1ce4e8e9e5af29da0cdced133cad562e9b49b519..3b2cbac7be7ca992f5d739079a777a7b3342d5ba 100644
--- a/ui/message_center/message_center_tray.cc
+++ b/ui/message_center/message_center_tray.cc
@@ -20,7 +20,10 @@ namespace {
// Menu constants
const int kTogglePermissionCommand = 0;
+
+#if defined(OS_CHROMEOS)
const int kShowSettingsCommand = 1;
+#endif
// The model of the context menu for a notification card.
class NotificationMenuModel : public ui::SimpleMenuModel,
@@ -51,15 +54,17 @@ NotificationMenuModel::NotificationMenuModel(
: ui::SimpleMenuModel(this),
tray_(tray),
notifier_id_(notifier_id) {
- // Add 'disable notifications' menu item.
if (!display_source.empty()) {
AddItem(kTogglePermissionCommand,
l10n_util::GetStringFUTF16(IDS_MESSAGE_CENTER_NOTIFIER_DISABLE,
display_source));
}
+
+#ifdef OS_CHROMEOS
// Add settings menu item.
AddItem(kShowSettingsCommand,
l10n_util::GetStringUTF16(IDS_MESSAGE_CENTER_SETTINGS));
+#endif
}
NotificationMenuModel::~NotificationMenuModel() {
@@ -84,9 +89,11 @@ void NotificationMenuModel::ExecuteCommand(int command_id, int event_flags) {
case kTogglePermissionCommand:
tray_->message_center()->DisableNotificationsByNotifier(notifier_id_);
break;
+#ifdef OS_CHROMEOS
case kShowSettingsCommand:
tray_->ShowNotifierSettingsBubble();
break;
+#endif
default:
NOTREACHED();
}
@@ -115,8 +122,10 @@ bool MessageCenterTray::ShowMessageCenterBubble() {
HidePopupBubbleInternal();
message_center_visible_ = delegate_->ShowMessageCenter();
- message_center_->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER);
- NotifyMessageCenterTrayChanged();
+ if (message_center_visible_) {
+ message_center_->SetVisibility(message_center::VISIBILITY_MESSAGE_CENTER);
+ NotifyMessageCenterTrayChanged();
+ }
return message_center_visible_;
}
@@ -144,13 +153,6 @@ void MessageCenterTray::MarkMessageCenterHidden() {
NotifyMessageCenterTrayChanged();
}
-void MessageCenterTray::ToggleMessageCenterBubble() {
- if (message_center_visible_)
- HideMessageCenterBubble();
- else
- ShowMessageCenterBubble();
-}
-
void MessageCenterTray::ShowPopupBubble() {
if (message_center_visible_)
return;
@@ -198,6 +200,13 @@ void MessageCenterTray::ShowNotifierSettingsBubble() {
scoped_ptr<ui::MenuModel> MessageCenterTray::CreateNotificationMenuModel(
const NotifierId& notifier_id,
const base::string16& display_source) {
+#if !defined(OS_CHROMEOS)
+ // Only web pages are configurable on non-chromeos platforms.
+ if (notifier_id.type != NotifierId::WEB_PAGE) {
+ return nullptr;
+ }
+#endif
+
return make_scoped_ptr(
new NotificationMenuModel(this, notifier_id, display_source));
}
« no previous file with comments | « ui/message_center/message_center.gyp ('k') | ui/message_center/message_center_tray_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698