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

Unified Diff: chrome/common/extensions/extension.h

Issue 9402018: Experimental Extension Keybinding (first cut). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/extension.h
===================================================================
--- chrome/common/extensions/extension.h (revision 122745)
+++ chrome/common/extensions/extension.h (working copy)
@@ -26,6 +26,7 @@
#include "chrome/common/extensions/url_pattern.h"
#include "chrome/common/extensions/url_pattern_set.h"
#include "googleurl/src/gurl.h"
+#include "ui/base/accelerators/accelerator.h"
#include "ui/gfx/size.h"
class ExtensionAction;
@@ -153,6 +154,29 @@
bool shortcut_shift;
};
+ class ExtensionKeybinding {
+ public:
+ // Define out of line constructor/destructor to please Clang.
+ ExtensionKeybinding();
+ ~ExtensionKeybinding();
+
+ // Parse the key binding.
+ bool Parse(base::DictionaryValue* command,
+ const std::string& event_name,
+ string16* error,
+ int index);
+
+ // Accessors:
+ const std::string& event_name() const { return event_name_; }
Matt Perry 2012/02/21 23:13:39 event_name sounds like the name of the event that
+ const ui::Accelerator& accelerator() const { return accelerator_; }
+ const std::string& description() const { return description_; }
+
+ private:
+ std::string event_name_;
+ ui::Accelerator accelerator_;
+ std::string description_;
+ };
+
struct TtsVoice {
// Define out of line constructor/destructor to please Clang.
TtsVoice();
@@ -533,6 +557,9 @@
const std::vector<InputComponentInfo>& input_components() const {
return input_components_;
}
+ const std::vector<ExtensionKeybinding>& keybindings() const {
+ return commands_;
+ }
bool has_background_page() const {
return background_url_.is_valid() || !background_scripts_.empty();
}
@@ -809,6 +836,9 @@
// Optional list of input components and associated properties.
std::vector<InputComponentInfo> input_components_;
+ // Optional list of commands (keyboard shortcuts).
+ std::vector<ExtensionKeybinding> commands_;
+
// Optional list of web accessible extension resources.
base::hash_set<std::string> web_accessible_resources_;
@@ -948,8 +978,8 @@
// The details sent for EXTENSION_PERMISSIONS_UPDATED notifications.
struct UpdatedExtensionPermissionsInfo {
enum Reason {
- ADDED, // The permissions were added to the extension.
- REMOVED, // The permissions were removed from the extension.
+ ADDED, // The permissions were added to the extension.
+ REMOVED, // The permissions were removed from the extension.
};
Reason reason;

Powered by Google App Engine
This is Rietveld 408576698