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

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

Issue 10383240: This adds a webui overlay on the extensions page for showing what Extension keybindings are active.… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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_commands.cc
===================================================================
--- chrome/common/extensions/extension_commands.cc (revision 138124)
+++ chrome/common/extensions/extension_commands.cc (working copy)
@@ -10,6 +10,8 @@
#include "base/values.h"
#include "chrome/common/extensions/extension_error_utils.h"
#include "chrome/common/extensions/extension_manifest_constants.h"
+#include "grit/generated_resources.h"
+#include "ui/base/l10n/l10n_util.h"
namespace errors = extension_manifest_errors;
namespace keys = extension_manifest_keys;
@@ -214,4 +216,23 @@
return true;
}
+DictionaryValue* Command::ToValue(const Extension* extension,
+ bool active) const {
+ DictionaryValue* extension_data = new DictionaryValue();
+
+ string16 command_description;
+ if (command_name() == values::kBrowserActionKeybindingEvent ||
+ command_name() == values::kPageActionKeybindingEvent) {
+ command_description =
+ l10n_util::GetStringUTF16(IDS_EXTENSION_COMMANDS_GENERIC_ACTIVATE);
+ } else {
+ command_description = description();
+ }
+ extension_data->SetString("description", command_description);
+ extension_data->SetBoolean("active", active);
+ extension_data->SetString("keybinding", accelerator().GetShortcutText());
+
+ return extension_data;
+}
+
} // namespace extensions
« no previous file with comments | « chrome/common/extensions/extension_commands.h ('k') | chrome/common/extensions/extension_commands_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698