| 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 20 matching lines...) Expand all Loading... |
| 31 bool IsKeyEvent(const XEvent* xev) { | 31 bool IsKeyEvent(const XEvent* xev) { |
| 32 return xev->type == KeyPress || xev->type == KeyRelease; | 32 return xev->type == KeyPress || xev->type == KeyRelease; |
| 33 } | 33 } |
| 34 #else | 34 #else |
| 35 #error Unknown build platform: you should have either use_ozone or use_x11. | 35 #error Unknown build platform: you should have either use_ozone or use_x11. |
| 36 #endif | 36 #endif |
| 37 | 37 |
| 38 scoped_ptr<ui::ScopedEventDispatcher> OverrideDispatcher( | 38 scoped_ptr<ui::ScopedEventDispatcher> OverrideDispatcher( |
| 39 ui::PlatformEventDispatcher* dispatcher) { | 39 ui::PlatformEventDispatcher* dispatcher) { |
| 40 ui::PlatformEventSource* source = ui::PlatformEventSource::GetInstance(); | 40 ui::PlatformEventSource* source = ui::PlatformEventSource::GetInstance(); |
| 41 return source ? source->OverrideDispatcher(dispatcher) | 41 return source ? source->OverrideDispatcher(dispatcher) : nullptr; |
| 42 : scoped_ptr<ui::ScopedEventDispatcher>(); | |
| 43 } | 42 } |
| 44 | 43 |
| 45 } // namespace | 44 } // namespace |
| 46 | 45 |
| 47 class NestedAcceleratorDispatcherLinux : public NestedAcceleratorDispatcher, | 46 class NestedAcceleratorDispatcherLinux : public NestedAcceleratorDispatcher, |
| 48 public ui::PlatformEventDispatcher { | 47 public ui::PlatformEventDispatcher { |
| 49 public: | 48 public: |
| 50 explicit NestedAcceleratorDispatcherLinux(NestedAcceleratorDelegate* delegate) | 49 explicit NestedAcceleratorDispatcherLinux(NestedAcceleratorDelegate* delegate) |
| 51 : NestedAcceleratorDispatcher(delegate), | 50 : NestedAcceleratorDispatcher(delegate), |
| 52 restore_dispatcher_(OverrideDispatcher(this)) {} | 51 restore_dispatcher_(OverrideDispatcher(this)) {} |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorDispatcherLinux); | 93 DISALLOW_COPY_AND_ASSIGN(NestedAcceleratorDispatcherLinux); |
| 95 }; | 94 }; |
| 96 | 95 |
| 97 scoped_ptr<NestedAcceleratorDispatcher> NestedAcceleratorDispatcher::Create( | 96 scoped_ptr<NestedAcceleratorDispatcher> NestedAcceleratorDispatcher::Create( |
| 98 NestedAcceleratorDelegate* delegate, | 97 NestedAcceleratorDelegate* delegate, |
| 99 base::MessagePumpDispatcher* nested_dispatcher) { | 98 base::MessagePumpDispatcher* nested_dispatcher) { |
| 100 return make_scoped_ptr(new NestedAcceleratorDispatcherLinux(delegate)); | 99 return make_scoped_ptr(new NestedAcceleratorDispatcherLinux(delegate)); |
| 101 } | 100 } |
| 102 | 101 |
| 103 } // namespace wm | 102 } // namespace wm |
| OLD | NEW |