| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/status_icons/status_icon_menu_model.h" | 5 #include "chrome/browser/status_icons/status_icon_menu_model.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "ui/base/accelerators/accelerator.h" | 9 #include "ui/base/accelerators/accelerator.h" |
| 10 #include "ui/gfx/image/image.h" | 10 #include "ui/gfx/image/image.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 } | 106 } |
| 107 | 107 |
| 108 bool StatusIconMenuModel::IsCommandIdVisible(int command_id) const { | 108 bool StatusIconMenuModel::IsCommandIdVisible(int command_id) const { |
| 109 ItemStateMap::const_iterator iter = item_states_.find(command_id); | 109 ItemStateMap::const_iterator iter = item_states_.find(command_id); |
| 110 if (iter != item_states_.end()) | 110 if (iter != item_states_.end()) |
| 111 return iter->second.visible; | 111 return iter->second.visible; |
| 112 return true; | 112 return true; |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool StatusIconMenuModel::GetAcceleratorForCommandId( | 115 bool StatusIconMenuModel::GetAcceleratorForCommandId( |
| 116 int command_id, ui::Accelerator* accelerator) { | 116 int command_id, ui::Accelerator* accelerator) const { |
| 117 ItemStateMap::const_iterator iter = item_states_.find(command_id); | 117 ItemStateMap::const_iterator iter = item_states_.find(command_id); |
| 118 if (iter != item_states_.end() && | 118 if (iter != item_states_.end() && |
| 119 iter->second.accelerator.key_code() != ui::VKEY_UNKNOWN) { | 119 iter->second.accelerator.key_code() != ui::VKEY_UNKNOWN) { |
| 120 *accelerator = iter->second.accelerator; | 120 *accelerator = iter->second.accelerator; |
| 121 return true; | 121 return true; |
| 122 } | 122 } |
| 123 return false; | 123 return false; |
| 124 } | 124 } |
| 125 | 125 |
| 126 bool StatusIconMenuModel::IsItemForCommandIdDynamic(int command_id) const { | 126 bool StatusIconMenuModel::IsItemForCommandIdDynamic(int command_id) const { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 | 171 |
| 172 void StatusIconMenuModel::CommandIdHighlighted(int command_id) { | 172 void StatusIconMenuModel::CommandIdHighlighted(int command_id) { |
| 173 if (delegate_) | 173 if (delegate_) |
| 174 delegate_->CommandIdHighlighted(command_id); | 174 delegate_->CommandIdHighlighted(command_id); |
| 175 } | 175 } |
| 176 | 176 |
| 177 void StatusIconMenuModel::ExecuteCommand(int command_id, int event_flags) { | 177 void StatusIconMenuModel::ExecuteCommand(int command_id, int event_flags) { |
| 178 if (delegate_) | 178 if (delegate_) |
| 179 delegate_->ExecuteCommand(command_id, event_flags); | 179 delegate_->ExecuteCommand(command_id, event_flags); |
| 180 } | 180 } |
| OLD | NEW |