summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/command.h
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-26 13:42:11 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-26 13:42:11 +0000
commit6121c4837bac59131be7e4f17a3db42e4faef5c2 (patch)
treed6b6bdbddde37c380baf8f18ab423bad612d43cc /chrome/common/extensions/command.h
parent9e079cb3fc680c2d6eb45ed2c073cbf9a95ff64e (diff)
downloadchromium_src-6121c4837bac59131be7e4f17a3db42e4faef5c2.zip
chromium_src-6121c4837bac59131be7e4f17a3db42e4faef5c2.tar.gz
chromium_src-6121c4837bac59131be7e4f17a3db42e4faef5c2.tar.bz2
Extension Command Config UI part 2.
Part 1 was capturing what the user selected as the keyboard shortcut to trigger something in the extension. This changelist is about making it take effect at restart (of the browser). Part 3 will be about making it take effect immediately. BUG=121420 TEST=Change the keyboard shortcut assignment for an extension command. Restart the browser. Make sure the new keyboard shortcut is active. Review URL: https://chromiumcodereview.appspot.com/10633002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144167 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/command.h')
-rw-r--r--chrome/common/extensions/command.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/chrome/common/extensions/command.h b/chrome/common/extensions/command.h
index f218647..2bee9bf 100644
--- a/chrome/common/extensions/command.h
+++ b/chrome/common/extensions/command.h
@@ -24,13 +24,19 @@ namespace extensions {
class Command {
public:
- // Define out of line constructor/destructor to please Clang.
Command();
+ Command(const std::string& command_name,
+ const string16& description,
+ const std::string& accelerator);
~Command();
// The platform value for the Command.
static std::string CommandPlatform();
+ // Parse a string as an accelerator. If the accelerator is unparsable then
+ // a generic ui::Accelerator object will be returns (with key_code Unknown).
+ static ui::Accelerator StringToAccelerator(const std::string& accelerator);
+
// Parse the command.
bool Parse(base::DictionaryValue* command,
const std::string& command_name,
@@ -47,11 +53,12 @@ class Command {
const ui::Accelerator& accelerator() const { return accelerator_; }
const string16& description() const { return description_; }
+ // Setter:
+ void set_accelerator(ui::Accelerator accelerator) {
+ accelerator_ = accelerator;
+ }
+
private:
- ui::Accelerator ParseImpl(const std::string& shortcut,
- const std::string& platform_key,
- int index,
- string16* error);
std::string command_name_;
ui::Accelerator accelerator_;
string16 description_;