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

Side by Side Diff: chrome/common/extensions/command.h

Issue 180783012: Media Keys should not count towards the max of four shortcuts per extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move IsMediaKey from c/b/e/a/c/command_service.h &&.cc to c/c/e/command.h && .cc Created 6 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_COMMON_EXTENSIONS_COMMAND_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_COMMAND_H_
6 #define CHROME_COMMON_EXTENSIONS_COMMAND_H_ 6 #define CHROME_COMMON_EXTENSIONS_COMMAND_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 10
(...skipping 24 matching lines...) Expand all
35 35
36 // Parse a string as an accelerator. If the accelerator is unparsable then 36 // Parse a string as an accelerator. If the accelerator is unparsable then
37 // a generic ui::Accelerator object will be returns (with key_code Unknown). 37 // a generic ui::Accelerator object will be returns (with key_code Unknown).
38 static ui::Accelerator StringToAccelerator(const std::string& accelerator, 38 static ui::Accelerator StringToAccelerator(const std::string& accelerator,
39 const std::string& command_name); 39 const std::string& command_name);
40 40
41 // Returns the string representation of an accelerator without localizing the 41 // Returns the string representation of an accelerator without localizing the
42 // shortcut text (like accelerator::GetShortcutText() does). 42 // shortcut text (like accelerator::GetShortcutText() does).
43 static std::string AcceleratorToString(const ui::Accelerator& accelerator); 43 static std::string AcceleratorToString(const ui::Accelerator& accelerator);
44 44
45 // Return true if the specified accelerator is one of the following multimedia
46 // keys: Next Track key, Previous Track key, Stop Media key, Play/Pause Media
47 // key, without any modifiers.
48 static bool IsMediaKey(const ui::Accelerator& accelerator);
49
45 // Parse the command. 50 // Parse the command.
46 bool Parse(const base::DictionaryValue* command, 51 bool Parse(const base::DictionaryValue* command,
47 const std::string& command_name, 52 const std::string& command_name,
48 int index, 53 int index,
49 base::string16* error); 54 base::string16* error);
50 55
51 // Convert a Command object from |extension| to a DictionaryValue. 56 // Convert a Command object from |extension| to a DictionaryValue.
52 // |active| specifies whether the command is active or not. 57 // |active| specifies whether the command is active or not.
53 base::DictionaryValue* ToValue( 58 base::DictionaryValue* ToValue(
54 const Extension* extension, bool active) const; 59 const Extension* extension, bool active) const;
(...skipping 18 matching lines...) Expand all
73 base::string16 description_; 78 base::string16 description_;
74 bool global_; 79 bool global_;
75 }; 80 };
76 81
77 // A mapping of command name (std::string) to a command object. 82 // A mapping of command name (std::string) to a command object.
78 typedef std::map<std::string, Command> CommandMap; 83 typedef std::map<std::string, Command> CommandMap;
79 84
80 } // namespace extensions 85 } // namespace extensions
81 86
82 #endif // CHROME_COMMON_EXTENSIONS_COMMAND_H_ 87 #endif // CHROME_COMMON_EXTENSIONS_COMMAND_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/commands/commands_manifest_unittest.cc ('k') | chrome/common/extensions/command.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698