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> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "content/public/browser/notification_details.h" | 13 #include "content/public/browser/notification_details.h" |
14 #include "content/public/browser/notification_observer.h" | 14 #include "content/public/browser/notification_observer.h" |
15 #include "content/public/browser/notification_registrar.h" | 15 #include "content/public/browser/notification_registrar.h" |
16 #include "content/public/browser/notification_source.h" | 16 #include "content/public/browser/notification_source.h" |
17 | 17 |
18 class Profile; | 18 class Profile; |
19 | 19 |
| 20 namespace content { |
| 21 class BrowserContext; |
| 22 } |
| 23 |
20 namespace ui { | 24 namespace ui { |
21 class Accelerator; | 25 class Accelerator; |
22 } | 26 } |
23 | 27 |
24 namespace extensions { | 28 namespace extensions { |
25 | 29 |
26 class ActiveTabPermissionGranter; | 30 class ActiveTabPermissionGranter; |
27 class Extension; | 31 class Extension; |
28 | 32 |
29 // The ExtensionKeybindingRegistry is a class that handles the cross-platform | 33 // The ExtensionKeybindingRegistry is a class that handles the cross-platform |
30 // logic for keyboard accelerators. See platform-specific implementations for | 34 // logic for keyboard accelerators. See platform-specific implementations for |
31 // implementation details for each platform. | 35 // implementation details for each platform. |
32 class ExtensionKeybindingRegistry : public content::NotificationObserver { | 36 class ExtensionKeybindingRegistry : public content::NotificationObserver { |
33 public: | 37 public: |
34 enum ExtensionFilter { | 38 enum ExtensionFilter { |
35 ALL_EXTENSIONS, | 39 ALL_EXTENSIONS, |
36 PLATFORM_APPS_ONLY | 40 PLATFORM_APPS_ONLY |
37 }; | 41 }; |
38 | 42 |
39 class Delegate { | 43 class Delegate { |
40 public: | 44 public: |
41 // Gets the ActiveTabPermissionGranter for the active tab, if any. | 45 // Gets the ActiveTabPermissionGranter for the active tab, if any. |
42 // If there is no active tab then returns NULL. | 46 // If there is no active tab then returns NULL. |
43 virtual ActiveTabPermissionGranter* GetActiveTabPermissionGranter() = 0; | 47 virtual ActiveTabPermissionGranter* GetActiveTabPermissionGranter() = 0; |
44 }; | 48 }; |
45 | 49 |
46 // If |extension_filter| is not ALL_EXTENSIONS, only keybindings by | 50 // If |extension_filter| is not ALL_EXTENSIONS, only keybindings by |
47 // by extensions that match the filter will be registered. | 51 // by extensions that match the filter will be registered. |
48 ExtensionKeybindingRegistry(Profile* profile, | 52 ExtensionKeybindingRegistry(content::BrowserContext* context, |
49 ExtensionFilter extension_filter, | 53 ExtensionFilter extension_filter, |
50 Delegate* delegate); | 54 Delegate* delegate); |
51 | 55 |
52 virtual ~ExtensionKeybindingRegistry(); | 56 virtual ~ExtensionKeybindingRegistry(); |
53 | 57 |
54 // Enables/Disables general shortcut handing in Chrome. Implemented in | 58 // Enables/Disables general shortcut handing in Chrome. Implemented in |
55 // platform-specific ExtensionKeybindingsRegistry* files. | 59 // platform-specific ExtensionKeybindingsRegistry* files. |
56 static void SetShortcutHandlingSuspended(bool suspended); | 60 static void SetShortcutHandlingSuspended(bool suspended); |
57 | 61 |
58 // Overridden from content::NotificationObserver: | 62 // Overridden from content::NotificationObserver: |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 123 |
120 // Weak pointer to our delegate. Not owned by us. Must outlive this class. | 124 // Weak pointer to our delegate. Not owned by us. Must outlive this class. |
121 Delegate* delegate_; | 125 Delegate* delegate_; |
122 | 126 |
123 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistry); | 127 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistry); |
124 }; | 128 }; |
125 | 129 |
126 } // namespace extensions | 130 } // namespace extensions |
127 | 131 |
128 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ | 132 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ |
OLD | NEW |