| 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_UI_COCOA_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_COCOA_H
_ | 5 #ifndef CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_COCOA_H
_ |
| 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_COCOA_H
_ | 6 #define CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_COCOA_H
_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // action button in case of browser action commands). | 32 // action button in case of browser action commands). |
| 33 class ExtensionKeybindingRegistryCocoa | 33 class ExtensionKeybindingRegistryCocoa |
| 34 : public extensions::ExtensionKeybindingRegistry { | 34 : public extensions::ExtensionKeybindingRegistry { |
| 35 public: | 35 public: |
| 36 ExtensionKeybindingRegistryCocoa(Profile* profile, | 36 ExtensionKeybindingRegistryCocoa(Profile* profile, |
| 37 gfx::NativeWindow window, | 37 gfx::NativeWindow window, |
| 38 ExtensionFilter extension_filter, | 38 ExtensionFilter extension_filter, |
| 39 Delegate* delegate); | 39 Delegate* delegate); |
| 40 ~ExtensionKeybindingRegistryCocoa() override; | 40 ~ExtensionKeybindingRegistryCocoa() override; |
| 41 | 41 |
| 42 static void set_shortcut_handling_suspended(bool suspended) { | |
| 43 shortcut_handling_suspended_ = suspended; | |
| 44 } | |
| 45 static bool shortcut_handling_suspended() { | |
| 46 return shortcut_handling_suspended_; | |
| 47 } | |
| 48 | |
| 49 // For a given keyboard |event|, see if a known Extension Command registration | 42 // For a given keyboard |event|, see if a known Extension Command registration |
| 50 // exists and route the event to it. Returns true if the event was handled, | 43 // exists and route the event to it. Returns true if the event was handled, |
| 51 // false otherwise. | 44 // false otherwise. |
| 52 bool ProcessKeyEvent(const content::NativeWebKeyboardEvent& event, | 45 bool ProcessKeyEvent(const content::NativeWebKeyboardEvent& event, |
| 53 ui::AcceleratorManager::HandlerPriority priority); | 46 ui::AcceleratorManager::HandlerPriority priority); |
| 54 | 47 |
| 55 protected: | 48 protected: |
| 56 // Overridden from ExtensionKeybindingRegistry: | 49 // Overridden from ExtensionKeybindingRegistry: |
| 57 void AddExtensionKeybinding(const extensions::Extension* extension, | 50 void AddExtensionKeybinding(const extensions::Extension* extension, |
| 58 const std::string& command_name) override; | 51 const std::string& command_name) override; |
| 59 void RemoveExtensionKeybindingImpl(const ui::Accelerator& accelerator, | 52 void RemoveExtensionKeybindingImpl(const ui::Accelerator& accelerator, |
| 60 const std::string& command_name) override; | 53 const std::string& command_name) override; |
| 61 | 54 |
| 62 private: | 55 private: |
| 63 // Keeps track of whether shortcut handling is currently suspended. Shortcuts | |
| 64 // are suspended briefly while capturing which shortcut to assign to an | |
| 65 // extension command in the Config UI. If handling isn't suspended while | |
| 66 // capturing then trying to assign Ctrl+F to a command would instead result | |
| 67 // in the Find box opening. | |
| 68 static bool shortcut_handling_suspended_; | |
| 69 | |
| 70 // Weak pointer to the our profile. Not owned by us. | 56 // Weak pointer to the our profile. Not owned by us. |
| 71 Profile* profile_; | 57 Profile* profile_; |
| 72 | 58 |
| 73 // The window we are associated with. | 59 // The window we are associated with. |
| 74 gfx::NativeWindow window_; | 60 gfx::NativeWindow window_; |
| 75 | 61 |
| 76 // The content notification registrar for listening to extension events. | 62 // The content notification registrar for listening to extension events. |
| 77 content::NotificationRegistrar registrar_; | 63 content::NotificationRegistrar registrar_; |
| 78 | 64 |
| 79 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistryCocoa); | 65 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistryCocoa); |
| 80 }; | 66 }; |
| 81 | 67 |
| 82 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_COCO
A_H_ | 68 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_COCO
A_H_ |
| OLD | NEW |