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

Side by Side Diff: athena/input/public/accelerator_manager.h

Issue 305873002: InputManager/AcceleratorManager for athena (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
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 ATHENA_INPUT_PUBLIC_ACCELERATOR_MANAGER_H_
6 #define ATHENA_INPUT_PUBLIC_ACCELERATOR_MANAGER_H_
7
8 #include "athena/athena_export.h"
9 #include "ui/events/keycodes/keyboard_codes.h"
10
11 namespace ui {
12 class Accelerator;
13 }
14
15 namespace athena {
16
17 enum TriggerEvent {
18 TRIGGER_ON_PRESS,
19 TRIGGER_ON_RELEASE,
20 };
21
22 // Accelerator flags.
23 enum AcceleratorFlags {
24 AF_NONE = 0,
25 AF_NON_AUTO_REPEATABLE = 1 << 0,
26 AF_RESERVED = 1 << 1,
27 AF_DEBUG = 1 << 2,
28 };
29
30 struct AcceleratorData {
31 // true if the accelerator should be triggered upon ui::ET_KEY_PRESSED
32 TriggerEvent trigger_event;
33 ui::KeyboardCode keycode; // KeyEvent event flags.
34 int keyevent_flags; // Combination of ui::KeyEventFlags
35 int command_id; // ID to distinguish
36 int accelerator_flags; // Combination of AcceleratorFlags;
37 };
38
39 // An interface that implements behavior for the set of
40 // accelerators.
41 class ATHENA_EXPORT AcceleratorHandler {
42 public:
43 virtual ~AcceleratorHandler() {}
44
45 virtual bool IsCommandEnabled(int command_id) const = 0;
46 virtual bool OnAcceleratorFired(int command_id,
47 const ui::Accelerator& accelerator) = 0;
48 };
49
50 class AcceleratorManager {
sadrul 2014/06/04 04:31:48 Can we use the existing ui:AcceleratorManager and
51 public:
52 virtual ~AcceleratorManager() {}
53
54 // Register accelerators and its handler that will be invoked when
55 // one of accelerator is fired.
56 virtual void RegisterAccelerators(const AcceleratorData accelerators[],
57 size_t num_accelerators,
58 AcceleratorHandler* handler) = 0;
59
60 // Enables accelerators that has a AF_DEBUG flag.
61 virtual void EnableDebugAccelerators() = 0;
62 };
63
64 } // namespace athena
65
66 #endif // ATHENA_INPUT_PUBLIC_ACCELERATOR_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698