| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 #include <vector> | 14 #include <vector> |
| 15 | 15 |
| 16 #include "base/file_path.h" | 16 #include "base/file_path.h" |
| 17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
| 18 #include "base/hash_tables.h" | 18 #include "base/hash_tables.h" |
| 19 #include "base/memory/linked_ptr.h" | 19 #include "base/memory/linked_ptr.h" |
| 20 #include "base/memory/ref_counted.h" | 20 #include "base/memory/ref_counted.h" |
| 21 #include "base/memory/scoped_ptr.h" | 21 #include "base/memory/scoped_ptr.h" |
| 22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
| 23 #include "base/threading/thread_checker.h" | 23 #include "base/threading/thread_checker.h" |
| 24 #include "chrome/common/extensions/api/extension_action/action_info.h" | 24 #include "chrome/common/extensions/api/extension_action/action_info.h" |
| 25 #include "chrome/common/extensions/command.h" | |
| 26 #include "chrome/common/extensions/extension_constants.h" | 25 #include "chrome/common/extensions/extension_constants.h" |
| 27 #include "chrome/common/extensions/extension_icon_set.h" | 26 #include "chrome/common/extensions/extension_icon_set.h" |
| 28 #include "chrome/common/extensions/permissions/api_permission.h" | 27 #include "chrome/common/extensions/permissions/api_permission.h" |
| 29 #include "chrome/common/extensions/permissions/api_permission_set.h" | 28 #include "chrome/common/extensions/permissions/api_permission_set.h" |
| 30 #include "chrome/common/extensions/permissions/permission_message.h" | 29 #include "chrome/common/extensions/permissions/permission_message.h" |
| 31 #include "chrome/common/extensions/user_script.h" | 30 #include "chrome/common/extensions/user_script.h" |
| 32 #include "extensions/common/url_pattern.h" | 31 #include "extensions/common/url_pattern.h" |
| 33 #include "extensions/common/url_pattern_set.h" | 32 #include "extensions/common/url_pattern_set.h" |
| 34 #include "googleurl/src/gurl.h" | 33 #include "googleurl/src/gurl.h" |
| 35 #include "ui/base/accelerators/accelerator.h" | 34 #include "ui/base/accelerators/accelerator.h" |
| (...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 const ActionInfo* browser_action_info() const { | 609 const ActionInfo* browser_action_info() const { |
| 611 return browser_action_info_.get(); | 610 return browser_action_info_.get(); |
| 612 } | 611 } |
| 613 const ActionInfo* system_indicator_info() const { | 612 const ActionInfo* system_indicator_info() const { |
| 614 return system_indicator_info_.get(); | 613 return system_indicator_info_.get(); |
| 615 } | 614 } |
| 616 const std::vector<PluginInfo>& plugins() const { return plugins_; } | 615 const std::vector<PluginInfo>& plugins() const { return plugins_; } |
| 617 const std::vector<NaClModuleInfo>& nacl_modules() const { | 616 const std::vector<NaClModuleInfo>& nacl_modules() const { |
| 618 return nacl_modules_; | 617 return nacl_modules_; |
| 619 } | 618 } |
| 620 // The browser action command that the extension wants to use, which is not | |
| 621 // necessarily the one it can use, as it might be inactive (see also | |
| 622 // GetBrowserActionCommand in CommandService). | |
| 623 const extensions::Command* browser_action_command() const { | |
| 624 return browser_action_command_.get(); | |
| 625 } | |
| 626 // The page action command that the extension wants to use, which is not | |
| 627 // necessarily the one it can use, as it might be inactive (see also | |
| 628 // GetPageActionCommand in CommandService). | |
| 629 const extensions::Command* page_action_command() const { | |
| 630 return page_action_command_.get(); | |
| 631 } | |
| 632 // The script badge command that the extension wants to use, which is not | |
| 633 // necessarily the one it can use, as it might be inactive (see also | |
| 634 // GetScriptBadgeCommand in CommandService). | |
| 635 const extensions::Command* script_badge_command() const { | |
| 636 return script_badge_command_.get(); | |
| 637 } | |
| 638 // The map (of command names to commands) that the extension wants to use, | |
| 639 // which is not necessarily the one it can use, as they might be inactive | |
| 640 // (see also GetNamedCommands in CommandService). | |
| 641 const extensions::CommandMap& named_commands() const { | |
| 642 return named_commands_; | |
| 643 } | |
| 644 bool has_background_page() const { | 619 bool has_background_page() const { |
| 645 return background_url_.is_valid() || !background_scripts_.empty(); | 620 return background_url_.is_valid() || !background_scripts_.empty(); |
| 646 } | 621 } |
| 647 bool allow_background_js_access() const { | 622 bool allow_background_js_access() const { |
| 648 return allow_background_js_access_; | 623 return allow_background_js_access_; |
| 649 } | 624 } |
| 650 const std::vector<std::string>& background_scripts() const { | 625 const std::vector<std::string>& background_scripts() const { |
| 651 return background_scripts_; | 626 return background_scripts_; |
| 652 } | 627 } |
| 653 bool has_persistent_background_page() const { | 628 bool has_persistent_background_page() const { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 const char* value_error, | 776 const char* value_error, |
| 802 string16* error); | 777 string16* error); |
| 803 bool LoadLaunchContainer(string16* error); | 778 bool LoadLaunchContainer(string16* error); |
| 804 bool LoadLaunchURL(string16* error); | 779 bool LoadLaunchURL(string16* error); |
| 805 | 780 |
| 806 bool LoadSharedFeatures(const APIPermissionSet& api_permissions, | 781 bool LoadSharedFeatures(const APIPermissionSet& api_permissions, |
| 807 string16* error); | 782 string16* error); |
| 808 bool LoadDescription(string16* error); | 783 bool LoadDescription(string16* error); |
| 809 bool LoadManifestVersion(string16* error); | 784 bool LoadManifestVersion(string16* error); |
| 810 bool LoadIcons(string16* error); | 785 bool LoadIcons(string16* error); |
| 811 bool LoadCommands(string16* error); | |
| 812 bool LoadPlugins(string16* error); | 786 bool LoadPlugins(string16* error); |
| 813 bool LoadNaClModules(string16* error); | 787 bool LoadNaClModules(string16* error); |
| 814 bool LoadSandboxedPages(string16* error); | 788 bool LoadSandboxedPages(string16* error); |
| 815 // Must be called after LoadPlugins(). | 789 // Must be called after LoadPlugins(). |
| 816 bool LoadRequirements(string16* error); | 790 bool LoadRequirements(string16* error); |
| 817 bool LoadDefaultLocale(string16* error); | 791 bool LoadDefaultLocale(string16* error); |
| 818 bool LoadOfflineEnabled(string16* error); | 792 bool LoadOfflineEnabled(string16* error); |
| 819 bool LoadBackgroundScripts(string16* error); | 793 bool LoadBackgroundScripts(string16* error); |
| 820 bool LoadBackgroundScripts(const std::string& key, string16* error); | 794 bool LoadBackgroundScripts(const std::string& key, string16* error); |
| 821 bool LoadBackgroundPage(const APIPermissionSet& api_permissions, | 795 bool LoadBackgroundPage(const APIPermissionSet& api_permissions, |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 989 | 963 |
| 990 // The extension's system indicator, if any. | 964 // The extension's system indicator, if any. |
| 991 scoped_ptr<ActionInfo> system_indicator_info_; | 965 scoped_ptr<ActionInfo> system_indicator_info_; |
| 992 | 966 |
| 993 // Optional list of NPAPI plugins and associated properties. | 967 // Optional list of NPAPI plugins and associated properties. |
| 994 std::vector<PluginInfo> plugins_; | 968 std::vector<PluginInfo> plugins_; |
| 995 | 969 |
| 996 // Optional list of NaCl modules and associated properties. | 970 // Optional list of NaCl modules and associated properties. |
| 997 std::vector<NaClModuleInfo> nacl_modules_; | 971 std::vector<NaClModuleInfo> nacl_modules_; |
| 998 | 972 |
| 999 // Optional list of commands (keyboard shortcuts). | |
| 1000 scoped_ptr<extensions::Command> browser_action_command_; | |
| 1001 scoped_ptr<extensions::Command> page_action_command_; | |
| 1002 scoped_ptr<extensions::Command> script_badge_command_; | |
| 1003 extensions::CommandMap named_commands_; | |
| 1004 | |
| 1005 // Optional list of extension pages that are sandboxed (served from a unique | 973 // Optional list of extension pages that are sandboxed (served from a unique |
| 1006 // origin with a different Content Security Policy). | 974 // origin with a different Content Security Policy). |
| 1007 URLPatternSet sandboxed_pages_; | 975 URLPatternSet sandboxed_pages_; |
| 1008 | 976 |
| 1009 // Content Security Policy that should be used to enforce the sandbox used | 977 // Content Security Policy that should be used to enforce the sandbox used |
| 1010 // by sandboxed pages (guaranteed to have the "sandbox" directive without the | 978 // by sandboxed pages (guaranteed to have the "sandbox" directive without the |
| 1011 // "allow-same-origin" token). | 979 // "allow-same-origin" token). |
| 1012 std::string sandboxed_pages_content_security_policy_; | 980 std::string sandboxed_pages_content_security_policy_; |
| 1013 | 981 |
| 1014 // Optional URL to a master page of which a single instance should be always | 982 // Optional URL to a master page of which a single instance should be always |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1168 | 1136 |
| 1169 UpdatedExtensionPermissionsInfo( | 1137 UpdatedExtensionPermissionsInfo( |
| 1170 const Extension* extension, | 1138 const Extension* extension, |
| 1171 const PermissionSet* permissions, | 1139 const PermissionSet* permissions, |
| 1172 Reason reason); | 1140 Reason reason); |
| 1173 }; | 1141 }; |
| 1174 | 1142 |
| 1175 } // namespace extensions | 1143 } // namespace extensions |
| 1176 | 1144 |
| 1177 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 1145 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |