| 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 <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 // NOTE: Static so that it can be used from multiple threads. | 323 // NOTE: Static so that it can be used from multiple threads. |
| 324 static GURL GetResourceURL(const GURL& extension_url, | 324 static GURL GetResourceURL(const GURL& extension_url, |
| 325 const std::string& relative_path); | 325 const std::string& relative_path); |
| 326 GURL GetResourceURL(const std::string& relative_path) const { | 326 GURL GetResourceURL(const std::string& relative_path) const { |
| 327 return GetResourceURL(url(), relative_path); | 327 return GetResourceURL(url(), relative_path); |
| 328 } | 328 } |
| 329 | 329 |
| 330 // Returns true if the specified resource is web accessible. | 330 // Returns true if the specified resource is web accessible. |
| 331 bool IsResourceWebAccessible(const std::string& relative_path) const; | 331 bool IsResourceWebAccessible(const std::string& relative_path) const; |
| 332 | 332 |
| 333 // Returns true if the specified page is sandboxed (served in a unique |
| 334 // origin). |
| 335 bool IsSandboxedPage(const std::string& relative_path) const; |
| 336 |
| 337 // Returns the Content Security Policy that the specified resource should be |
| 338 // served with. |
| 339 std::string GetResourceContentSecurityPolicy(const std::string& relative_path) |
| 340 const; |
| 341 |
| 333 // Returns true when 'web_accessible_resources' are defined for the extension. | 342 // Returns true when 'web_accessible_resources' are defined for the extension. |
| 334 bool HasWebAccessibleResources() const; | 343 bool HasWebAccessibleResources() const; |
| 335 | 344 |
| 336 // Returns an extension resource object. |relative_path| should be UTF8 | 345 // Returns an extension resource object. |relative_path| should be UTF8 |
| 337 // encoded. | 346 // encoded. |
| 338 ExtensionResource GetResource(const std::string& relative_path) const; | 347 ExtensionResource GetResource(const std::string& relative_path) const; |
| 339 | 348 |
| 340 // As above, but with |relative_path| following the file system's encoding. | 349 // As above, but with |relative_path| following the file system's encoding. |
| 341 ExtensionResource GetResource(const FilePath& relative_path) const; | 350 ExtensionResource GetResource(const FilePath& relative_path) const; |
| 342 | 351 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 const std::vector<webkit_glue::WebIntentServiceData>& | 632 const std::vector<webkit_glue::WebIntentServiceData>& |
| 624 intents_services() const { | 633 intents_services() const { |
| 625 return intents_services_; | 634 return intents_services_; |
| 626 } | 635 } |
| 627 | 636 |
| 628 bool wants_file_access() const { return wants_file_access_; } | 637 bool wants_file_access() const { return wants_file_access_; } |
| 629 int creation_flags() const { return creation_flags_; } | 638 int creation_flags() const { return creation_flags_; } |
| 630 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } | 639 bool from_webstore() const { return (creation_flags_ & FROM_WEBSTORE) != 0; } |
| 631 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } | 640 bool from_bookmark() const { return (creation_flags_ & FROM_BOOKMARK) != 0; } |
| 632 | 641 |
| 633 const std::string& content_security_policy() const { | |
| 634 return content_security_policy_; | |
| 635 } | |
| 636 | |
| 637 // App-related. | 642 // App-related. |
| 638 bool is_app() const { | 643 bool is_app() const { |
| 639 return is_packaged_app() || is_hosted_app() || is_platform_app(); | 644 return is_packaged_app() || is_hosted_app() || is_platform_app(); |
| 640 } | 645 } |
| 641 bool is_platform_app() const; | 646 bool is_platform_app() const; |
| 642 bool is_hosted_app() const; | 647 bool is_hosted_app() const; |
| 643 bool is_packaged_app() const; | 648 bool is_packaged_app() const; |
| 644 bool is_storage_isolated() const { return is_storage_isolated_; } | 649 bool is_storage_isolated() const { return is_storage_isolated_; } |
| 645 const URLPatternSet& web_extent() const { return extent_; } | 650 const URLPatternSet& web_extent() const { return extent_; } |
| 646 const std::string& launch_local_path() const { return launch_local_path_; } | 651 const std::string& launch_local_path() const { return launch_local_path_; } |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 735 string16* error); | 740 string16* error); |
| 736 bool LoadDescription(string16* error); | 741 bool LoadDescription(string16* error); |
| 737 bool LoadManifestVersion(string16* error); | 742 bool LoadManifestVersion(string16* error); |
| 738 bool LoadHomepageURL(string16* error); | 743 bool LoadHomepageURL(string16* error); |
| 739 bool LoadUpdateURL(string16* error); | 744 bool LoadUpdateURL(string16* error); |
| 740 bool LoadIcons(string16* error); | 745 bool LoadIcons(string16* error); |
| 741 bool LoadCommands(string16* error); | 746 bool LoadCommands(string16* error); |
| 742 bool LoadPlugins(string16* error); | 747 bool LoadPlugins(string16* error); |
| 743 bool LoadNaClModules(string16* error); | 748 bool LoadNaClModules(string16* error); |
| 744 bool LoadWebAccessibleResources(string16* error); | 749 bool LoadWebAccessibleResources(string16* error); |
| 750 bool LoadSandboxedPages(string16* error); |
| 745 bool CheckRequirements(string16* error); | 751 bool CheckRequirements(string16* error); |
| 746 bool LoadDefaultLocale(string16* error); | 752 bool LoadDefaultLocale(string16* error); |
| 747 bool LoadOfflineEnabled(string16* error); | 753 bool LoadOfflineEnabled(string16* error); |
| 748 bool LoadOptionsPage(string16* error); | 754 bool LoadOptionsPage(string16* error); |
| 749 bool LoadBackgroundScripts(string16* error); | 755 bool LoadBackgroundScripts(string16* error); |
| 750 bool LoadBackgroundPage(const ExtensionAPIPermissionSet& api_permissions, | 756 bool LoadBackgroundPage(const ExtensionAPIPermissionSet& api_permissions, |
| 751 string16* error); | 757 string16* error); |
| 752 bool LoadBackgroundPersistent( | 758 bool LoadBackgroundPersistent( |
| 753 const ExtensionAPIPermissionSet& api_permissions, | 759 const ExtensionAPIPermissionSet& api_permissions, |
| 754 string16* error); | 760 string16* error); |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 std::vector<InputComponentInfo> input_components_; | 949 std::vector<InputComponentInfo> input_components_; |
| 944 | 950 |
| 945 // Optional list of commands (keyboard shortcuts). | 951 // Optional list of commands (keyboard shortcuts). |
| 946 scoped_ptr<extensions::Command> browser_action_command_; | 952 scoped_ptr<extensions::Command> browser_action_command_; |
| 947 scoped_ptr<extensions::Command> page_action_command_; | 953 scoped_ptr<extensions::Command> page_action_command_; |
| 948 extensions::CommandMap named_commands_; | 954 extensions::CommandMap named_commands_; |
| 949 | 955 |
| 950 // Optional list of web accessible extension resources. | 956 // Optional list of web accessible extension resources. |
| 951 base::hash_set<std::string> web_accessible_resources_; | 957 base::hash_set<std::string> web_accessible_resources_; |
| 952 | 958 |
| 959 // Optional list of extension pages that are sandboxed (served from a unique |
| 960 // origin with a different Content Security Policy). |
| 961 base::hash_set<std::string> sandboxed_pages_; |
| 962 |
| 963 // Content Security Policy that should be used to enforce the sandbox used |
| 964 // by sandboxed pages (guaranteed to have the "sandbox" directive without the |
| 965 // "allow-same-origin" token). |
| 966 std::string sandboxed_pages_content_security_policy_; |
| 967 |
| 953 // Optional URL to a master page of which a single instance should be always | 968 // Optional URL to a master page of which a single instance should be always |
| 954 // loaded in the background. | 969 // loaded in the background. |
| 955 GURL background_url_; | 970 GURL background_url_; |
| 956 | 971 |
| 957 // Optional list of scripts to use to generate a background page. If this is | 972 // Optional list of scripts to use to generate a background page. If this is |
| 958 // present, background_url_ will be empty and generated by GetBackgroundURL(). | 973 // present, background_url_ will be empty and generated by GetBackgroundURL(). |
| 959 std::vector<std::string> background_scripts_; | 974 std::vector<std::string> background_scripts_; |
| 960 | 975 |
| 961 // True if the background page should stay loaded forever; false if it should | 976 // True if the background page should stay loaded forever; false if it should |
| 962 // load on-demand (when it needs to handle an event). Defaults to true. | 977 // load on-demand (when it needs to handle an event). Defaults to true. |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1117 | 1132 |
| 1118 UpdatedExtensionPermissionsInfo( | 1133 UpdatedExtensionPermissionsInfo( |
| 1119 const Extension* extension, | 1134 const Extension* extension, |
| 1120 const ExtensionPermissionSet* permissions, | 1135 const ExtensionPermissionSet* permissions, |
| 1121 Reason reason); | 1136 Reason reason); |
| 1122 }; | 1137 }; |
| 1123 | 1138 |
| 1124 } // namespace extensions | 1139 } // namespace extensions |
| 1125 | 1140 |
| 1126 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 1141 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |