Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(165)

Side by Side Diff: chrome/common/extensions/extension.h

Issue 11821009: move 'web_accessible_resources' parsing out of Extension class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@url_parse
Patch Set: patch rebased Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 static GURL GetResourceURL(const GURL& extension_url, 360 static GURL GetResourceURL(const GURL& extension_url,
361 const std::string& relative_path); 361 const std::string& relative_path);
362 GURL GetResourceURL(const std::string& relative_path) const { 362 GURL GetResourceURL(const std::string& relative_path) const {
363 return GetResourceURL(url(), relative_path); 363 return GetResourceURL(url(), relative_path);
364 } 364 }
365 365
366 // Returns true if the resource matches a pattern in the pattern_set. 366 // Returns true if the resource matches a pattern in the pattern_set.
367 bool ResourceMatches(const URLPatternSet& pattern_set, 367 bool ResourceMatches(const URLPatternSet& pattern_set,
368 const std::string& resource) const; 368 const std::string& resource) const;
369 369
370 // Returns true if the specified resource is web accessible.
371 bool IsResourceWebAccessible(const std::string& relative_path) const;
372
373 // Returns true if the specified page is sandboxed (served in a unique 370 // Returns true if the specified page is sandboxed (served in a unique
374 // origin). 371 // origin).
375 bool IsSandboxedPage(const std::string& relative_path) const; 372 bool IsSandboxedPage(const std::string& relative_path) const;
376 373
377 // Returns the Content Security Policy that the specified resource should be 374 // Returns the Content Security Policy that the specified resource should be
378 // served with. 375 // served with.
379 std::string GetResourceContentSecurityPolicy(const std::string& relative_path) 376 std::string GetResourceContentSecurityPolicy(const std::string& relative_path)
380 const; 377 const;
381 378
382 // Returns true when 'web_accessible_resources' are defined for the extension.
383 bool HasWebAccessibleResources() const;
384
385 // Returns an extension resource object. |relative_path| should be UTF8 379 // Returns an extension resource object. |relative_path| should be UTF8
386 // encoded. 380 // encoded.
387 ExtensionResource GetResource(const std::string& relative_path) const; 381 ExtensionResource GetResource(const std::string& relative_path) const;
388 382
389 // As above, but with |relative_path| following the file system's encoding. 383 // As above, but with |relative_path| following the file system's encoding.
390 ExtensionResource GetResource(const FilePath& relative_path) const; 384 ExtensionResource GetResource(const FilePath& relative_path) const;
391 385
392 // |input| is expected to be the text of an rsa public or private key. It 386 // |input| is expected to be the text of an rsa public or private key. It
393 // tolerates the presence or absence of bracking header/footer like this: 387 // tolerates the presence or absence of bracking header/footer like this:
394 // -----(BEGIN|END) [RSA PUBLIC/PRIVATE] KEY----- 388 // -----(BEGIN|END) [RSA PUBLIC/PRIVATE] KEY-----
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
832 bool LoadLaunchURL(string16* error); 826 bool LoadLaunchURL(string16* error);
833 827
834 bool LoadSharedFeatures(const APIPermissionSet& api_permissions, 828 bool LoadSharedFeatures(const APIPermissionSet& api_permissions,
835 string16* error); 829 string16* error);
836 bool LoadDescription(string16* error); 830 bool LoadDescription(string16* error);
837 bool LoadManifestVersion(string16* error); 831 bool LoadManifestVersion(string16* error);
838 bool LoadIcons(string16* error); 832 bool LoadIcons(string16* error);
839 bool LoadCommands(string16* error); 833 bool LoadCommands(string16* error);
840 bool LoadPlugins(string16* error); 834 bool LoadPlugins(string16* error);
841 bool LoadNaClModules(string16* error); 835 bool LoadNaClModules(string16* error);
842 bool LoadWebAccessibleResources(string16* error);
843 bool LoadSandboxedPages(string16* error); 836 bool LoadSandboxedPages(string16* error);
844 // Must be called after LoadPlugins(). 837 // Must be called after LoadPlugins().
845 bool LoadRequirements(string16* error); 838 bool LoadRequirements(string16* error);
846 bool LoadDefaultLocale(string16* error); 839 bool LoadDefaultLocale(string16* error);
847 bool LoadOfflineEnabled(string16* error); 840 bool LoadOfflineEnabled(string16* error);
848 bool LoadBackgroundScripts(string16* error); 841 bool LoadBackgroundScripts(string16* error);
849 bool LoadBackgroundScripts(const std::string& key, string16* error); 842 bool LoadBackgroundScripts(const std::string& key, string16* error);
850 bool LoadBackgroundPage(const APIPermissionSet& api_permissions, 843 bool LoadBackgroundPage(const APIPermissionSet& api_permissions,
851 string16* error); 844 string16* error);
852 bool LoadBackgroundPage(const std::string& key, 845 bool LoadBackgroundPage(const std::string& key,
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 1028
1036 // Optional list of NaCl modules and associated properties. 1029 // Optional list of NaCl modules and associated properties.
1037 std::vector<NaClModuleInfo> nacl_modules_; 1030 std::vector<NaClModuleInfo> nacl_modules_;
1038 1031
1039 // Optional list of commands (keyboard shortcuts). 1032 // Optional list of commands (keyboard shortcuts).
1040 scoped_ptr<extensions::Command> browser_action_command_; 1033 scoped_ptr<extensions::Command> browser_action_command_;
1041 scoped_ptr<extensions::Command> page_action_command_; 1034 scoped_ptr<extensions::Command> page_action_command_;
1042 scoped_ptr<extensions::Command> script_badge_command_; 1035 scoped_ptr<extensions::Command> script_badge_command_;
1043 extensions::CommandMap named_commands_; 1036 extensions::CommandMap named_commands_;
1044 1037
1045 // Optional list of web accessible extension resources.
1046 URLPatternSet web_accessible_resources_;
1047
1048 // Optional list of extension pages that are sandboxed (served from a unique 1038 // Optional list of extension pages that are sandboxed (served from a unique
1049 // origin with a different Content Security Policy). 1039 // origin with a different Content Security Policy).
1050 URLPatternSet sandboxed_pages_; 1040 URLPatternSet sandboxed_pages_;
1051 1041
1052 // Content Security Policy that should be used to enforce the sandbox used 1042 // Content Security Policy that should be used to enforce the sandbox used
1053 // by sandboxed pages (guaranteed to have the "sandbox" directive without the 1043 // by sandboxed pages (guaranteed to have the "sandbox" directive without the
1054 // "allow-same-origin" token). 1044 // "allow-same-origin" token).
1055 std::string sandboxed_pages_content_security_policy_; 1045 std::string sandboxed_pages_content_security_policy_;
1056 1046
1057 // Optional URL to a master page of which a single instance should be always 1047 // Optional URL to a master page of which a single instance should be always
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
1214 1204
1215 UpdatedExtensionPermissionsInfo( 1205 UpdatedExtensionPermissionsInfo(
1216 const Extension* extension, 1206 const Extension* extension,
1217 const PermissionSet* permissions, 1207 const PermissionSet* permissions,
1218 Reason reason); 1208 Reason reason);
1219 }; 1209 };
1220 1210
1221 } // namespace extensions 1211 } // namespace extensions
1222 1212
1223 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 1213 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW
« no previous file with comments | « chrome/chrome_tests_unit.gypi ('k') | chrome/common/extensions/extension.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698