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

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 7 years, 11 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
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/extension.cc
diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc
index 5e13f243fbd0003da90feb8c3d194709981ead7e..dee03d689d14b2b21e1ddd18c6e1addcd6bd7071 100644
--- a/chrome/common/extensions/extension.cc
+++ b/chrome/common/extensions/extension.cc
@@ -1917,7 +1917,6 @@ bool Extension::LoadSharedFeatures(
string16* error) {
if (!LoadDescription(error) ||
!LoadIcons(error) ||
- !LoadCommands(error) ||
!LoadPlugins(error) ||
!LoadNaClModules(error) ||
!LoadSandboxedPages(error) ||
@@ -1987,65 +1986,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::Iterator iter(*commands); !iter.IsAtEnd();
- iter.Advance()) {
- ++command_index;
-
- const DictionaryValue* command = NULL;
- if (!iter.value().GetAsDictionary(&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.key(), 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;
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/common/extensions/extension_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698