diff options
Diffstat (limited to 'chrome/common')
-rw-r--r-- | chrome/common/extensions/api/_manifest_features.json | 5 | ||||
-rw-r--r-- | chrome/common/extensions/api/commands/commands_handler.cc | 3 | ||||
-rw-r--r-- | chrome/common/extensions/command.cc | 13 | ||||
-rw-r--r-- | chrome/common/extensions/command.h | 5 |
4 files changed, 21 insertions, 5 deletions
diff --git a/chrome/common/extensions/api/_manifest_features.json b/chrome/common/extensions/api/_manifest_features.json index 3393d34..98a124d 100644 --- a/chrome/common/extensions/api/_manifest_features.json +++ b/chrome/common/extensions/api/_manifest_features.json @@ -80,6 +80,11 @@ "extension_types": ["extension"], "min_manifest_version": 2 }, + "commands.global": { + "channel": "dev", + "extension_types": ["extension"], + "min_manifest_version": 2 + }, "content_pack": { "channel": "dev", "extension_types": ["extension"] diff --git a/chrome/common/extensions/api/commands/commands_handler.cc b/chrome/common/extensions/api/commands/commands_handler.cc index 731af99..852f152 100644 --- a/chrome/common/extensions/api/commands/commands_handler.cc +++ b/chrome/common/extensions/api/commands/commands_handler.cc @@ -140,7 +140,8 @@ void CommandsHandler::MaybeSetBrowserActionDefault(const Extension* extension, info->browser_action_command.reset( new Command(manifest_values::kBrowserActionCommandEvent, string16(), - std::string())); + std::string(), + false)); } } diff --git a/chrome/common/extensions/command.cc b/chrome/common/extensions/command.cc index 038705b..6e87d7a 100644 --- a/chrome/common/extensions/command.cc +++ b/chrome/common/extensions/command.cc @@ -250,13 +250,15 @@ std::string NormalizeShortcutSuggestion(const std::string& suggestion, } // namespace -Command::Command() {} +Command::Command() : global_(false) {} Command::Command(const std::string& command_name, const string16& description, - const std::string& accelerator) + const std::string& accelerator, + bool global) : command_name_(command_name), - description_(description) { + description_(description), + global_(global) { string16 error; accelerator_ = ParseImpl(accelerator, CommandPlatform(), 0, IsNamedCommand(command_name), &error); @@ -432,6 +434,10 @@ bool Command::Parse(const base::DictionaryValue* command, } } + // Check if this is a global or a regular shortcut. + bool global = false; + command->GetBoolean(keys::kGlobal, &global); + // Normalize the suggestions. for (SuggestionMap::iterator iter = suggestions.begin(); iter != suggestions.end(); ++iter) { @@ -494,6 +500,7 @@ bool Command::Parse(const base::DictionaryValue* command, accelerator_ = accelerator; command_name_ = command_name; description_ = description; + global_ = global; } } return true; diff --git a/chrome/common/extensions/command.h b/chrome/common/extensions/command.h index 963d26b..97107d4 100644 --- a/chrome/common/extensions/command.h +++ b/chrome/common/extensions/command.h @@ -26,7 +26,8 @@ class Command { Command(); Command(const std::string& command_name, const string16& description, - const std::string& accelerator); + const std::string& accelerator, + bool global); ~Command(); // The platform value for the Command. @@ -56,6 +57,7 @@ class Command { const std::string& command_name() const { return command_name_; } const ui::Accelerator& accelerator() const { return accelerator_; } const string16& description() const { return description_; } + bool global() const { return global_; } // Setter: void set_accelerator(ui::Accelerator accelerator) { @@ -66,6 +68,7 @@ class Command { std::string command_name_; ui::Accelerator accelerator_; string16 description_; + bool global_; }; // A mapping of command name (std::string) to a command object. |