| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_impl.h" | 5 #include "ui/views/controls/menu/menu_runner_impl.h" |
| 6 | 6 |
| 7 #include "ui/native_theme/native_theme.h" | 7 #include "ui/native_theme/native_theme.h" |
| 8 #include "ui/views/controls/button/menu_button.h" | 8 #include "ui/views/controls/button/menu_button.h" |
| 9 #include "ui/views/controls/menu/menu_controller.h" | 9 #include "ui/views/controls/menu/menu_controller.h" |
| 10 #include "ui/views/controls/menu/menu_delegate.h" | 10 #include "ui/views/controls/menu/menu_delegate.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 controller = NULL; | 102 controller = NULL; |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 running_ = true; | 106 running_ = true; |
| 107 for_drop_ = (run_types & MenuRunner::FOR_DROP) != 0; | 107 for_drop_ = (run_types & MenuRunner::FOR_DROP) != 0; |
| 108 bool has_mnemonics = (run_types & MenuRunner::HAS_MNEMONICS) != 0; | 108 bool has_mnemonics = (run_types & MenuRunner::HAS_MNEMONICS) != 0; |
| 109 owns_controller_ = false; | 109 owns_controller_ = false; |
| 110 if (!controller) { | 110 if (!controller) { |
| 111 // No menus are showing, show one. | 111 // No menus are showing, show one. |
| 112 ui::NativeTheme* theme = | 112 controller = new MenuController(!for_drop_, this); |
| 113 parent ? parent->GetNativeTheme() : ui::NativeTheme::instance(); | |
| 114 controller = new MenuController(theme, !for_drop_, this); | |
| 115 owns_controller_ = true; | 113 owns_controller_ = true; |
| 116 } | 114 } |
| 117 controller->set_is_combobox((run_types & MenuRunner::COMBOBOX) != 0); | 115 controller->set_is_combobox((run_types & MenuRunner::COMBOBOX) != 0); |
| 118 controller_ = controller; | 116 controller_ = controller; |
| 119 menu_->set_controller(controller_); | 117 menu_->set_controller(controller_); |
| 120 menu_->PrepareForRun(owns_controller_, | 118 menu_->PrepareForRun(owns_controller_, |
| 121 has_mnemonics, | 119 has_mnemonics, |
| 122 !for_drop_ && ShouldShowMnemonics(button)); | 120 !for_drop_ && ShouldShowMnemonics(button)); |
| 123 | 121 |
| 124 // Run the loop. | 122 // Run the loop. |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 #if defined(OS_WIN) | 206 #if defined(OS_WIN) |
| 209 // This is only needed on Windows. | 207 // This is only needed on Windows. |
| 210 if (!show_mnemonics) | 208 if (!show_mnemonics) |
| 211 show_mnemonics = ui::win::IsAltPressed(); | 209 show_mnemonics = ui::win::IsAltPressed(); |
| 212 #endif | 210 #endif |
| 213 return show_mnemonics; | 211 return show_mnemonics; |
| 214 } | 212 } |
| 215 | 213 |
| 216 } // namespace internal | 214 } // namespace internal |
| 217 } // namespace views | 215 } // namespace views |
| OLD | NEW |