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

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

Issue 11662013: Move Commands from Extension to CommandsHandler (Closed) Base URL: http://git.chromium.org/chromium/src.git@dc_unref_script_badge
Patch Set: Created 8 years 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.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 2325ce811d96e296e77417ac95484f46cf831622..851dc39463c3ab4d56c9700d2215ee2a24ab2d4d 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1909,7 +1909,6 @@ bool Extension::LoadSharedFeatures(
!LoadHomepageURL(error) ||
!LoadUpdateURL(error) ||
!LoadIcons(error) ||
- !LoadCommands(error) ||
!LoadPlugins(error) ||
!LoadNaClModules(error) ||
!LoadWebAccessibleResources(error) ||
@@ -2021,65 +2020,6 @@ bool Extension::LoadIcons(string16* error) {
error);
}
-bool Extension::LoadCommands(string16* error) {
- if (manifest_->HasKey(keys::kCommands)) {
- DictionaryValue* commands = NULL;
- if (!manifest_->GetDictionary(keys::kCommands, &commands)) {
- *error = ASCIIToUTF16(errors::kInvalidCommandsKey);
- return false;
- }
-
- if (commands->size() > kMaxCommandsPerExtension) {
- *error = ErrorUtils::FormatErrorMessageUTF16(
- errors::kInvalidKeyBindingTooMany,
- base::IntToString(kMaxCommandsPerExtension));
- return false;
- }
-
- int command_index = 0;
- for (DictionaryValue::key_iterator iter = commands->begin_keys();
- iter != commands->end_keys(); ++iter) {
- ++command_index;
-
- DictionaryValue* command = NULL;
- if (!commands->GetDictionary(*iter, &command)) {
- *error = ErrorUtils::FormatErrorMessageUTF16(
- errors::kInvalidKeyBindingDictionary,
- base::IntToString(command_index));
- return false;
- }
-
- scoped_ptr<extensions::Command> binding(new extensions::Command());
- if (!binding->Parse(command, *iter, command_index, error))
- return false; // |error| already set.
-
- std::string command_name = binding->command_name();
- if (command_name == values::kPageActionCommandEvent) {
- page_action_command_.reset(binding.release());
- } else if (command_name == values::kBrowserActionCommandEvent) {
- browser_action_command_.reset(binding.release());
- } else if (command_name == values::kScriptBadgeCommandEvent) {
- script_badge_command_.reset(binding.release());
- } else {
- if (command_name[0] != '_') // All commands w/underscore are reserved.
- named_commands_[command_name] = *binding.get();
- }
- }
- }
-
- if (manifest_->HasKey(keys::kBrowserAction) &&
- !browser_action_command_.get()) {
- // If the extension defines a browser action, but no command for it, then
- // we synthesize a generic one, so the user can configure a shortcut for it.
- // No keyboard shortcut will be assigned to it, until the user selects one.
- browser_action_command_.reset(
- new extensions::Command(
- values::kBrowserActionCommandEvent, string16(), ""));
- }
-
- return true;
-}
-
bool Extension::LoadPlugins(string16* error) {
if (!manifest_->HasKey(keys::kPlugins))
return true;

Powered by Google App Engine
This is Rietveld 408576698