| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_COMMANDS_GLOBAL_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_COMMANDS_GLOBAL_REGISTRY_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_COMMANDS_GLOBAL_REGISTRY_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_COMMANDS_GLOBAL_REGISTRY_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 public GlobalShortcutListener::Observer { | 34 public GlobalShortcutListener::Observer { |
| 35 public: | 35 public: |
| 36 // BrowserContextKeyedAPI implementation. | 36 // BrowserContextKeyedAPI implementation. |
| 37 static BrowserContextKeyedAPIFactory<ExtensionCommandsGlobalRegistry>* | 37 static BrowserContextKeyedAPIFactory<ExtensionCommandsGlobalRegistry>* |
| 38 GetFactoryInstance(); | 38 GetFactoryInstance(); |
| 39 | 39 |
| 40 // Convenience method to get the ExtensionCommandsGlobalRegistry for a | 40 // Convenience method to get the ExtensionCommandsGlobalRegistry for a |
| 41 // profile. | 41 // profile. |
| 42 static ExtensionCommandsGlobalRegistry* Get(content::BrowserContext* context); | 42 static ExtensionCommandsGlobalRegistry* Get(content::BrowserContext* context); |
| 43 | 43 |
| 44 // Enables/Disables global shortcut handling in Chrome. | |
| 45 static void SetShortcutHandlingSuspended(bool suspended); | |
| 46 | |
| 47 explicit ExtensionCommandsGlobalRegistry(content::BrowserContext* context); | 44 explicit ExtensionCommandsGlobalRegistry(content::BrowserContext* context); |
| 48 ~ExtensionCommandsGlobalRegistry() override; | 45 ~ExtensionCommandsGlobalRegistry() override; |
| 49 | 46 |
| 50 // Returns which non-global command registry is active (belonging to the | 47 // Returns which non-global command registry is active (belonging to the |
| 51 // currently active window). | 48 // currently active window). |
| 52 ExtensionKeybindingRegistry* registry_for_active_window() { | 49 ExtensionKeybindingRegistry* registry_for_active_window() { |
| 53 return registry_for_active_window_; | 50 return registry_for_active_window_; |
| 54 } | 51 } |
| 55 | 52 |
| 56 void set_registry_for_active_window(ExtensionKeybindingRegistry* registry) { | 53 void set_registry_for_active_window(ExtensionKeybindingRegistry* registry) { |
| 57 registry_for_active_window_ = registry; | 54 registry_for_active_window_ = registry; |
| 58 } | 55 } |
| 59 | 56 |
| 60 // Returns whether |accelerator| is registered on the registry for the active | 57 // Returns whether |accelerator| is registered on the registry for the active |
| 61 // window or on the global registry. | 58 // window or on the global registry. |
| 62 bool IsRegistered(const ui::Accelerator& accelerator); | 59 bool IsRegistered(const ui::Accelerator& accelerator); |
| 63 | 60 |
| 61 // Overridden from ExtensingKeybindingRegistry. |
| 62 void SetShortcutHandlingSuspended(bool suspended) override; |
| 63 |
| 64 private: | 64 private: |
| 65 friend class BrowserContextKeyedAPIFactory<ExtensionCommandsGlobalRegistry>; | 65 friend class BrowserContextKeyedAPIFactory<ExtensionCommandsGlobalRegistry>; |
| 66 | 66 |
| 67 // BrowserContextKeyedAPI implementation. | 67 // BrowserContextKeyedAPI implementation. |
| 68 static const char* service_name() { | 68 static const char* service_name() { |
| 69 return "ExtensionCommandsGlobalRegistry"; | 69 return "ExtensionCommandsGlobalRegistry"; |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Overridden from ExtensionKeybindingRegistry: | 72 // Overridden from ExtensionKeybindingRegistry: |
| 73 void AddExtensionKeybindings(const Extension* extension, | 73 void AddExtensionKeybindings(const Extension* extension, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 88 // and | 88 // and |
| 89 // NULL otherwise. | 89 // NULL otherwise. |
| 90 ExtensionKeybindingRegistry* registry_for_active_window_; | 90 ExtensionKeybindingRegistry* registry_for_active_window_; |
| 91 | 91 |
| 92 DISALLOW_COPY_AND_ASSIGN(ExtensionCommandsGlobalRegistry); | 92 DISALLOW_COPY_AND_ASSIGN(ExtensionCommandsGlobalRegistry); |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 } // namespace extensions | 95 } // namespace extensions |
| 96 | 96 |
| 97 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_COMMANDS_GLOBAL_REGISTRY_H_ | 97 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_COMMANDS_GLOBAL_REGISTRY_H_ |
| OLD | NEW |