| OLD | NEW |
| 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 Loading... |
| 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 const FileBrowserHandlerList* file_browser_handlers() const { | 550 const FileBrowserHandlerList* file_browser_handlers() const { |
| 527 return file_browser_handlers_.get(); | 551 return file_browser_handlers_.get(); |
| 528 } | 552 } |
| 529 const std::vector<PluginInfo>& plugins() const { return plugins_; } | 553 const std::vector<PluginInfo>& plugins() const { return plugins_; } |
| 530 const std::vector<NaClModuleInfo>& nacl_modules() const { | 554 const std::vector<NaClModuleInfo>& nacl_modules() const { |
| 531 return nacl_modules_; | 555 return nacl_modules_; |
| 532 } | 556 } |
| 533 const std::vector<InputComponentInfo>& input_components() const { | 557 const std::vector<InputComponentInfo>& input_components() const { |
| 534 return input_components_; | 558 return input_components_; |
| 535 } | 559 } |
| 560 const std::vector<ExtensionKeybinding>& keybindings() const { |
| 561 return commands_; |
| 562 } |
| 536 bool has_background_page() const { | 563 bool has_background_page() const { |
| 537 return background_url_.is_valid() || !background_scripts_.empty(); | 564 return background_url_.is_valid() || !background_scripts_.empty(); |
| 538 } | 565 } |
| 539 const std::vector<std::string>& background_scripts() const { | 566 const std::vector<std::string>& background_scripts() const { |
| 540 return background_scripts_; | 567 return background_scripts_; |
| 541 } | 568 } |
| 542 bool background_page_persists() const { return background_page_persists_; } | 569 bool background_page_persists() const { return background_page_persists_; } |
| 543 const GURL& options_url() const { return options_url_; } | 570 const GURL& options_url() const { return options_url_; } |
| 544 const GURL& devtools_url() const { return devtools_url_; } | 571 const GURL& devtools_url() const { return devtools_url_; } |
| 545 const ExtensionPermissionSet* optional_permission_set() const { | 572 const ExtensionPermissionSet* optional_permission_set() const { |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 | 829 |
| 803 // Optional list of NPAPI plugins and associated properties. | 830 // Optional list of NPAPI plugins and associated properties. |
| 804 std::vector<PluginInfo> plugins_; | 831 std::vector<PluginInfo> plugins_; |
| 805 | 832 |
| 806 // Optional list of NaCl modules and associated properties. | 833 // Optional list of NaCl modules and associated properties. |
| 807 std::vector<NaClModuleInfo> nacl_modules_; | 834 std::vector<NaClModuleInfo> nacl_modules_; |
| 808 | 835 |
| 809 // Optional list of input components and associated properties. | 836 // Optional list of input components and associated properties. |
| 810 std::vector<InputComponentInfo> input_components_; | 837 std::vector<InputComponentInfo> input_components_; |
| 811 | 838 |
| 839 // Optional list of commands (keyboard shortcuts). |
| 840 std::vector<ExtensionKeybinding> commands_; |
| 841 |
| 812 // Optional list of web accessible extension resources. | 842 // Optional list of web accessible extension resources. |
| 813 base::hash_set<std::string> web_accessible_resources_; | 843 base::hash_set<std::string> web_accessible_resources_; |
| 814 | 844 |
| 815 // Optional URL to a master page of which a single instance should be always | 845 // Optional URL to a master page of which a single instance should be always |
| 816 // loaded in the background. | 846 // loaded in the background. |
| 817 GURL background_url_; | 847 GURL background_url_; |
| 818 | 848 |
| 819 // Optional list of scripts to use to generate a background page. If this is | 849 // Optional list of scripts to use to generate a background page. If this is |
| 820 // present, background_url_ will be empty and generated by GetBackgroundURL(). | 850 // present, background_url_ will be empty and generated by GetBackgroundURL(). |
| 821 std::vector<std::string> background_scripts_; | 851 std::vector<std::string> background_scripts_; |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 941 const Extension* extension; | 971 const Extension* extension; |
| 942 | 972 |
| 943 UnloadedExtensionInfo( | 973 UnloadedExtensionInfo( |
| 944 const Extension* extension, | 974 const Extension* extension, |
| 945 extension_misc::UnloadedExtensionReason reason); | 975 extension_misc::UnloadedExtensionReason reason); |
| 946 }; | 976 }; |
| 947 | 977 |
| 948 // The details sent for EXTENSION_PERMISSIONS_UPDATED notifications. | 978 // The details sent for EXTENSION_PERMISSIONS_UPDATED notifications. |
| 949 struct UpdatedExtensionPermissionsInfo { | 979 struct UpdatedExtensionPermissionsInfo { |
| 950 enum Reason { | 980 enum Reason { |
| 951 ADDED, // The permissions were added to the extension. | 981 ADDED, // The permissions were added to the extension. |
| 952 REMOVED, // The permissions were removed from the extension. | 982 REMOVED, // The permissions were removed from the extension. |
| 953 }; | 983 }; |
| 954 | 984 |
| 955 Reason reason; | 985 Reason reason; |
| 956 | 986 |
| 957 // The extension who's permissions have changed. | 987 // The extension who's permissions have changed. |
| 958 const Extension* extension; | 988 const Extension* extension; |
| 959 | 989 |
| 960 // The permissions that have changed. For Reason::ADDED, this would contain | 990 // The permissions that have changed. For Reason::ADDED, this would contain |
| 961 // only the permissions that have added, and for Reason::REMOVED, this would | 991 // only the permissions that have added, and for Reason::REMOVED, this would |
| 962 // only contain the removed permissions. | 992 // only contain the removed permissions. |
| 963 const ExtensionPermissionSet* permissions; | 993 const ExtensionPermissionSet* permissions; |
| 964 | 994 |
| 965 UpdatedExtensionPermissionsInfo( | 995 UpdatedExtensionPermissionsInfo( |
| 966 const Extension* extension, | 996 const Extension* extension, |
| 967 const ExtensionPermissionSet* permissions, | 997 const ExtensionPermissionSet* permissions, |
| 968 Reason reason); | 998 Reason reason); |
| 969 }; | 999 }; |
| 970 | 1000 |
| 971 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 1001 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |