| 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 #ifndef UI_WM_CORE_NESTED_ACCELERATOR_CONTROLLER_H_ | 5 #ifndef UI_WM_CORE_NESTED_ACCELERATOR_CONTROLLER_H_ |
| 6 #define UI_WM_CORE_NESTED_ACCELERATOR_CONTROLLER_H_ | 6 #define UI_WM_CORE_NESTED_ACCELERATOR_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "ui/wm/public/dispatcher_client.h" | 10 #include "ui/wm/public/dispatcher_client.h" |
| 11 #include "ui/wm/wm_export.h" | 11 #include "ui/wm/wm_export.h" |
| 12 | 12 |
| 13 namespace wm { | 13 namespace wm { |
| 14 | 14 |
| 15 class NestedAcceleratorDelegate; | 15 class NestedAcceleratorDelegate; |
| 16 class NestedAcceleratorDispatcher; | 16 class NestedAcceleratorDispatcher; |
| 17 | 17 |
| 18 // Creates a dispatcher which wraps another dispatcher. | 18 // Creates a dispatcher which wraps another dispatcher. |
| 19 // The outer dispatcher runs first and performs ash specific handling. | 19 // The outer dispatcher runs first and performs ash specific handling. |
| 20 // If it does not consume the event it forwards the event to the nested | 20 // If it does not consume the event it forwards the event to the nested |
| 21 // dispatcher. | 21 // dispatcher. |
| 22 class WM_EXPORT NestedAcceleratorController | 22 class WM_EXPORT NestedAcceleratorController |
| 23 : public aura::client::DispatcherClient { | 23 : public aura::client::DispatcherClient { |
| 24 public: | 24 public: |
| 25 explicit NestedAcceleratorController(NestedAcceleratorDelegate* delegate); | 25 explicit NestedAcceleratorController(NestedAcceleratorDelegate* delegate); |
| 26 virtual ~NestedAcceleratorController(); | 26 ~NestedAcceleratorController() override; |
| 27 | 27 |
| 28 // aura::client::DispatcherClient: | 28 // aura::client::DispatcherClient: |
| 29 virtual void PrepareNestedLoopClosures( | 29 void PrepareNestedLoopClosures(base::MessagePumpDispatcher* dispatcher, |
| 30 base::MessagePumpDispatcher* dispatcher, | 30 base::Closure* run_closure, |
| 31 base::Closure* run_closure, | 31 base::Closure* quit_closure) override; |
| 32 base::Closure* quit_closure) override; | |
| 33 | 32 |
| 34 private: | 33 private: |
| 35 void RunNestedMessageLoop(scoped_ptr<base::RunLoop> run_loop, | 34 void RunNestedMessageLoop(scoped_ptr<base::RunLoop> run_loop, |
| 36 scoped_ptr<NestedAcceleratorDispatcher> dispatcher); | 35 scoped_ptr<NestedAcceleratorDispatcher> dispatcher); |
| 37 void QuitNestedMessageLoop(const base::Closure& quit_runloop); | 36 void QuitNestedMessageLoop(const base::Closure& quit_runloop); |
| 38 | 37 |
| 39 scoped_ptr<NestedAcceleratorDispatcher> accelerator_dispatcher_; | 38 scoped_ptr<NestedAcceleratorDispatcher> accelerator_dispatcher_; |
| 40 scoped_ptr<NestedAcceleratorDelegate> dispatcher_delegate_; | 39 scoped_ptr<NestedAcceleratorDelegate> dispatcher_delegate_; |
| 41 | 40 |
| 42 DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorController); | 41 DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorController); |
| 43 }; | 42 }; |
| 44 | 43 |
| 45 } // namespace wm | 44 } // namespace wm |
| 46 | 45 |
| 47 #endif // UI_WM_CORE_NESTED_ACCELERATOR_CONTROLLER_H_ | 46 #endif // UI_WM_CORE_NESTED_ACCELERATOR_CONTROLLER_H_ |
| OLD | NEW |