| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/linked_ptr.h" | 17 #include "base/memory/linked_ptr.h" |
| 17 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/synchronization/lock.h" | 20 #include "base/synchronization/lock.h" |
| 20 #include "chrome/common/extensions/extension_constants.h" | 21 #include "chrome/common/extensions/extension_constants.h" |
| 21 #include "chrome/common/extensions/extension_icon_set.h" | 22 #include "chrome/common/extensions/extension_icon_set.h" |
| 22 #include "chrome/common/extensions/extension_permission_set.h" | 23 #include "chrome/common/extensions/extension_permission_set.h" |
| 23 #include "chrome/common/extensions/manifest.h" | 24 #include "chrome/common/extensions/manifest.h" |
| 24 #include "chrome/common/extensions/user_script.h" | 25 #include "chrome/common/extensions/user_script.h" |
| 25 #include "chrome/common/extensions/url_pattern.h" | 26 #include "chrome/common/extensions/url_pattern.h" |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 // |extension_url| argument should be the url() from an Extension object. The | 316 // |extension_url| argument should be the url() from an Extension object. The |
| 316 // |relative_path| can be untrusted user input. The returned URL will either | 317 // |relative_path| can be untrusted user input. The returned URL will either |
| 317 // be invalid() or a child of |extension_url|. | 318 // be invalid() or a child of |extension_url|. |
| 318 // NOTE: Static so that it can be used from multiple threads. | 319 // NOTE: Static so that it can be used from multiple threads. |
| 319 static GURL GetResourceURL(const GURL& extension_url, | 320 static GURL GetResourceURL(const GURL& extension_url, |
| 320 const std::string& relative_path); | 321 const std::string& relative_path); |
| 321 GURL GetResourceURL(const std::string& relative_path) const { | 322 GURL GetResourceURL(const std::string& relative_path) const { |
| 322 return GetResourceURL(url(), relative_path); | 323 return GetResourceURL(url(), relative_path); |
| 323 } | 324 } |
| 324 | 325 |
| 326 // Returns true if the specified resource is web accessible. |
| 327 bool IsResourceWebAccessible(const std::string& relative_path) const; |
| 328 |
| 329 // Returns true when 'web_accessible_resources' are defined for the extension. |
| 330 bool HasWebAccessibleResources() const; |
| 331 |
| 325 // Returns an extension resource object. |relative_path| should be UTF8 | 332 // Returns an extension resource object. |relative_path| should be UTF8 |
| 326 // encoded. | 333 // encoded. |
| 327 ExtensionResource GetResource(const std::string& relative_path) const; | 334 ExtensionResource GetResource(const std::string& relative_path) const; |
| 328 | 335 |
| 329 // As above, but with |relative_path| following the file system's encoding. | 336 // As above, but with |relative_path| following the file system's encoding. |
| 330 ExtensionResource GetResource(const FilePath& relative_path) const; | 337 ExtensionResource GetResource(const FilePath& relative_path) const; |
| 331 | 338 |
| 332 // |input| is expected to be the text of an rsa public or private key. It | 339 // |input| is expected to be the text of an rsa public or private key. It |
| 333 // tolerates the presence or absence of bracking header/footer like this: | 340 // tolerates the presence or absence of bracking header/footer like this: |
| 334 // -----(BEGIN|END) [RSA PUBLIC/PRIVATE] KEY----- | 341 // -----(BEGIN|END) [RSA PUBLIC/PRIVATE] KEY----- |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 785 | 792 |
| 786 // Optional list of NPAPI plugins and associated properties. | 793 // Optional list of NPAPI plugins and associated properties. |
| 787 std::vector<PluginInfo> plugins_; | 794 std::vector<PluginInfo> plugins_; |
| 788 | 795 |
| 789 // Optional list of NaCl modules and associated properties. | 796 // Optional list of NaCl modules and associated properties. |
| 790 std::vector<NaClModuleInfo> nacl_modules_; | 797 std::vector<NaClModuleInfo> nacl_modules_; |
| 791 | 798 |
| 792 // Optional list of input components and associated properties. | 799 // Optional list of input components and associated properties. |
| 793 std::vector<InputComponentInfo> input_components_; | 800 std::vector<InputComponentInfo> input_components_; |
| 794 | 801 |
| 802 // Optional list of web accessible extension resources. |
| 803 base::hash_set<std::string> web_accessible_resources_; |
| 804 |
| 795 // Optional URL to a master page of which a single instance should be always | 805 // Optional URL to a master page of which a single instance should be always |
| 796 // loaded in the background. | 806 // loaded in the background. |
| 797 GURL background_url_; | 807 GURL background_url_; |
| 798 | 808 |
| 799 // Optional URL to a page for setting options/preferences. | 809 // Optional URL to a page for setting options/preferences. |
| 800 GURL options_url_; | 810 GURL options_url_; |
| 801 | 811 |
| 802 // Optional URL to a devtools extension page. | 812 // Optional URL to a devtools extension page. |
| 803 GURL devtools_url_; | 813 GURL devtools_url_; |
| 804 | 814 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 // only contain the removed permissions. | 944 // only contain the removed permissions. |
| 935 const ExtensionPermissionSet* permissions; | 945 const ExtensionPermissionSet* permissions; |
| 936 | 946 |
| 937 UpdatedExtensionPermissionsInfo( | 947 UpdatedExtensionPermissionsInfo( |
| 938 const Extension* extension, | 948 const Extension* extension, |
| 939 const ExtensionPermissionSet* permissions, | 949 const ExtensionPermissionSet* permissions, |
| 940 Reason reason); | 950 Reason reason); |
| 941 }; | 951 }; |
| 942 | 952 |
| 943 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 953 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |