Chromium Code Reviews| 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 CanWebAccessResource(const std::string& relative_path) const; | |
|
Aaron Boodman
2011/12/08 00:37:38
I think the name IsResourceWebAccessible() would b
Cris Neckar
2011/12/09 00:13:06
Done.
| |
| 325 | |
| 322 // Returns an extension resource object. |relative_path| should be UTF8 | 326 // Returns an extension resource object. |relative_path| should be UTF8 |
| 323 // encoded. | 327 // encoded. |
| 324 ExtensionResource GetResource(const std::string& relative_path) const; | 328 ExtensionResource GetResource(const std::string& relative_path) const; |
| 325 | 329 |
| 326 // As above, but with |relative_path| following the file system's encoding. | 330 // As above, but with |relative_path| following the file system's encoding. |
| 327 ExtensionResource GetResource(const FilePath& relative_path) const; | 331 ExtensionResource GetResource(const FilePath& relative_path) const; |
| 328 | 332 |
| 329 // |input| is expected to be the text of an rsa public or private key. It | 333 // |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: | 334 // tolerates the presence or absence of bracking header/footer like this: |
| 331 // -----(BEGIN|END) [RSA PUBLIC/PRIVATE] KEY----- | 335 // -----(BEGIN|END) [RSA PUBLIC/PRIVATE] KEY----- |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 783 | 787 |
| 784 // Optional list of NPAPI plugins and associated properties. | 788 // Optional list of NPAPI plugins and associated properties. |
| 785 std::vector<PluginInfo> plugins_; | 789 std::vector<PluginInfo> plugins_; |
| 786 | 790 |
| 787 // Optional list of NaCl modules and associated properties. | 791 // Optional list of NaCl modules and associated properties. |
| 788 std::vector<NaClModuleInfo> nacl_modules_; | 792 std::vector<NaClModuleInfo> nacl_modules_; |
| 789 | 793 |
| 790 // Optional list of input components and associated properties. | 794 // Optional list of input components and associated properties. |
| 791 std::vector<InputComponentInfo> input_components_; | 795 std::vector<InputComponentInfo> input_components_; |
| 792 | 796 |
| 797 // Optional list of web accessible extension resources. | |
| 798 base::hash_set<std::string> web_accessible_resources_; | |
| 799 | |
| 793 // Optional URL to a master page of which a single instance should be always | 800 // Optional URL to a master page of which a single instance should be always |
| 794 // loaded in the background. | 801 // loaded in the background. |
| 795 GURL background_url_; | 802 GURL background_url_; |
| 796 | 803 |
| 797 // Optional URL to a page for setting options/preferences. | 804 // Optional URL to a page for setting options/preferences. |
| 798 GURL options_url_; | 805 GURL options_url_; |
| 799 | 806 |
| 800 // Optional URL to a devtools extension page. | 807 // Optional URL to a devtools extension page. |
| 801 GURL devtools_url_; | 808 GURL devtools_url_; |
| 802 | 809 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 932 // only contain the removed permissions. | 939 // only contain the removed permissions. |
| 933 const ExtensionPermissionSet* permissions; | 940 const ExtensionPermissionSet* permissions; |
| 934 | 941 |
| 935 UpdatedExtensionPermissionsInfo( | 942 UpdatedExtensionPermissionsInfo( |
| 936 const Extension* extension, | 943 const Extension* extension, |
| 937 const ExtensionPermissionSet* permissions, | 944 const ExtensionPermissionSet* permissions, |
| 938 Reason reason); | 945 Reason reason); |
| 939 }; | 946 }; |
| 940 | 947 |
| 941 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ | 948 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ |
| OLD | NEW |