| 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 "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "ui/base/models/menu_model.h" | 10 #include "ui/base/models/menu_model.h" |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 // Show mnemonics if the button has focus or alt is pressed. | 271 // Show mnemonics if the button has focus or alt is pressed. |
| 272 bool show_mnemonics = button ? button->HasFocus() : false; | 272 bool show_mnemonics = button ? button->HasFocus() : false; |
| 273 #if defined(OS_WIN) | 273 #if defined(OS_WIN) |
| 274 // This is only needed on Windows. | 274 // This is only needed on Windows. |
| 275 if (!show_mnemonics) | 275 if (!show_mnemonics) |
| 276 show_mnemonics = base::win::IsAltPressed(); | 276 show_mnemonics = base::win::IsAltPressed(); |
| 277 #endif | 277 #endif |
| 278 return show_mnemonics; | 278 return show_mnemonics; |
| 279 } | 279 } |
| 280 | 280 |
| 281 // In theory we could implement this every where, but for now we're only | |
| 282 // implementing it on aura. | |
| 283 #if !defined(USE_AURA) | |
| 284 // static | |
| 285 DisplayChangeListener* DisplayChangeListener::Create(Widget* widget, | |
| 286 MenuRunner* runner) { | |
| 287 return NULL; | |
| 288 } | |
| 289 #endif | |
| 290 | |
| 291 } // namespace internal | 281 } // namespace internal |
| 292 | 282 |
| 293 MenuRunner::MenuRunner(ui::MenuModel* menu_model) | 283 MenuRunner::MenuRunner(ui::MenuModel* menu_model) |
| 294 : menu_model_adapter_(new MenuModelAdapter(menu_model)), | 284 : menu_model_adapter_(new MenuModelAdapter(menu_model)), |
| 295 holder_(new internal::MenuRunnerImpl(menu_model_adapter_->CreateMenu())) { | 285 holder_(new internal::MenuRunnerImpl(menu_model_adapter_->CreateMenu())) { |
| 296 } | 286 } |
| 297 | 287 |
| 298 MenuRunner::MenuRunner(MenuItemView* menu) | 288 MenuRunner::MenuRunner(MenuItemView* menu) |
| 299 : holder_(new internal::MenuRunnerImpl(menu)) { | 289 : holder_(new internal::MenuRunnerImpl(menu)) { |
| 300 } | 290 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 base::TimeDelta MenuRunner::closing_event_time() const { | 346 base::TimeDelta MenuRunner::closing_event_time() const { |
| 357 return holder_->closing_event_time(); | 347 return holder_->closing_event_time(); |
| 358 } | 348 } |
| 359 | 349 |
| 360 void MenuRunner::SetRunnerHandler( | 350 void MenuRunner::SetRunnerHandler( |
| 361 scoped_ptr<MenuRunnerHandler> runner_handler) { | 351 scoped_ptr<MenuRunnerHandler> runner_handler) { |
| 362 runner_handler_ = runner_handler.Pass(); | 352 runner_handler_ = runner_handler.Pass(); |
| 363 } | 353 } |
| 364 | 354 |
| 365 } // namespace views | 355 } // namespace views |
| OLD | NEW |