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

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, 8 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 };
174 178
179 typedef std::map<std::string, ExtensionKeybinding> CommandMap;
180
175 struct TtsVoice { 181 struct TtsVoice {
176 // Define out of line constructor/destructor to please Clang. 182 // Define out of line constructor/destructor to please Clang.
177 TtsVoice(); 183 TtsVoice();
178 ~TtsVoice(); 184 ~TtsVoice();
179 185
180 std::string voice_name; 186 std::string voice_name;
181 std::string lang; 187 std::string lang;
182 std::string gender; 188 std::string gender;
183 std::set<std::string> event_types; 189 std::set<std::string> event_types;
184 }; 190 };
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 const FileBrowserHandlerList* file_browser_handlers() const { 559 const FileBrowserHandlerList* file_browser_handlers() const {
554 return file_browser_handlers_.get(); 560 return file_browser_handlers_.get();
555 } 561 }
556 const std::vector<PluginInfo>& plugins() const { return plugins_; } 562 const std::vector<PluginInfo>& plugins() const { return plugins_; }
557 const std::vector<NaClModuleInfo>& nacl_modules() const { 563 const std::vector<NaClModuleInfo>& nacl_modules() const {
558 return nacl_modules_; 564 return nacl_modules_;
559 } 565 }
560 const std::vector<InputComponentInfo>& input_components() const { 566 const std::vector<InputComponentInfo>& input_components() const {
561 return input_components_; 567 return input_components_;
562 } 568 }
563 const std::vector<ExtensionKeybinding>& keybindings() const { 569 const ExtensionKeybinding* browser_action_command() const {
564 return commands_; 570 return browser_action_command_.get();
571 }
572 const ExtensionKeybinding* page_action_command() const {
573 return page_action_command_.get();
574 }
575 const CommandMap& named_commands() const {
576 return named_commands_;
565 } 577 }
566 bool has_background_page() const { 578 bool has_background_page() const {
567 return background_url_.is_valid() || !background_scripts_.empty(); 579 return background_url_.is_valid() || !background_scripts_.empty();
568 } 580 }
569 bool allow_background_js_access() const { 581 bool allow_background_js_access() const {
570 return allow_background_js_access_; 582 return allow_background_js_access_;
571 } 583 }
572 const std::vector<std::string>& background_scripts() const { 584 const std::vector<std::string>& background_scripts() const {
573 return background_scripts_; 585 return background_scripts_;
574 } 586 }
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
909 // Optional list of NPAPI plugins and associated properties. 921 // Optional list of NPAPI plugins and associated properties.
910 std::vector<PluginInfo> plugins_; 922 std::vector<PluginInfo> plugins_;
911 923
912 // Optional list of NaCl modules and associated properties. 924 // Optional list of NaCl modules and associated properties.
913 std::vector<NaClModuleInfo> nacl_modules_; 925 std::vector<NaClModuleInfo> nacl_modules_;
914 926
915 // Optional list of input components and associated properties. 927 // Optional list of input components and associated properties.
916 std::vector<InputComponentInfo> input_components_; 928 std::vector<InputComponentInfo> input_components_;
917 929
918 // Optional list of commands (keyboard shortcuts). 930 // Optional list of commands (keyboard shortcuts).
919 std::vector<ExtensionKeybinding> commands_; 931 scoped_ptr<ExtensionKeybinding> browser_action_command_;
932 scoped_ptr<ExtensionKeybinding> page_action_command_;
933 CommandMap named_commands_;
920 934
921 // Optional list of web accessible extension resources. 935 // Optional list of web accessible extension resources.
922 base::hash_set<std::string> web_accessible_resources_; 936 base::hash_set<std::string> web_accessible_resources_;
923 937
924 // Optional URL to a master page of which a single instance should be always 938 // Optional URL to a master page of which a single instance should be always
925 // loaded in the background. 939 // loaded in the background.
926 GURL background_url_; 940 GURL background_url_;
927 941
928 // Optional list of scripts to use to generate a background page. If this is 942 // Optional list of scripts to use to generate a background page. If this is
929 // present, background_url_ will be empty and generated by GetBackgroundURL(). 943 // present, background_url_ will be empty and generated by GetBackgroundURL().
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1093 // only contain the removed permissions. 1107 // only contain the removed permissions.
1094 const ExtensionPermissionSet* permissions; 1108 const ExtensionPermissionSet* permissions;
1095 1109
1096 UpdatedExtensionPermissionsInfo( 1110 UpdatedExtensionPermissionsInfo(
1097 const Extension* extension, 1111 const Extension* extension,
1098 const ExtensionPermissionSet* permissions, 1112 const ExtensionPermissionSet* permissions,
1099 Reason reason); 1113 Reason reason);
1100 }; 1114 };
1101 1115
1102 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 1116 #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