| 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_adapter.h" | 5 #include "ui/views/controls/menu/menu_runner_impl_adapter.h" |
| 6 | 6 |
| 7 #include "ui/views/controls/menu/menu_model_adapter.h" | 7 #include "ui/views/controls/menu/menu_model_adapter.h" |
| 8 #include "ui/views/controls/menu/menu_runner_impl.h" | 8 #include "ui/views/controls/menu/menu_runner_impl.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| 11 namespace internal { | 11 namespace internal { |
| 12 | 12 |
| 13 MenuRunnerImplAdapter::MenuRunnerImplAdapter( | 13 MenuRunnerImplAdapter::MenuRunnerImplAdapter( |
| 14 ui::MenuModel* menu_model, | 14 ui::MenuModel* menu_model, |
| 15 const base::Closure& on_menu_done_callback) | 15 const base::Closure& on_menu_done_callback) |
| 16 : menu_model_adapter_( | 16 : menu_model_adapter_( |
| 17 new MenuModelAdapter(menu_model, on_menu_done_callback)), | 17 new MenuModelAdapter(menu_model, on_menu_done_callback)), |
| 18 impl_(new MenuRunnerImpl(menu_model_adapter_->CreateMenu())) {} | 18 impl_(new MenuRunnerImpl(menu_model_adapter_->CreateMenu())) {} |
| 19 | 19 |
| 20 bool MenuRunnerImplAdapter::IsRunning() const { | 20 bool MenuRunnerImplAdapter::IsRunning() const { |
| 21 return impl_->IsRunning(); | 21 return impl_->IsRunning(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 void MenuRunnerImplAdapter::Release() { | 24 void MenuRunnerImplAdapter::Release() { |
| 25 impl_->Release(); | 25 impl_->Release(); |
| 26 delete this; | 26 delete this; |
| 27 } | 27 } |
| 28 | 28 |
| 29 MenuRunner::RunResult MenuRunnerImplAdapter::RunMenuAt( | 29 void MenuRunnerImplAdapter::RunMenuAt(Widget* parent, |
| 30 Widget* parent, | 30 MenuButton* button, |
| 31 MenuButton* button, | 31 const gfx::Rect& bounds, |
| 32 const gfx::Rect& bounds, | 32 MenuAnchorPosition anchor, |
| 33 MenuAnchorPosition anchor, | 33 int32_t types) { |
| 34 int32_t types) { | 34 impl_->RunMenuAt(parent, button, bounds, anchor, types); |
| 35 return impl_->RunMenuAt(parent, button, bounds, anchor, types); | |
| 36 } | 35 } |
| 37 | 36 |
| 38 void MenuRunnerImplAdapter::Cancel() { | 37 void MenuRunnerImplAdapter::Cancel() { |
| 39 impl_->Cancel(); | 38 impl_->Cancel(); |
| 40 } | 39 } |
| 41 | 40 |
| 42 base::TimeTicks MenuRunnerImplAdapter::GetClosingEventTime() const { | 41 base::TimeTicks MenuRunnerImplAdapter::GetClosingEventTime() const { |
| 43 return impl_->GetClosingEventTime(); | 42 return impl_->GetClosingEventTime(); |
| 44 } | 43 } |
| 45 | 44 |
| 46 MenuRunnerImplAdapter::~MenuRunnerImplAdapter() { | 45 MenuRunnerImplAdapter::~MenuRunnerImplAdapter() { |
| 47 } | 46 } |
| 48 | 47 |
| 49 } // namespace internal | 48 } // namespace internal |
| 50 } // namespace views | 49 } // namespace views |
| OLD | NEW |