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

Side by Side Diff: ui/base/accelerators/accelerator_manager.h

Issue 10381145: WIP: Always update ui::AcceleratorManager Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 5 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
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 UI_BASE_ACCELERATORS_ACCELERATOR_MANAGER_H_ 5 #ifndef UI_BASE_ACCELERATORS_ACCELERATOR_MANAGER_H_
6 #define UI_BASE_ACCELERATORS_ACCELERATOR_MANAGER_H_ 6 #define UI_BASE_ACCELERATORS_ACCELERATOR_MANAGER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <map> 9 #include <map>
10 #include <utility> 10 #include <utility>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 bool Process(const Accelerator& accelerator); 63 bool Process(const Accelerator& accelerator);
64 64
65 // Returns the AcceleratorTarget that should be activated for the specified 65 // Returns the AcceleratorTarget that should be activated for the specified
66 // keyboard accelerator, or NULL if no view is registered for that keyboard 66 // keyboard accelerator, or NULL if no view is registered for that keyboard
67 // accelerator. 67 // accelerator.
68 AcceleratorTarget* GetCurrentTarget(const Accelerator& accelertor) const; 68 AcceleratorTarget* GetCurrentTarget(const Accelerator& accelertor) const;
69 69
70 // Whether the given |accelerator| has a priority handler associated with it. 70 // Whether the given |accelerator| has a priority handler associated with it.
71 bool HasPriorityHandler(const Accelerator& accelerator) const; 71 bool HasPriorityHandler(const Accelerator& accelerator) const;
72 72
73 // Updates last_event_ without calling Process(). The function should be
74 // called when the |event| is consumed by some other component before this
75 // manager processes it.
76 void set_last_event(const Accelerator& event) {
77 last_event_ = event;
78 }
79
80 private:
73 // Returns false when Process() should never handle the |accelerator|. 81 // Returns false when Process() should never handle the |accelerator|.
74 bool ShouldHandle(const Accelerator& accelerator) const; 82 bool ShouldHandle(const Accelerator& accelerator) const;
75 83
76 private:
77 // The accelerators and associated targets. 84 // The accelerators and associated targets.
78 typedef std::list<AcceleratorTarget*> AcceleratorTargetList; 85 typedef std::list<AcceleratorTarget*> AcceleratorTargetList;
79 // This construct pairs together a |bool| (denoting whether the list contains 86 // This construct pairs together a |bool| (denoting whether the list contains
80 // a priority_handler at the front) with the list of AcceleratorTargets. 87 // a priority_handler at the front) with the list of AcceleratorTargets.
81 typedef std::pair<bool, AcceleratorTargetList> AcceleratorTargets; 88 typedef std::pair<bool, AcceleratorTargetList> AcceleratorTargets;
82 typedef std::map<Accelerator, AcceleratorTargets> AcceleratorMap; 89 typedef std::map<Accelerator, AcceleratorTargets> AcceleratorMap;
83 AcceleratorMap accelerators_; 90 AcceleratorMap accelerators_;
84 91
85 // An event passed to Process() last time. 92 // An event passed to Process() last time.
86 EventType last_event_type_; 93 Accelerator last_event_;
87 94
88 DISALLOW_COPY_AND_ASSIGN(AcceleratorManager); 95 DISALLOW_COPY_AND_ASSIGN(AcceleratorManager);
89 }; 96 };
90 97
91 } // namespace ui 98 } // namespace ui
92 99
93 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_MANAGER_H_ 100 #endif // UI_BASE_ACCELERATORS_ACCELERATOR_MANAGER_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/unhandled_keyboard_event_handler_aurax11.cc ('k') | ui/base/accelerators/accelerator_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698