| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/message_center/message_center_tray.h" | 5 #include "ui/message_center/message_center_tray.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 public ui::SimpleMenuModel::Delegate { | 33 public ui::SimpleMenuModel::Delegate { |
| 34 public: | 34 public: |
| 35 NotificationMenuModel(MessageCenterTray* tray, | 35 NotificationMenuModel(MessageCenterTray* tray, |
| 36 const NotifierId& notifier_id, | 36 const NotifierId& notifier_id, |
| 37 const base::string16& display_source); | 37 const base::string16& display_source); |
| 38 ~NotificationMenuModel() override; | 38 ~NotificationMenuModel() override; |
| 39 | 39 |
| 40 // Overridden from ui::SimpleMenuModel::Delegate: | 40 // Overridden from ui::SimpleMenuModel::Delegate: |
| 41 bool IsCommandIdChecked(int command_id) const override; | 41 bool IsCommandIdChecked(int command_id) const override; |
| 42 bool IsCommandIdEnabled(int command_id) const override; | 42 bool IsCommandIdEnabled(int command_id) const override; |
| 43 bool GetAcceleratorForCommandId(int command_id, | |
| 44 ui::Accelerator* accelerator) const override; | |
| 45 void ExecuteCommand(int command_id, int event_flags) override; | 43 void ExecuteCommand(int command_id, int event_flags) override; |
| 46 | 44 |
| 47 private: | 45 private: |
| 48 MessageCenterTray* tray_; | 46 MessageCenterTray* tray_; |
| 49 NotifierId notifier_id_; | 47 NotifierId notifier_id_; |
| 50 DISALLOW_COPY_AND_ASSIGN(NotificationMenuModel); | 48 DISALLOW_COPY_AND_ASSIGN(NotificationMenuModel); |
| 51 }; | 49 }; |
| 52 | 50 |
| 53 NotificationMenuModel::NotificationMenuModel( | 51 NotificationMenuModel::NotificationMenuModel( |
| 54 MessageCenterTray* tray, | 52 MessageCenterTray* tray, |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 } | 72 } |
| 75 | 73 |
| 76 bool NotificationMenuModel::IsCommandIdChecked(int command_id) const { | 74 bool NotificationMenuModel::IsCommandIdChecked(int command_id) const { |
| 77 return false; | 75 return false; |
| 78 } | 76 } |
| 79 | 77 |
| 80 bool NotificationMenuModel::IsCommandIdEnabled(int command_id) const { | 78 bool NotificationMenuModel::IsCommandIdEnabled(int command_id) const { |
| 81 return tray_->delegate()->IsContextMenuEnabled(); | 79 return tray_->delegate()->IsContextMenuEnabled(); |
| 82 } | 80 } |
| 83 | 81 |
| 84 bool NotificationMenuModel::GetAcceleratorForCommandId( | |
| 85 int command_id, | |
| 86 ui::Accelerator* accelerator) const { | |
| 87 return false; | |
| 88 } | |
| 89 | |
| 90 void NotificationMenuModel::ExecuteCommand(int command_id, int event_flags) { | 82 void NotificationMenuModel::ExecuteCommand(int command_id, int event_flags) { |
| 91 switch (command_id) { | 83 switch (command_id) { |
| 92 case kTogglePermissionCommand: | 84 case kTogglePermissionCommand: |
| 93 tray_->message_center()->DisableNotificationsByNotifier(notifier_id_); | 85 tray_->message_center()->DisableNotificationsByNotifier(notifier_id_); |
| 94 break; | 86 break; |
| 95 #ifdef OS_CHROMEOS | 87 #ifdef OS_CHROMEOS |
| 96 case kShowSettingsCommand: | 88 case kShowSettingsCommand: |
| 97 tray_->ShowNotifierSettingsBubble(); | 89 tray_->ShowNotifierSettingsBubble(); |
| 98 break; | 90 break; |
| 99 #endif | 91 #endif |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 ShowPopupBubble(); | 259 ShowPopupBubble(); |
| 268 | 260 |
| 269 NotifyMessageCenterTrayChanged(); | 261 NotifyMessageCenterTrayChanged(); |
| 270 } | 262 } |
| 271 | 263 |
| 272 void MessageCenterTray::NotifyMessageCenterTrayChanged() { | 264 void MessageCenterTray::NotifyMessageCenterTrayChanged() { |
| 273 delegate_->OnMessageCenterTrayChanged(); | 265 delegate_->OnMessageCenterTrayChanged(); |
| 274 } | 266 } |
| 275 | 267 |
| 276 } // namespace message_center | 268 } // namespace message_center |
| OLD | NEW |