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

Side by Side Diff: chrome/browser/extensions/extension_keybinding_registry.h

Issue 64273008: [Windows] Finish global and non-global media keys support on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address some comments. Created 7 years, 1 month 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
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_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 <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 const ui::Accelerator& accelerator, 77 const ui::Accelerator& accelerator,
78 const std::string& command_name) = 0; 78 const std::string& command_name) = 0;
79 79
80 // Make sure all extensions registered have keybindings added. 80 // Make sure all extensions registered have keybindings added.
81 void Init(); 81 void Init();
82 82
83 // Whether to ignore this command. Only browserAction commands and pageAction 83 // Whether to ignore this command. Only browserAction commands and pageAction
84 // commands are currently ignored, since they are handled elsewhere. 84 // commands are currently ignored, since they are handled elsewhere.
85 bool ShouldIgnoreCommand(const std::string& command) const; 85 bool ShouldIgnoreCommand(const std::string& command) const;
86 86
87 // Fire event targets which the specified accelerator is binding with. Returns
88 // true if we can find the appropriate event targets.
89 bool NotifyEventTargetsByAccelerator(const ui::Accelerator& accelerator);
90
87 // Notifies appropriate parties that a command has been executed. 91 // Notifies appropriate parties that a command has been executed.
88 void CommandExecuted(const std::string& extension_id, 92 void CommandExecuted(const std::string& extension_id,
89 const std::string& command); 93 const std::string& command);
90 94
91 // Maps an accelerator to a string pair (extension id, command name) for 95 // Maps an accelerator to a string pair (extension id, command name) for
92 // commands that have been registered. This keeps track of the targets for the 96 // commands that have been registered. This keeps track of the targets for the
93 // keybinding event (which named command to call in which extension). On GTK, 97 // keybinding event (which named command to call in which extension). On GTK,
94 // this map contains registration for pageAction and browserAction commands, 98 // this map contains registration for pageAction and browserAction commands,
95 // whereas on other platforms it does not. 99 // whereas on other platforms it does not.
96 typedef std::map< ui::Accelerator, 100 typedef std::map< ui::Accelerator,
97 std::pair<std::string, std::string> > EventTargets; 101 std::pair<std::string, std::string> > EventTargets;
98 EventTargets event_targets_; 102 EventTargets event_targets_;
99 103
104 // Maps an accelerator that are media keys to a list of string pair (extension
105 // id, command name) for media keys commands that have been registered.
106 typedef std::list<std::pair<std::string, std::string> > TargetList;
107 typedef std::map<ui::Accelerator, TargetList> MediaKeysEventTargets;
108 MediaKeysEventTargets media_keys_event_targets_;
109
100 private: 110 private:
101 // Returns true if the |extension| matches our extension filter. 111 // Returns true if the |extension| matches our extension filter.
102 bool ExtensionMatchesFilter(const extensions::Extension* extension); 112 bool ExtensionMatchesFilter(const extensions::Extension* extension);
103 113
104 // The content notification registrar for listening to extension events. 114 // The content notification registrar for listening to extension events.
105 content::NotificationRegistrar registrar_; 115 content::NotificationRegistrar registrar_;
106 116
107 // Weak pointer to our profile. Not owned by us. 117 // Weak pointer to our profile. Not owned by us.
108 Profile* profile_; 118 Profile* profile_;
109 119
110 // What extensions to register keybindings for. 120 // What extensions to register keybindings for.
111 ExtensionFilter extension_filter_; 121 ExtensionFilter extension_filter_;
112 122
113 // Weak pointer to our delegate. Not owned by us. Must outlive this class. 123 // Weak pointer to our delegate. Not owned by us. Must outlive this class.
114 Delegate* delegate_; 124 Delegate* delegate_;
115 125
116 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistry); 126 DISALLOW_COPY_AND_ASSIGN(ExtensionKeybindingRegistry);
117 }; 127 };
118 128
119 } // namespace extensions 129 } // namespace extensions
120 130
121 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_ 131 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_KEYBINDING_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698