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

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

Issue 9402018: Experimental Extension Keybinding (first cut). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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
« no previous file with comments | « chrome/common/extensions/api/extension_api.cc ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/file_path.h" 14 #include "base/file_path.h"
15 #include "base/gtest_prod_util.h" 15 #include "base/gtest_prod_util.h"
16 #include "base/hash_tables.h" 16 #include "base/hash_tables.h"
17 #include "base/memory/linked_ptr.h" 17 #include "base/memory/linked_ptr.h"
18 #include "base/memory/ref_counted.h" 18 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h" 19 #include "base/memory/scoped_ptr.h"
20 #include "base/synchronization/lock.h" 20 #include "base/synchronization/lock.h"
21 #include "chrome/common/extensions/extension_constants.h" 21 #include "chrome/common/extensions/extension_constants.h"
22 #include "chrome/common/extensions/extension_icon_set.h" 22 #include "chrome/common/extensions/extension_icon_set.h"
23 #include "chrome/common/extensions/extension_permission_set.h" 23 #include "chrome/common/extensions/extension_permission_set.h"
24 #include "chrome/common/extensions/manifest.h" 24 #include "chrome/common/extensions/manifest.h"
25 #include "chrome/common/extensions/user_script.h" 25 #include "chrome/common/extensions/user_script.h"
26 #include "chrome/common/extensions/url_pattern.h" 26 #include "chrome/common/extensions/url_pattern.h"
27 #include "chrome/common/extensions/url_pattern_set.h" 27 #include "chrome/common/extensions/url_pattern_set.h"
28 #include "googleurl/src/gurl.h" 28 #include "googleurl/src/gurl.h"
29 #include "ui/base/accelerators/accelerator.h"
29 #include "ui/gfx/size.h" 30 #include "ui/gfx/size.h"
30 31
31 class ExtensionAction; 32 class ExtensionAction;
32 class ExtensionResource; 33 class ExtensionResource;
33 class FileBrowserHandler; 34 class FileBrowserHandler;
34 class SkBitmap; 35 class SkBitmap;
35 class Version; 36 class Version;
36 37
37 namespace base { 38 namespace base {
38 class DictionaryValue; 39 class DictionaryValue;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 std::string id; 147 std::string id;
147 std::string description; 148 std::string description;
148 std::string language; 149 std::string language;
149 std::set<std::string> layouts; 150 std::set<std::string> layouts;
150 std::string shortcut_keycode; 151 std::string shortcut_keycode;
151 bool shortcut_alt; 152 bool shortcut_alt;
152 bool shortcut_ctrl; 153 bool shortcut_ctrl;
153 bool shortcut_shift; 154 bool shortcut_shift;
154 }; 155 };
155 156
157 class ExtensionKeybinding {
158 public:
159 // Define out of line constructor/destructor to please Clang.
160 ExtensionKeybinding();
161 ~ExtensionKeybinding();
162
163 // Parse the key binding.
164 bool Parse(base::DictionaryValue* command,
165 const std::string& command_name,
166 int index,
167 string16* error);
168
169 // Accessors:
170 const std::string& command_name() const { return command_name_; }
171 const ui::Accelerator& accelerator() const { return accelerator_; }
172 const std::string& description() const { return description_; }
173
174 private:
175 std::string command_name_;
176 ui::Accelerator accelerator_;
177 std::string description_;
178 };
179
156 struct TtsVoice { 180 struct TtsVoice {
157 // Define out of line constructor/destructor to please Clang. 181 // Define out of line constructor/destructor to please Clang.
158 TtsVoice(); 182 TtsVoice();
159 ~TtsVoice(); 183 ~TtsVoice();
160 184
161 std::string voice_name; 185 std::string voice_name;
162 std::string lang; 186 std::string lang;
163 std::string gender; 187 std::string gender;
164 std::set<std::string> event_types; 188 std::set<std::string> event_types;
165 }; 189 };
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
521 const FileBrowserHandlerList* file_browser_handlers() const { 545 const FileBrowserHandlerList* file_browser_handlers() const {
522 return file_browser_handlers_.get(); 546 return file_browser_handlers_.get();
523 } 547 }
524 const std::vector<PluginInfo>& plugins() const { return plugins_; } 548 const std::vector<PluginInfo>& plugins() const { return plugins_; }
525 const std::vector<NaClModuleInfo>& nacl_modules() const { 549 const std::vector<NaClModuleInfo>& nacl_modules() const {
526 return nacl_modules_; 550 return nacl_modules_;
527 } 551 }
528 const std::vector<InputComponentInfo>& input_components() const { 552 const std::vector<InputComponentInfo>& input_components() const {
529 return input_components_; 553 return input_components_;
530 } 554 }
555 const std::vector<ExtensionKeybinding>& keybindings() const {
556 return commands_;
557 }
531 bool has_background_page() const { 558 bool has_background_page() const {
532 return background_url_.is_valid() || !background_scripts_.empty(); 559 return background_url_.is_valid() || !background_scripts_.empty();
533 } 560 }
534 const std::vector<std::string>& background_scripts() const { 561 const std::vector<std::string>& background_scripts() const {
535 return background_scripts_; 562 return background_scripts_;
536 } 563 }
537 bool background_page_persists() const { return background_page_persists_; } 564 bool background_page_persists() const { return background_page_persists_; }
538 const GURL& options_url() const { return options_url_; } 565 const GURL& options_url() const { return options_url_; }
539 const GURL& devtools_url() const { return devtools_url_; } 566 const GURL& devtools_url() const { return devtools_url_; }
540 const ExtensionPermissionSet* optional_permission_set() const { 567 const ExtensionPermissionSet* optional_permission_set() const {
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 824
798 // Optional list of NPAPI plugins and associated properties. 825 // Optional list of NPAPI plugins and associated properties.
799 std::vector<PluginInfo> plugins_; 826 std::vector<PluginInfo> plugins_;
800 827
801 // Optional list of NaCl modules and associated properties. 828 // Optional list of NaCl modules and associated properties.
802 std::vector<NaClModuleInfo> nacl_modules_; 829 std::vector<NaClModuleInfo> nacl_modules_;
803 830
804 // Optional list of input components and associated properties. 831 // Optional list of input components and associated properties.
805 std::vector<InputComponentInfo> input_components_; 832 std::vector<InputComponentInfo> input_components_;
806 833
834 // Optional list of commands (keyboard shortcuts).
835 std::vector<ExtensionKeybinding> commands_;
836
807 // Optional list of web accessible extension resources. 837 // Optional list of web accessible extension resources.
808 base::hash_set<std::string> web_accessible_resources_; 838 base::hash_set<std::string> web_accessible_resources_;
809 839
810 // Optional URL to a master page of which a single instance should be always 840 // Optional URL to a master page of which a single instance should be always
811 // loaded in the background. 841 // loaded in the background.
812 GURL background_url_; 842 GURL background_url_;
813 843
814 // Optional list of scripts to use to generate a background page. If this is 844 // Optional list of scripts to use to generate a background page. If this is
815 // present, background_url_ will be empty and generated by GetBackgroundURL(). 845 // present, background_url_ will be empty and generated by GetBackgroundURL().
816 std::vector<std::string> background_scripts_; 846 std::vector<std::string> background_scripts_;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 const Extension* extension; 966 const Extension* extension;
937 967
938 UnloadedExtensionInfo( 968 UnloadedExtensionInfo(
939 const Extension* extension, 969 const Extension* extension,
940 extension_misc::UnloadedExtensionReason reason); 970 extension_misc::UnloadedExtensionReason reason);
941 }; 971 };
942 972
943 // The details sent for EXTENSION_PERMISSIONS_UPDATED notifications. 973 // The details sent for EXTENSION_PERMISSIONS_UPDATED notifications.
944 struct UpdatedExtensionPermissionsInfo { 974 struct UpdatedExtensionPermissionsInfo {
945 enum Reason { 975 enum Reason {
946 ADDED, // The permissions were added to the extension. 976 ADDED, // The permissions were added to the extension.
947 REMOVED, // The permissions were removed from the extension. 977 REMOVED, // The permissions were removed from the extension.
948 }; 978 };
949 979
950 Reason reason; 980 Reason reason;
951 981
952 // The extension who's permissions have changed. 982 // The extension who's permissions have changed.
953 const Extension* extension; 983 const Extension* extension;
954 984
955 // The permissions that have changed. For Reason::ADDED, this would contain 985 // The permissions that have changed. For Reason::ADDED, this would contain
956 // only the permissions that have added, and for Reason::REMOVED, this would 986 // only the permissions that have added, and for Reason::REMOVED, this would
957 // only contain the removed permissions. 987 // only contain the removed permissions.
958 const ExtensionPermissionSet* permissions; 988 const ExtensionPermissionSet* permissions;
959 989
960 UpdatedExtensionPermissionsInfo( 990 UpdatedExtensionPermissionsInfo(
961 const Extension* extension, 991 const Extension* extension,
962 const ExtensionPermissionSet* permissions, 992 const ExtensionPermissionSet* permissions,
963 Reason reason); 993 Reason reason);
964 }; 994 };
965 995
966 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 996 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/extension_api.cc ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698