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

Side by Side Diff: athena/input/accelerator_manager_impl.h

Issue 332443005: Enable accelerators on web activity window (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
« no previous file with comments | « athena/content/web_activity.cc ('k') | athena/input/accelerator_manager_impl.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 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 #ifndef ATHENA_INPUT_ACCELERATOR_MANAGER_H_ 5 #ifndef ATHENA_INPUT_ACCELERATOR_MANAGER_H_
6 #define ATHENA_INPUT_ACCELERATOR_MANAGER_H_ 6 #define ATHENA_INPUT_ACCELERATOR_MANAGER_H_
7 7
8 #include "athena/input/public/accelerator_manager.h" 8 #include "athena/input/public/accelerator_manager.h"
9 9
10 #include <map> 10 #include <map>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "ui/base/accelerators/accelerator.h" 13 #include "ui/base/accelerators/accelerator.h"
14 #include "ui/events/event_target_iterator.h" 14 #include "ui/events/event_target_iterator.h"
15 15
16 namespace aura { 16 namespace aura {
17 class Window; 17 class Window;
18 } 18 }
19 19
20 namespace ui {
21 class AcceleratorManager;
22 }
23
24 namespace wm { 20 namespace wm {
25 class AcceleratorFilter; 21 class AcceleratorFilter;
26 class NestedAcceleratorController; 22 class NestedAcceleratorController;
27 } 23 }
28 24
29 namespace athena { 25 namespace athena {
30 26
31 // AcceleratorManagerImpl provides a API to register accelerators 27 // AcceleratorManagerImpl provides a API to register accelerators
32 // for athena modules. It hides various details on accelerator handling 28 // for athena modules. It hides various details on accelerator handling
33 // such as how to handle accelerator in a nested loop, reserved accelerators 29 // such as how to handle accelerator in a nested loop, reserved accelerators
34 // and repeated accelerators. 30 // and repeated accelerators.
35 class AcceleratorManagerImpl : public AcceleratorManager, 31 class AcceleratorManagerImpl : public AcceleratorManager,
36 public ui::AcceleratorTarget { 32 public ui::AcceleratorTarget {
37 public: 33 public:
38 AcceleratorManagerImpl(); 34 class AcceleratorWrapper;
Jun Mukai 2014/06/12 21:30:31 then I think you should make this class decl to pr
oshima 2014/06/12 22:35:23 I unfortunately can't without exposing internal cl
Jun Mukai 2014/06/12 22:50:26 Confused. Which one exactly you need to expose, an
oshima 2014/06/12 23:11:01 Subclasses (UIAcceleratorManagerWrapper, FocusMana
35
36 // Creates an AcceleratorManager for global accelerators.
37 // This is the one returned by AcceleratorManager::Get()
38 static AcceleratorManagerImpl* CreateGlobalAcceleratorManager();
39
40 // Creates an AcceleratorManager for focus manager.
41 static scoped_ptr<AcceleratorManager> CreateForFocusManager(
42 views::FocusManager* focus_manager);
43
39 virtual ~AcceleratorManagerImpl(); 44 virtual ~AcceleratorManagerImpl();
40 45
41 void Init(); 46 void Init();
42 47
43 void OnRootWindowCreated(aura::Window* root_window); 48 void OnRootWindowCreated(aura::Window* root_window);
44 49
45 bool IsRegistered(const ui::Accelerator& accelerator) const;
46 bool IsReserved(const ui::Accelerator& accelerator) const;
47 bool Process(const ui::Accelerator& accelerator); 50 bool Process(const ui::Accelerator& accelerator);
48 51
52 // AcceleratorManager:
53 // This is made public so that implementation classes can use this.
54 virtual bool IsRegistered(const ui::Accelerator& accelerator,
55 int flags) const OVERRIDE;
56
49 private: 57 private:
58 class InternalData;
59
60 explicit AcceleratorManagerImpl(AcceleratorWrapper* wrapper);
61
50 // AcceleratorManager: 62 // AcceleratorManager:
51 virtual void RegisterAccelerators(const AcceleratorData accelerators[], 63 virtual void RegisterAccelerators(const AcceleratorData accelerators[],
52 size_t num_accelerators, 64 size_t num_accelerators,
53 AcceleratorHandler* handler) OVERRIDE; 65 AcceleratorHandler* handler) OVERRIDE;
54 virtual void SetDebugAcceleratorsEnabled(bool enabled) OVERRIDE; 66 virtual void SetDebugAcceleratorsEnabled(bool enabled) OVERRIDE;
55 67
56 // ui::AcceleratorTarget: 68 // ui::AcceleratorTarget:
57 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE; 69 virtual bool AcceleratorPressed(const ui::Accelerator& accelerator) OVERRIDE;
58 virtual bool CanHandleAccelerators() const OVERRIDE; 70 virtual bool CanHandleAccelerators() const OVERRIDE;
59 71
60 class InternalData;
61
62 void RegisterAccelerator(const AcceleratorData& accelerator, 72 void RegisterAccelerator(const AcceleratorData& accelerator,
63 AcceleratorHandler* handler); 73 AcceleratorHandler* handler);
64 74
65 std::map<ui::Accelerator, InternalData> accelerators_; 75 std::map<ui::Accelerator, InternalData> accelerators_;
66 scoped_ptr<ui::AcceleratorManager> accelerator_manager_; 76 scoped_ptr<AcceleratorWrapper> accelerator_wrapper_;
67
68 scoped_ptr<wm::AcceleratorFilter> accelerator_filter_; 77 scoped_ptr<wm::AcceleratorFilter> accelerator_filter_;
69 scoped_ptr<wm::NestedAcceleratorController> nested_accelerator_controller_; 78 scoped_ptr<wm::NestedAcceleratorController> nested_accelerator_controller_;
70
71 bool debug_accelerators_enabled_; 79 bool debug_accelerators_enabled_;
72 80
73 DISALLOW_COPY_AND_ASSIGN(AcceleratorManagerImpl); 81 DISALLOW_COPY_AND_ASSIGN(AcceleratorManagerImpl);
74 }; 82 };
75 83
76 } // namespace athena 84 } // namespace athena
77 85
78 #endif // ATHENA_INPUT_ACCELERATOR_MANAGER_H_ 86 #endif // ATHENA_INPUT_ACCELERATOR_MANAGER_H_
OLDNEW
« no previous file with comments | « athena/content/web_activity.cc ('k') | athena/input/accelerator_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698