| 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 23 matching lines...) Expand all Loading... |
| 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, | 43 bool GetAcceleratorForCommandId(int command_id, |
| 44 ui::Accelerator* accelerator) override; | 44 ui::Accelerator* accelerator) const override; |
| 45 void ExecuteCommand(int command_id, int event_flags) override; | 45 void ExecuteCommand(int command_id, int event_flags) override; |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 MessageCenterTray* tray_; | 48 MessageCenterTray* tray_; |
| 49 NotifierId notifier_id_; | 49 NotifierId notifier_id_; |
| 50 DISALLOW_COPY_AND_ASSIGN(NotificationMenuModel); | 50 DISALLOW_COPY_AND_ASSIGN(NotificationMenuModel); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 NotificationMenuModel::NotificationMenuModel( | 53 NotificationMenuModel::NotificationMenuModel( |
| 54 MessageCenterTray* tray, | 54 MessageCenterTray* tray, |
| (...skipping 21 matching lines...) Expand all Loading... |
| 76 bool NotificationMenuModel::IsCommandIdChecked(int command_id) const { | 76 bool NotificationMenuModel::IsCommandIdChecked(int command_id) const { |
| 77 return false; | 77 return false; |
| 78 } | 78 } |
| 79 | 79 |
| 80 bool NotificationMenuModel::IsCommandIdEnabled(int command_id) const { | 80 bool NotificationMenuModel::IsCommandIdEnabled(int command_id) const { |
| 81 return tray_->delegate()->IsContextMenuEnabled(); | 81 return tray_->delegate()->IsContextMenuEnabled(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 bool NotificationMenuModel::GetAcceleratorForCommandId( | 84 bool NotificationMenuModel::GetAcceleratorForCommandId( |
| 85 int command_id, | 85 int command_id, |
| 86 ui::Accelerator* accelerator) { | 86 ui::Accelerator* accelerator) const { |
| 87 return false; | 87 return false; |
| 88 } | 88 } |
| 89 | 89 |
| 90 void NotificationMenuModel::ExecuteCommand(int command_id, int event_flags) { | 90 void NotificationMenuModel::ExecuteCommand(int command_id, int event_flags) { |
| 91 switch (command_id) { | 91 switch (command_id) { |
| 92 case kTogglePermissionCommand: | 92 case kTogglePermissionCommand: |
| 93 tray_->message_center()->DisableNotificationsByNotifier(notifier_id_); | 93 tray_->message_center()->DisableNotificationsByNotifier(notifier_id_); |
| 94 break; | 94 break; |
| 95 #ifdef OS_CHROMEOS | 95 #ifdef OS_CHROMEOS |
| 96 case kShowSettingsCommand: | 96 case kShowSettingsCommand: |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 ShowPopupBubble(); | 267 ShowPopupBubble(); |
| 268 | 268 |
| 269 NotifyMessageCenterTrayChanged(); | 269 NotifyMessageCenterTrayChanged(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void MessageCenterTray::NotifyMessageCenterTrayChanged() { | 272 void MessageCenterTray::NotifyMessageCenterTrayChanged() { |
| 273 delegate_->OnMessageCenterTrayChanged(); | 273 delegate_->OnMessageCenterTrayChanged(); |
| 274 } | 274 } |
| 275 | 275 |
| 276 } // namespace message_center | 276 } // namespace message_center |
| OLD | NEW |