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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "content/public/browser/notification_details.h" | 11 #include "content/public/browser/notification_details.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 #include "content/public/browser/notification_source.h" | 14 #include "content/public/browser/notification_source.h" |
15 | 15 |
16 class Profile; | 16 class Profile; |
17 | 17 |
| 18 namespace ui { |
| 19 class Accelerator; |
| 20 } |
| 21 |
18 namespace extensions { | 22 namespace extensions { |
19 | 23 |
20 class ActiveTabPermissionGranter; | 24 class ActiveTabPermissionGranter; |
21 class Extension; | 25 class Extension; |
22 | 26 |
23 // The ExtensionKeybindingRegistry is a class that handles the cross-platform | 27 // The ExtensionKeybindingRegistry is a class that handles the cross-platform |
24 // logic for keyboard accelerators. See platform-specific implementations for | 28 // logic for keyboard accelerators. See platform-specific implementations for |
25 // implementation details for each platform. | 29 // implementation details for each platform. |
26 class ExtensionKeybindingRegistry : public content::NotificationObserver { | 30 class ExtensionKeybindingRegistry : public content::NotificationObserver { |
27 public: | 31 public: |
(...skipping 14 matching lines...) Expand all Loading... |
42 ExtensionKeybindingRegistry(Profile* profile, | 46 ExtensionKeybindingRegistry(Profile* profile, |
43 ExtensionFilter extension_filter, | 47 ExtensionFilter extension_filter, |
44 Delegate* delegate); | 48 Delegate* delegate); |
45 | 49 |
46 virtual ~ExtensionKeybindingRegistry(); | 50 virtual ~ExtensionKeybindingRegistry(); |
47 | 51 |
48 // Enables/Disables general shortcut handing in Chrome. Implemented in | 52 // Enables/Disables general shortcut handing in Chrome. Implemented in |
49 // platform-specific ExtensionKeybindingsRegistry* files. | 53 // platform-specific ExtensionKeybindingsRegistry* files. |
50 static void SetShortcutHandlingSuspended(bool suspended); | 54 static void SetShortcutHandlingSuspended(bool suspended); |
51 | 55 |
| 56 // Returns true if the given |accelerator| is currently registered by |
| 57 // Chrome. Implemented in platform-specific ExtensionKeybindingsRegistry* |
| 58 // files. |
| 59 static bool IsChromeAccelerator(const ui::Accelerator& accelerator); |
| 60 |
52 // Overridden from content::NotificationObserver: | 61 // Overridden from content::NotificationObserver: |
53 virtual void Observe(int type, | 62 virtual void Observe(int type, |
54 const content::NotificationSource& source, | 63 const content::NotificationSource& source, |
55 const content::NotificationDetails& details) OVERRIDE; | 64 const content::NotificationDetails& details) OVERRIDE; |
56 | 65 |
57 protected: | 66 protected: |
58 // Add extension keybinding for the events defined by the |extension|. | 67 // Add extension keybinding for the events defined by the |extension|. |
59 // |command_name| is optional, but if not blank then only the command | 68 // |command_name| is optional, but if not blank then only the command |
60 // specified will be added. | 69 // specified will be added. |
61 virtual void AddExtensionKeybinding( | 70 virtual void AddExtensionKeybinding( |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 | 102 |
94 // Weak pointer to our delegate. Not owned by us. Must outlive this class. | 103 // Weak pointer to our delegate. Not owned by us. Must outlive this class. |
95 Delegate* delegate_; | 104 Delegate* delegate_; |
96 | 105 |
97 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistry); | 106 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistry); |
98 }; | 107 }; |
99 | 108 |
100 } // namespace extensions | 109 } // namespace extensions |
101 | 110 |
102 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ | 111 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ |
OLD | NEW |