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

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

Issue 9812008: Polish the keybinding implementation a bit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
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_EXTENSION_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_EXTENSION_H_
6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 6 #define CHROME_COMMON_EXTENSIONS_EXTENSION_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 const std::string& command_name, 160 const std::string& command_name,
161 int index, 161 int index,
162 string16* error); 162 string16* error);
163 163
164 // Accessors: 164 // Accessors:
165 const std::string& command_name() const { return command_name_; } 165 const std::string& command_name() const { return command_name_; }
166 const ui::Accelerator& accelerator() const { return accelerator_; } 166 const ui::Accelerator& accelerator() const { return accelerator_; }
167 const std::string& description() const { return description_; } 167 const std::string& description() const { return description_; }
168 168
169 private: 169 private:
170 ui::Accelerator ParseImpl(const std::string& shortcut,
171 const std::string& platform_key,
172 int index,
173 string16* error);
170 std::string command_name_; 174 std::string command_name_;
171 ui::Accelerator accelerator_; 175 ui::Accelerator accelerator_;
172 std::string description_; 176 std::string description_;
173 }; 177 };
178 typedef std::map<std::string, ExtensionKeybinding> Commands;
Aaron Boodman 2012/03/26 21:44:57 Naming nit: CommandMap? Just commands seems too am
174 179
175 struct TtsVoice { 180 struct TtsVoice {
176 // Define out of line constructor/destructor to please Clang. 181 // Define out of line constructor/destructor to please Clang.
177 TtsVoice(); 182 TtsVoice();
178 ~TtsVoice(); 183 ~TtsVoice();
179 184
180 std::string voice_name; 185 std::string voice_name;
181 std::string lang; 186 std::string lang;
182 std::string gender; 187 std::string gender;
183 std::set<std::string> event_types; 188 std::set<std::string> event_types;
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 const FileBrowserHandlerList* file_browser_handlers() const { 549 const FileBrowserHandlerList* file_browser_handlers() const {
545 return file_browser_handlers_.get(); 550 return file_browser_handlers_.get();
546 } 551 }
547 const std::vector<PluginInfo>& plugins() const { return plugins_; } 552 const std::vector<PluginInfo>& plugins() const { return plugins_; }
548 const std::vector<NaClModuleInfo>& nacl_modules() const { 553 const std::vector<NaClModuleInfo>& nacl_modules() const {
549 return nacl_modules_; 554 return nacl_modules_;
550 } 555 }
551 const std::vector<InputComponentInfo>& input_components() const { 556 const std::vector<InputComponentInfo>& input_components() const {
552 return input_components_; 557 return input_components_;
553 } 558 }
554 const std::vector<ExtensionKeybinding>& keybindings() const { 559 const ExtensionKeybinding* browser_action_command() const {
Aaron Boodman 2012/03/26 21:44:57 I think it would be more traditional to make these
Finnur 2012/03/29 14:57:27 Traditional perhaps, but one of those (ba/pa) is g
Aaron Boodman 2012/03/29 20:57:28 Oh, duh, you are totally right. Sorry.
555 return commands_; 560 return browser_action_command_.get();
561 }
562 const ExtensionKeybinding* page_action_command() const {
563 return page_action_command_.get();
564 }
565 const Commands& named_commands() const {
566 return named_commands_;
556 } 567 }
557 bool has_background_page() const { 568 bool has_background_page() const {
558 return background_url_.is_valid() || !background_scripts_.empty(); 569 return background_url_.is_valid() || !background_scripts_.empty();
559 } 570 }
560 bool allow_background_js_access() const { 571 bool allow_background_js_access() const {
561 return allow_background_js_access_; 572 return allow_background_js_access_;
562 } 573 }
563 const std::vector<std::string>& background_scripts() const { 574 const std::vector<std::string>& background_scripts() const {
564 return background_scripts_; 575 return background_scripts_;
565 } 576 }
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 // Optional list of NPAPI plugins and associated properties. 899 // Optional list of NPAPI plugins and associated properties.
889 std::vector<PluginInfo> plugins_; 900 std::vector<PluginInfo> plugins_;
890 901
891 // Optional list of NaCl modules and associated properties. 902 // Optional list of NaCl modules and associated properties.
892 std::vector<NaClModuleInfo> nacl_modules_; 903 std::vector<NaClModuleInfo> nacl_modules_;
893 904
894 // Optional list of input components and associated properties. 905 // Optional list of input components and associated properties.
895 std::vector<InputComponentInfo> input_components_; 906 std::vector<InputComponentInfo> input_components_;
896 907
897 // Optional list of commands (keyboard shortcuts). 908 // Optional list of commands (keyboard shortcuts).
898 std::vector<ExtensionKeybinding> commands_; 909 scoped_ptr<ExtensionKeybinding> browser_action_command_;
910 scoped_ptr<ExtensionKeybinding> page_action_command_;
911 Commands named_commands_;
899 912
900 // Optional list of web accessible extension resources. 913 // Optional list of web accessible extension resources.
901 base::hash_set<std::string> web_accessible_resources_; 914 base::hash_set<std::string> web_accessible_resources_;
902 915
903 // Optional URL to a master page of which a single instance should be always 916 // Optional URL to a master page of which a single instance should be always
904 // loaded in the background. 917 // loaded in the background.
905 GURL background_url_; 918 GURL background_url_;
906 919
907 // Optional list of scripts to use to generate a background page. If this is 920 // Optional list of scripts to use to generate a background page. If this is
908 // present, background_url_ will be empty and generated by GetBackgroundURL(). 921 // present, background_url_ will be empty and generated by GetBackgroundURL().
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1069 // only contain the removed permissions. 1082 // only contain the removed permissions.
1070 const ExtensionPermissionSet* permissions; 1083 const ExtensionPermissionSet* permissions;
1071 1084
1072 UpdatedExtensionPermissionsInfo( 1085 UpdatedExtensionPermissionsInfo(
1073 const Extension* extension, 1086 const Extension* extension,
1074 const ExtensionPermissionSet* permissions, 1087 const ExtensionPermissionSet* permissions,
1075 Reason reason); 1088 Reason reason);
1076 }; 1089 };
1077 1090
1078 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 1091 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/static/experimental.keybinding.html ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698