| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/controls/menu/menu_runner.h" | 5 #include "ui/views/controls/menu/menu_runner.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 | 8 |
| 9 #include "ui/views/controls/button/menu_button.h" | 9 #include "ui/views/controls/button/menu_button.h" |
| 10 #include "ui/views/controls/menu/menu_controller.h" | 10 #include "ui/views/controls/menu/menu_controller.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 menu_->GetDelegate()->ExecuteCommand(result->GetCommand(), | 233 menu_->GetDelegate()->ExecuteCommand(result->GetCommand(), |
| 234 mouse_event_flags); | 234 mouse_event_flags); |
| 235 } | 235 } |
| 236 return MenuRunner::NORMAL_EXIT; | 236 return MenuRunner::NORMAL_EXIT; |
| 237 } | 237 } |
| 238 | 238 |
| 239 bool MenuRunnerImpl::ShouldShowMnemonics(MenuButton* button) { | 239 bool MenuRunnerImpl::ShouldShowMnemonics(MenuButton* button) { |
| 240 // Show mnemonics if the button has focus or alt is pressed. | 240 // Show mnemonics if the button has focus or alt is pressed. |
| 241 bool show_mnemonics = button ? button->HasFocus() : false; | 241 bool show_mnemonics = button ? button->HasFocus() : false; |
| 242 #if defined(OS_WIN) | 242 #if defined(OS_WIN) |
| 243 // We don't currently need this on gtk as showing the menu gives focus to the | 243 // This is only needed on Windows. |
| 244 // button first. | |
| 245 if (!show_mnemonics) | 244 if (!show_mnemonics) |
| 246 show_mnemonics = base::win::IsAltPressed(); | 245 show_mnemonics = base::win::IsAltPressed(); |
| 247 #endif | 246 #endif |
| 248 return show_mnemonics; | 247 return show_mnemonics; |
| 249 } | 248 } |
| 250 | 249 |
| 251 } // namespace internal | 250 } // namespace internal |
| 252 | 251 |
| 253 MenuRunner::MenuRunner(MenuItemView* menu) | 252 MenuRunner::MenuRunner(MenuItemView* menu) |
| 254 : holder_(new internal::MenuRunnerImpl(menu)) { | 253 : holder_(new internal::MenuRunnerImpl(menu)) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 272 | 271 |
| 273 bool MenuRunner::IsRunning() const { | 272 bool MenuRunner::IsRunning() const { |
| 274 return holder_->running(); | 273 return holder_->running(); |
| 275 } | 274 } |
| 276 | 275 |
| 277 void MenuRunner::Cancel() { | 276 void MenuRunner::Cancel() { |
| 278 holder_->Cancel(); | 277 holder_->Cancel(); |
| 279 } | 278 } |
| 280 | 279 |
| 281 } // namespace views | 280 } // namespace views |
| OLD | NEW |