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 "ash/accelerators/accelerator_dispatcher.h" | 5 #include "ash/accelerators/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/events/event.h" | 9 #include "ui/events/event.h" |
10 #include "ui/events/platform/platform_event_dispatcher.h" | 10 #include "ui/events/platform/platform_event_dispatcher.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 | 62 |
63 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE { | 63 virtual uint32_t DispatchEvent(const ui::PlatformEvent& event) OVERRIDE { |
64 if (IsKeyEvent(event)) { | 64 if (IsKeyEvent(event)) { |
65 ui::KeyEvent key_event(event, false); | 65 ui::KeyEvent key_event(event, false); |
66 if (MenuClosedForPossibleAccelerator(key_event)) { | 66 if (MenuClosedForPossibleAccelerator(key_event)) { |
67 #if defined(USE_X11) | 67 #if defined(USE_X11) |
68 XPutBackEvent(event->xany.display, event); | 68 XPutBackEvent(event->xany.display, event); |
69 #else | 69 #else |
70 NOTIMPLEMENTED(); | 70 NOTIMPLEMENTED(); |
71 #endif | 71 #endif |
72 return ui::POST_DISPATCH_QUIT_LOOP; | 72 return ui::POST_DISPATCH_NONE; |
sadrul
2014/05/14 17:46:33
MenuClosedForPossibleAccelerator() (line 66) calls
| |
73 } | 73 } |
74 | 74 |
75 if (AcceleratorProcessedForKeyEvent(key_event)) | 75 if (AcceleratorProcessedForKeyEvent(key_event)) |
76 return ui::POST_DISPATCH_NONE; | 76 return ui::POST_DISPATCH_NONE; |
77 } | 77 } |
78 | 78 |
79 ui::PlatformEventDispatcher* prev = *restore_dispatcher_; | 79 ui::PlatformEventDispatcher* prev = *restore_dispatcher_; |
80 return prev ? prev->DispatchEvent(event) | 80 return prev ? prev->DispatchEvent(event) |
81 : ui::POST_DISPATCH_PERFORM_DEFAULT; | 81 : ui::POST_DISPATCH_PERFORM_DEFAULT; |
82 } | 82 } |
83 | 83 |
84 scoped_ptr<ui::ScopedEventDispatcher> restore_dispatcher_; | 84 scoped_ptr<ui::ScopedEventDispatcher> restore_dispatcher_; |
85 | 85 |
86 DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcherLinux); | 86 DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcherLinux); |
87 }; | 87 }; |
88 | 88 |
89 scoped_ptr<AcceleratorDispatcher> AcceleratorDispatcher::Create( | 89 scoped_ptr<AcceleratorDispatcher> AcceleratorDispatcher::Create( |
90 base::MessagePumpDispatcher* nested_dispatcher) { | 90 base::MessagePumpDispatcher* nested_dispatcher) { |
91 return scoped_ptr<AcceleratorDispatcher>(new AcceleratorDispatcherLinux()); | 91 return scoped_ptr<AcceleratorDispatcher>(new AcceleratorDispatcherLinux()); |
92 } | 92 } |
93 | 93 |
94 } // namespace ash | 94 } // namespace ash |
OLD | NEW |