| 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/views/notifier_settings_view.h" | 5 #include "ui/message_center/views/notifier_settings_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 class NotifierGroupMenuModel : public ui::SimpleMenuModel, | 211 class NotifierGroupMenuModel : public ui::SimpleMenuModel, |
| 212 public ui::SimpleMenuModel::Delegate { | 212 public ui::SimpleMenuModel::Delegate { |
| 213 public: | 213 public: |
| 214 NotifierGroupMenuModel(NotifierSettingsProvider* notifier_settings_provider); | 214 NotifierGroupMenuModel(NotifierSettingsProvider* notifier_settings_provider); |
| 215 ~NotifierGroupMenuModel() override; | 215 ~NotifierGroupMenuModel() override; |
| 216 | 216 |
| 217 // ui::SimpleMenuModel::Delegate: | 217 // ui::SimpleMenuModel::Delegate: |
| 218 bool IsCommandIdChecked(int command_id) const override; | 218 bool IsCommandIdChecked(int command_id) const override; |
| 219 bool IsCommandIdEnabled(int command_id) const override; | 219 bool IsCommandIdEnabled(int command_id) const override; |
| 220 bool GetAcceleratorForCommandId(int command_id, | 220 bool GetAcceleratorForCommandId(int command_id, |
| 221 ui::Accelerator* accelerator) override; | 221 ui::Accelerator* accelerator) const override; |
| 222 void ExecuteCommand(int command_id, int event_flags) override; | 222 void ExecuteCommand(int command_id, int event_flags) override; |
| 223 | 223 |
| 224 private: | 224 private: |
| 225 NotifierSettingsProvider* notifier_settings_provider_; | 225 NotifierSettingsProvider* notifier_settings_provider_; |
| 226 | 226 |
| 227 DISALLOW_COPY_AND_ASSIGN(NotifierGroupMenuModel); | 227 DISALLOW_COPY_AND_ASSIGN(NotifierGroupMenuModel); |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 NotifierGroupMenuModel::NotifierGroupMenuModel( | 230 NotifierGroupMenuModel::NotifierGroupMenuModel( |
| 231 NotifierSettingsProvider* notifier_settings_provider) | 231 NotifierSettingsProvider* notifier_settings_provider) |
| (...skipping 18 matching lines...) Expand all Loading... |
| 250 return !notifier_settings_provider_ || | 250 return !notifier_settings_provider_ || |
| 251 notifier_settings_provider_->IsNotifierGroupActiveAt(command_id); | 251 notifier_settings_provider_->IsNotifierGroupActiveAt(command_id); |
| 252 } | 252 } |
| 253 | 253 |
| 254 bool NotifierGroupMenuModel::IsCommandIdEnabled(int command_id) const { | 254 bool NotifierGroupMenuModel::IsCommandIdEnabled(int command_id) const { |
| 255 return true; | 255 return true; |
| 256 } | 256 } |
| 257 | 257 |
| 258 bool NotifierGroupMenuModel::GetAcceleratorForCommandId( | 258 bool NotifierGroupMenuModel::GetAcceleratorForCommandId( |
| 259 int command_id, | 259 int command_id, |
| 260 ui::Accelerator* accelerator) { | 260 ui::Accelerator* accelerator) const { |
| 261 return false; | 261 return false; |
| 262 } | 262 } |
| 263 | 263 |
| 264 void NotifierGroupMenuModel::ExecuteCommand(int command_id, int event_flags) { | 264 void NotifierGroupMenuModel::ExecuteCommand(int command_id, int event_flags) { |
| 265 if (!notifier_settings_provider_) | 265 if (!notifier_settings_provider_) |
| 266 return; | 266 return; |
| 267 | 267 |
| 268 size_t notifier_group_index = static_cast<size_t>(command_id); | 268 size_t notifier_group_index = static_cast<size_t>(command_id); |
| 269 size_t num_notifier_groups = | 269 size_t num_notifier_groups = |
| 270 notifier_settings_provider_->GetNotifierGroupCount(); | 270 notifier_settings_provider_->GetNotifierGroupCount(); |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 701 notifier_group_selector_, | 701 notifier_group_selector_, |
| 702 menu_anchor, | 702 menu_anchor, |
| 703 views::MENU_ANCHOR_BUBBLE_ABOVE, | 703 views::MENU_ANCHOR_BUBBLE_ABOVE, |
| 704 ui::MENU_SOURCE_MOUSE)) | 704 ui::MENU_SOURCE_MOUSE)) |
| 705 return; | 705 return; |
| 706 MessageCenterView* center_view = static_cast<MessageCenterView*>(parent()); | 706 MessageCenterView* center_view = static_cast<MessageCenterView*>(parent()); |
| 707 center_view->OnSettingsChanged(); | 707 center_view->OnSettingsChanged(); |
| 708 } | 708 } |
| 709 | 709 |
| 710 } // namespace message_center | 710 } // namespace message_center |
| OLD | NEW |