| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // window or on the global registry. | 58 // window or on the global registry. |
| 59 bool IsRegistered(const ui::Accelerator& accelerator); | 59 bool IsRegistered(const ui::Accelerator& accelerator); |
| 60 | 60 |
| 61 private: | 61 private: |
| 62 friend class BrowserContextKeyedAPIFactory<ExtensionCommandsGlobalRegistry>; | 62 friend class BrowserContextKeyedAPIFactory<ExtensionCommandsGlobalRegistry>; |
| 63 | 63 |
| 64 // BrowserContextKeyedAPI implementation. | 64 // BrowserContextKeyedAPI implementation. |
| 65 static const char* service_name() { | 65 static const char* service_name() { |
| 66 return "ExtensionCommandsGlobalRegistry"; | 66 return "ExtensionCommandsGlobalRegistry"; |
| 67 } | 67 } |
| 68 static const bool kServiceRedirectedInIncognito = true; |
| 68 | 69 |
| 69 // Overridden from ExtensionKeybindingRegistry: | 70 // Overridden from ExtensionKeybindingRegistry: |
| 70 void AddExtensionKeybindings(const Extension* extension, | 71 void AddExtensionKeybindings(const Extension* extension, |
| 71 const std::string& command_name) override; | 72 const std::string& command_name) override; |
| 72 void RemoveExtensionKeybindingImpl(const ui::Accelerator& accelerator, | 73 void RemoveExtensionKeybindingImpl(const ui::Accelerator& accelerator, |
| 73 const std::string& command_name) override; | 74 const std::string& command_name) override; |
| 74 void OnShortcutHandlingSuspended(bool suspended) override; | 75 void OnShortcutHandlingSuspended(bool suspended) override; |
| 75 | 76 |
| 76 // Called by the GlobalShortcutListener object when a shortcut this class has | 77 // Called by the GlobalShortcutListener object when a shortcut this class has |
| 77 // registered for has been pressed. | 78 // registered for has been pressed. |
| 78 void OnKeyPressed(const ui::Accelerator& accelerator) override; | 79 void OnKeyPressed(const ui::Accelerator& accelerator) override; |
| 79 | 80 |
| 80 // Weak pointer to our browser context. Not owned by us. | 81 // Weak pointer to our browser context. Not owned by us. |
| 81 content::BrowserContext* browser_context_; | 82 content::BrowserContext* browser_context_; |
| 82 | 83 |
| 83 // The global commands registry not only keeps track of global commands | 84 // The global commands registry not only keeps track of global commands |
| 84 // registered, but also of which non-global command registry is active | 85 // registered, but also of which non-global command registry is active |
| 85 // (belonging to the currently active window). Only valid for TOOLKIT_VIEWS | 86 // (belonging to the currently active window). Only valid for TOOLKIT_VIEWS |
| 86 // and | 87 // and |
| 87 // NULL otherwise. | 88 // NULL otherwise. |
| 88 ExtensionKeybindingRegistry* registry_for_active_window_; | 89 ExtensionKeybindingRegistry* registry_for_active_window_; |
| 89 | 90 |
| 90 DISALLOW_COPY_AND_ASSIGN(ExtensionCommandsGlobalRegistry); | 91 DISALLOW_COPY_AND_ASSIGN(ExtensionCommandsGlobalRegistry); |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 } // namespace extensions | 94 } // namespace extensions |
| 94 | 95 |
| 95 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_COMMANDS_GLOBAL_REGISTRY_H_ | 96 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_COMMANDS_GLOBAL_REGISTRY_H_ |
| OLD | NEW |