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

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

Issue 298703007: Refactor and move ash independent nested accelerator code to ui/wm/core (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: skip test if platform does not support PES Created 6 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_
6 #define ASH_ACCELERATORS_ACCELERATOR_DISPATCHER_H_
7
8 #include "ash/ash_export.h"
9 #include "base/macros.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 }
20
21 namespace ash {
22
23 // Dispatcher for handling accelerators from menu.
24 //
25 // Wraps a nested dispatcher to which control is passed if no accelerator key
26 // has been pressed. If the nested dispatcher is NULL, then the control is
27 // passed back to the default dispatcher.
28 // TODO(pkotwicz): Add support for a |nested_dispatcher| which sends
29 // events to a system IME.
30 class ASH_EXPORT AcceleratorDispatcher {
31 public:
32 virtual ~AcceleratorDispatcher() {}
33
34 static scoped_ptr<AcceleratorDispatcher> Create(
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);
51
52 private:
53 DISALLOW_COPY_AND_ASSIGN(AcceleratorDispatcher);
54 };
55
56 } // namespace ash
57
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