Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: ash/accelerators/accelerator_dispatcher.h

Issue 219743002: x11: Move X event handling out of the message-pump. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: tot-merge-r261267 Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/accelerators/accelerator_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_ 5 #ifndef ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_
6 #define ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_ 6 #define ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_
7 7
8 #include "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/message_loop/message_pump_dispatcher.h" 10 #include "base/memory/scoped_ptr.h"
11
12 namespace base {
13 class MessagePumpDispatcher;
14 class RunLoop;
15 }
16
17 namespace ui {
18 class KeyEvent;
19 }
11 20
12 namespace ash { 21 namespace ash {
13 22
14 // Dispatcher for handling accelerators from menu. 23 // Dispatcher for handling accelerators from menu.
15 // 24 //
16 // Wraps a nested dispatcher to which control is passed if no accelerator key 25 // Wraps a nested dispatcher to which control is passed if no accelerator key
17 // has been pressed. If the nested dispatcher is NULL, then the control is 26 // has been pressed. If the nested dispatcher is NULL, then the control is
18 // passed back to the default dispatcher. 27 // passed back to the default dispatcher.
19 // TODO(pkotwicz): Add support for a |nested_dispatcher| which sends 28 // TODO(pkotwicz): Add support for a |nested_dispatcher| which sends
20 // events to a system IME. 29 // events to a system IME.
21 class ASH_EXPORT AcceleratorDispatcher : public base::MessagePumpDispatcher { 30 class ASH_EXPORT AcceleratorDispatcher {
22 public: 31 public:
23 explicit AcceleratorDispatcher(base::MessagePumpDispatcher* dispatcher); 32 virtual ~AcceleratorDispatcher() {}
24 virtual ~AcceleratorDispatcher();
25 33
26 // MessagePumpDispatcher overrides: 34 static scoped_ptr<AcceleratorDispatcher> Create(
27 virtual uint32_t Dispatch(const base::NativeEvent& event) OVERRIDE; 35 base::MessagePumpDispatcher* nested_dispatcher);
36
37 // Creates a base::RunLoop object to run a nested message loop.
38 virtual scoped_ptr<base::RunLoop> CreateRunLoop() = 0;
39
40 protected:
41 AcceleratorDispatcher() {}
42
43 // Closes any open menu if the key-event could potentially be a system
44 // accelerator.
45 // Returns whether a menu was closed.
46 bool MenuClosedForPossibleAccelerator(const ui::KeyEvent& key_event);
47
48 // Attempts to trigger an accelerator for the key-event.
49 // Returns whether an accelerator was triggered.
50 bool AcceleratorProcessedForKeyEvent(const ui::KeyEvent& key_event);
28 51
29 private: 52 private:
30 base::MessagePumpDispatcher* nested_dispatcher_;
31
32 DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcher); 53 DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcher);
33 }; 54 };
34 55
35 } // namespace ash 56 } // namespace ash
36 57
37 #endif // ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_ 58 #endif // ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698