OLD | NEW |
---|---|
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 CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
50 }; | 50 }; |
51 | 51 |
52 // If |extension_filter| is not ALL_EXTENSIONS, only keybindings by | 52 // If |extension_filter| is not ALL_EXTENSIONS, only keybindings by |
53 // by extensions that match the filter will be registered. | 53 // by extensions that match the filter will be registered. |
54 ExtensionKeybindingRegistry(content::BrowserContext* context, | 54 ExtensionKeybindingRegistry(content::BrowserContext* context, |
55 ExtensionFilter extension_filter, | 55 ExtensionFilter extension_filter, |
56 Delegate* delegate); | 56 Delegate* delegate); |
57 | 57 |
58 ~ExtensionKeybindingRegistry() override; | 58 ~ExtensionKeybindingRegistry() override; |
59 | 59 |
60 // Enables/Disables general shortcut handling in Chrome. Implemented in | 60 // Enables/Disables general shortcut handling in Chrome. |
61 // platform-specific ExtensionKeybindingsRegistry* files. | 61 virtual void SetShortcutHandlingSuspended(bool suspended); |
Devlin
2015/01/15 22:41:43
nit: Seeing how these are used, I might have a sma
Andre
2015/01/16 18:40:14
Done.
| |
62 static void SetShortcutHandlingSuspended(bool suspended); | 62 bool IsShortcutHandlingSuspended(); |
Devlin
2015/01/15 22:41:43
This should be hacker_style() now :)
Andre
2015/01/16 18:40:14
Done.
| |
63 | 63 |
64 // Execute the command bound to |accelerator| and provided by the extension | 64 // Execute the command bound to |accelerator| and provided by the extension |
65 // with |extension_id|, if it exists. | 65 // with |extension_id|, if it exists. |
66 void ExecuteCommand(const std::string& extension_id, | 66 void ExecuteCommand(const std::string& extension_id, |
67 const ui::Accelerator& accelerator); | 67 const ui::Accelerator& accelerator); |
68 | 68 |
69 // Check whether the specified |accelerator| has been registered. | 69 // Check whether the specified |accelerator| has been registered. |
70 bool IsAcceleratorRegistered(const ui::Accelerator& accelerator) const; | 70 bool IsAcceleratorRegistered(const ui::Accelerator& accelerator) const; |
71 | 71 |
72 protected: | 72 protected: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
166 // accelerator (which isn't media keys) has only one target, while the media | 166 // accelerator (which isn't media keys) has only one target, while the media |
167 // keys can have more than one. | 167 // keys can have more than one. |
168 typedef std::list<std::pair<std::string, std::string> > TargetList; | 168 typedef std::list<std::pair<std::string, std::string> > TargetList; |
169 typedef std::map<ui::Accelerator, TargetList> EventTargets; | 169 typedef std::map<ui::Accelerator, TargetList> EventTargets; |
170 EventTargets event_targets_; | 170 EventTargets event_targets_; |
171 | 171 |
172 // Listen to extension load, unloaded notifications. | 172 // Listen to extension load, unloaded notifications. |
173 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 173 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
174 extension_registry_observer_; | 174 extension_registry_observer_; |
175 | 175 |
176 // Keeps track of whether shortcut handling is currently suspended. Shortcuts | |
177 // are suspended briefly while capturing which shortcut to assign to an | |
178 // extension command in the Config UI. If handling isn't suspended while | |
179 // capturing then trying to assign Ctrl+F to a command would instead result | |
180 // in the Find box opening. | |
181 bool shortcut_handling_suspended_; | |
182 | |
176 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistry); | 183 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistry); |
177 }; | 184 }; |
178 | 185 |
179 } // namespace extensions | 186 } // namespace extensions |
180 | 187 |
181 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ | 188 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ |
OLD | NEW |