| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 return MenuRunner::NORMAL_EXIT; | 168 return MenuRunner::NORMAL_EXIT; |
| 169 } | 169 } |
| 170 // Drop menus don't block the message loop, so it's ok to create a new | 170 // Drop menus don't block the message loop, so it's ok to create a new |
| 171 // MenuController. | 171 // MenuController. |
| 172 controller = NULL; | 172 controller = NULL; |
| 173 } | 173 } |
| 174 } | 174 } |
| 175 | 175 |
| 176 running_ = true; | 176 running_ = true; |
| 177 for_drop_ = (types & MenuRunner::FOR_DROP) != 0; | 177 for_drop_ = (types & MenuRunner::FOR_DROP) != 0; |
| 178 bool has_mnemonics = (types & MenuRunner::HAS_MNEMONICS) != 0 && !for_drop_; | 178 bool has_mnemonics = (types & MenuRunner::HAS_MNEMONICS) != 0; |
| 179 owns_controller_ = false; | 179 owns_controller_ = false; |
| 180 if (!controller) { | 180 if (!controller) { |
| 181 // No menus are showing, show one. | 181 // No menus are showing, show one. |
| 182 ui::NativeTheme* theme = parent ? parent->GetNativeTheme() : | 182 ui::NativeTheme* theme = parent ? parent->GetNativeTheme() : |
| 183 ui::NativeTheme::instance(); | 183 ui::NativeTheme::instance(); |
| 184 controller = new MenuController(theme, !for_drop_, this); | 184 controller = new MenuController(theme, !for_drop_, this); |
| 185 owns_controller_ = true; | 185 owns_controller_ = true; |
| 186 } | 186 } |
| 187 controller->set_is_combobox((types & MenuRunner::COMBOBOX) != 0); | 187 controller->set_is_combobox((types & MenuRunner::COMBOBOX) != 0); |
| 188 controller_ = controller; | 188 controller_ = controller; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 340 base::TimeDelta MenuRunner::closing_event_time() const { | 340 base::TimeDelta MenuRunner::closing_event_time() const { |
| 341 return holder_->closing_event_time(); | 341 return holder_->closing_event_time(); |
| 342 } | 342 } |
| 343 | 343 |
| 344 void MenuRunner::SetRunnerHandler( | 344 void MenuRunner::SetRunnerHandler( |
| 345 scoped_ptr<MenuRunnerHandler> runner_handler) { | 345 scoped_ptr<MenuRunnerHandler> runner_handler) { |
| 346 runner_handler_ = runner_handler.Pass(); | 346 runner_handler_ = runner_handler.Pass(); |
| 347 } | 347 } |
| 348 | 348 |
| 349 } // namespace views | 349 } // namespace views |
| OLD | NEW |