Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(21)

Side by Side Diff: chrome/browser/ui/cocoa/extensions/extension_keybinding_registry_cocoa.h

Issue 23812010: Implement first part of supporting global extension commands. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gclient sync Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <map>
9 #include <string> 8 #include <string>
10 #include <utility> 9 #include <utility>
11 10
12 #include "chrome/browser/extensions/extension_keybinding_registry.h" 11 #include "chrome/browser/extensions/extension_keybinding_registry.h"
13 #include "ui/base/accelerators/accelerator.h" 12 #include "ui/base/accelerators/accelerator.h"
14 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
15 14
16 class Profile; 15 class Profile;
17 16
18 namespace content { 17 namespace content {
(...skipping 30 matching lines...) Expand all
49 // For a given keyboard |event|, see if a known Extension Command registration 48 // 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, 49 // exists and route the event to it. Returns true if the event was handled,
51 // false otherwise. 50 // false otherwise.
52 bool ProcessKeyEvent(const content::NativeWebKeyboardEvent& event); 51 bool ProcessKeyEvent(const content::NativeWebKeyboardEvent& event);
53 52
54 protected: 53 protected:
55 // Overridden from ExtensionKeybindingRegistry: 54 // Overridden from ExtensionKeybindingRegistry:
56 virtual void AddExtensionKeybinding( 55 virtual void AddExtensionKeybinding(
57 const extensions::Extension* extension, 56 const extensions::Extension* extension,
58 const std::string& command_name) OVERRIDE; 57 const std::string& command_name) OVERRIDE;
59 virtual void RemoveExtensionKeybinding( 58 virtual void RemoveExtensionKeybindingImpl(
60 const extensions::Extension* extension, 59 const ui::Accelerator& accelerator,
61 const std::string& command_name) OVERRIDE; 60 const std::string& command_name) OVERRIDE;
62 61
63 private: 62 private:
64 // Keeps track of whether shortcut handling is currently suspended. Shortcuts 63 // Keeps track of whether shortcut handling is currently suspended. Shortcuts
65 // are suspended briefly while capturing which shortcut to assign to an 64 // are suspended briefly while capturing which shortcut to assign to an
66 // extension command in the Config UI. If handling isn't suspended while 65 // extension command in the Config UI. If handling isn't suspended while
67 // capturing then trying to assign Ctrl+F to a command would instead result 66 // capturing then trying to assign Ctrl+F to a command would instead result
68 // in the Find box opening. 67 // in the Find box opening.
69 static bool shortcut_handling_suspended_; 68 static bool shortcut_handling_suspended_;
70 69
71 // Weak pointer to the our profile. Not owned by us. 70 // Weak pointer to the our profile. Not owned by us.
72 Profile* profile_; 71 Profile* profile_;
73 72
74 // The window we are associated with. 73 // The window we are associated with.
75 gfx::NativeWindow window_; 74 gfx::NativeWindow window_;
76 75
77 // Maps an accelerator to a string pair (extension id, command name) for
78 // commands that have been registered. Unlike its Views counterpart, this map
79 // contains browserAction and pageAction commands (but does not route those
80 // events), so that we can query priority handlers in HasPriorityHandler(...).
81 typedef std::map< ui::Accelerator,
82 std::pair<std::string, std::string> > EventTargets;
83 EventTargets event_targets_;
84
85 // The content notification registrar for listening to extension events. 76 // The content notification registrar for listening to extension events.
86 content::NotificationRegistrar registrar_; 77 content::NotificationRegistrar registrar_;
87 78
88 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistryCocoa); 79 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistryCocoa);
89 }; 80 };
90 81
91 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_COCO A_H_ 82 #endif // CHROME_BROWSER_UI_COCOA_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_COCO A_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698