| 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/wm/core/nested_accelerator_dispatcher.h" | 5 #include "ui/wm/core/nested_accelerator_dispatcher.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "ui/base/accelerators/accelerator.h" | 9 #include "ui/base/accelerators/accelerator.h" |
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 public ui::PlatformEventDispatcher { | 48 public ui::PlatformEventDispatcher { |
| 49 public: | 49 public: |
| 50 explicit NestedAcceleratorDispatcherLinux(NestedAcceleratorDelegate* delegate) | 50 explicit NestedAcceleratorDispatcherLinux(NestedAcceleratorDelegate* delegate) |
| 51 : NestedAcceleratorDispatcher(delegate), | 51 : NestedAcceleratorDispatcher(delegate), |
| 52 restore_dispatcher_(OverrideDispatcher(this)) {} | 52 restore_dispatcher_(OverrideDispatcher(this)) {} |
| 53 | 53 |
| 54 virtual ~NestedAcceleratorDispatcherLinux() {} | 54 virtual ~NestedAcceleratorDispatcherLinux() {} |
| 55 | 55 |
| 56 private: | 56 private: |
| 57 // AcceleratorDispatcher: | 57 // AcceleratorDispatcher: |
| 58 virtual scoped_ptr<base::RunLoop> CreateRunLoop() OVERRIDE { | 58 virtual scoped_ptr<base::RunLoop> CreateRunLoop() override { |
| 59 return scoped_ptr<base::RunLoop>(new base::RunLoop()); | 59 return scoped_ptr<base::RunLoop>(new base::RunLoop()); |
| 60 } | 60 } |
| 61 | 61 |
| 62 // ui::PlatformEventDispatcher: | 62 // ui::PlatformEventDispatcher: |
| 63 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) OVERRIDE { | 63 virtual bool CanDispatchEvent(const ui::PlatformEvent& event) override { |
| 64 return true; | 64 return true; |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE { | 67 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) override { |
| 68 if (IsKeyEvent(event)) { | 68 if (IsKeyEvent(event)) { |
| 69 ui::KeyEvent key_event(event); | 69 ui::KeyEvent key_event(event); |
| 70 ui::Accelerator accelerator = CreateAcceleratorFromKeyEvent(key_event); | 70 ui::Accelerator accelerator = CreateAcceleratorFromKeyEvent(key_event); |
| 71 | 71 |
| 72 switch (delegate_->ProcessAccelerator(accelerator)) { | 72 switch (delegate_->ProcessAccelerator(accelerator)) { |
| 73 case NestedAcceleratorDelegate::RESULT_PROCESS_LATER: | 73 case NestedAcceleratorDelegate::RESULT_PROCESS_LATER: |
| 74 #if defined(USE_X11) | 74 #if defined(USE_X11) |
| 75 XPutBackEvent(event->xany.display, event); | 75 XPutBackEvent(event->xany.display, event); |
| 76 #else | 76 #else |
| 77 NOTIMPLEMENTED(); | 77 NOTIMPLEMENTED(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 scoped_ptr<NestedAcceleratorDispatcher> NestedAcceleratorDispatcher::Create( | 97 scoped_ptr<NestedAcceleratorDispatcher> NestedAcceleratorDispatcher::Create( |
| 98 NestedAcceleratorDelegate* delegate, | 98 NestedAcceleratorDelegate* delegate, |
| 99 base::MessagePumpDispatcher* nested_dispatcher) { | 99 base::MessagePumpDispatcher* nested_dispatcher) { |
| 100 return scoped_ptr<NestedAcceleratorDispatcher>( | 100 return scoped_ptr<NestedAcceleratorDispatcher>( |
| 101 new NestedAcceleratorDispatcherLinux(delegate)); | 101 new NestedAcceleratorDispatcherLinux(delegate)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 } // namespace wm | 104 } // namespace wm |
| OLD | NEW |