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