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

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: 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
OLDNEW
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 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <iosfwd> 9 #include <iosfwd>
10 #include <map> 10 #include <map>
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 static GURL GetResourceURL(const GURL& extension_url, 411 static GURL GetResourceURL(const GURL& extension_url,
412 const std::string& relative_path); 412 const std::string& relative_path);
413 GURL GetResourceURL(const std::string& relative_path) const { 413 GURL GetResourceURL(const std::string& relative_path) const {
414 return GetResourceURL(url(), relative_path); 414 return GetResourceURL(url(), relative_path);
415 } 415 }
416 416
417 // Returns true if the resource matches a pattern in the pattern_set. 417 // Returns true if the resource matches a pattern in the pattern_set.
418 bool ResourceMatches(const URLPatternSet& pattern_set, 418 bool ResourceMatches(const URLPatternSet& pattern_set,
419 const std::string& resource) const; 419 const std::string& resource) const;
420 420
421 // Returns true if the specified resource is web accessible.
422 bool IsResourceWebAccessible(const std::string& relative_path) const;
423
424 // Returns true if the specified page is sandboxed (served in a unique 421 // Returns true if the specified page is sandboxed (served in a unique
425 // origin). 422 // origin).
426 bool IsSandboxedPage(const std::string& relative_path) const; 423 bool IsSandboxedPage(const std::string& relative_path) const;
427 424
428 // Returns the Content Security Policy that the specified resource should be 425 // Returns the Content Security Policy that the specified resource should be
429 // served with. 426 // served with.
430 std::string GetResourceContentSecurityPolicy(const std::string& relative_path) 427 std::string GetResourceContentSecurityPolicy(const std::string& relative_path)
431 const; 428 const;
432 429
433 // Returns true when 'web_accessible_resources' are defined for the extension.
434 bool HasWebAccessibleResources() const;
435
436 // Returns an extension resource object. |relative_path| should be UTF8 430 // Returns an extension resource object. |relative_path| should be UTF8
437 // encoded. 431 // encoded.
438 ExtensionResource GetResource(const std::string& relative_path) const; 432 ExtensionResource GetResource(const std::string& relative_path) const;
439 433
440 // As above, but with |relative_path| following the file system's encoding. 434 // As above, but with |relative_path| following the file system's encoding.
441 ExtensionResource GetResource(const FilePath& relative_path) const; 435 ExtensionResource GetResource(const FilePath& relative_path) const;
442 436
443 // |input| is expected to be the text of an rsa public or private key. It 437 // |input| is expected to be the text of an rsa public or private key. It
444 // tolerates the presence or absence of bracking header/footer like this: 438 // tolerates the presence or absence of bracking header/footer like this:
445 // -----(BEGIN|END) [RSA PUBLIC/PRIVATE] KEY----- 439 // -----(BEGIN|END) [RSA PUBLIC/PRIVATE] KEY-----
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 892
899 bool LoadSharedFeatures(const APIPermissionSet& api_permissions, 893 bool LoadSharedFeatures(const APIPermissionSet& api_permissions,
900 string16* error); 894 string16* error);
901 bool LoadDescription(string16* error); 895 bool LoadDescription(string16* error);
902 bool LoadManifestVersion(string16* error); 896 bool LoadManifestVersion(string16* error);
903 bool LoadUpdateURL(string16* error); 897 bool LoadUpdateURL(string16* error);
904 bool LoadIcons(string16* error); 898 bool LoadIcons(string16* error);
905 bool LoadCommands(string16* error); 899 bool LoadCommands(string16* error);
906 bool LoadPlugins(string16* error); 900 bool LoadPlugins(string16* error);
907 bool LoadNaClModules(string16* error); 901 bool LoadNaClModules(string16* error);
908 bool LoadWebAccessibleResources(string16* error);
909 bool LoadSandboxedPages(string16* error); 902 bool LoadSandboxedPages(string16* error);
910 // Must be called after LoadPlugins(). 903 // Must be called after LoadPlugins().
911 bool LoadRequirements(string16* error); 904 bool LoadRequirements(string16* error);
912 bool LoadDefaultLocale(string16* error); 905 bool LoadDefaultLocale(string16* error);
913 bool LoadOfflineEnabled(string16* error); 906 bool LoadOfflineEnabled(string16* error);
914 bool LoadOptionsPage(string16* error); 907 bool LoadOptionsPage(string16* error);
915 bool LoadBackgroundScripts(string16* error); 908 bool LoadBackgroundScripts(string16* error);
916 bool LoadBackgroundScripts(const std::string& key, string16* error); 909 bool LoadBackgroundScripts(const std::string& key, string16* error);
917 bool LoadBackgroundPage(const APIPermissionSet& api_permissions, 910 bool LoadBackgroundPage(const APIPermissionSet& api_permissions,
918 string16* error); 911 string16* error);
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 1102
1110 // Optional list of input components and associated properties. 1103 // Optional list of input components and associated properties.
1111 std::vector<InputComponentInfo> input_components_; 1104 std::vector<InputComponentInfo> input_components_;
1112 1105
1113 // Optional list of commands (keyboard shortcuts). 1106 // Optional list of commands (keyboard shortcuts).
1114 scoped_ptr<extensions::Command> browser_action_command_; 1107 scoped_ptr<extensions::Command> browser_action_command_;
1115 scoped_ptr<extensions::Command> page_action_command_; 1108 scoped_ptr<extensions::Command> page_action_command_;
1116 scoped_ptr<extensions::Command> script_badge_command_; 1109 scoped_ptr<extensions::Command> script_badge_command_;
1117 extensions::CommandMap named_commands_; 1110 extensions::CommandMap named_commands_;
1118 1111
1119 // Optional list of web accessible extension resources.
1120 URLPatternSet web_accessible_resources_;
1121
1122 // Optional list of extension pages that are sandboxed (served from a unique 1112 // Optional list of extension pages that are sandboxed (served from a unique
1123 // origin with a different Content Security Policy). 1113 // origin with a different Content Security Policy).
1124 URLPatternSet sandboxed_pages_; 1114 URLPatternSet sandboxed_pages_;
1125 1115
1126 // Content Security Policy that should be used to enforce the sandbox used 1116 // Content Security Policy that should be used to enforce the sandbox used
1127 // by sandboxed pages (guaranteed to have the "sandbox" directive without the 1117 // by sandboxed pages (guaranteed to have the "sandbox" directive without the
1128 // "allow-same-origin" token). 1118 // "allow-same-origin" token).
1129 std::string sandboxed_pages_content_security_policy_; 1119 std::string sandboxed_pages_content_security_policy_;
1130 1120
1131 // Optional URL to a master page of which a single instance should be always 1121 // Optional URL to a master page of which a single instance should be always
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
1299 1289
1300 UpdatedExtensionPermissionsInfo( 1290 UpdatedExtensionPermissionsInfo(
1301 const Extension* extension, 1291 const Extension* extension,
1302 const PermissionSet* permissions, 1292 const PermissionSet* permissions,
1303 Reason reason); 1293 Reason reason);
1304 }; 1294 };
1305 1295
1306 } // namespace extensions 1296 } // namespace extensions
1307 1297
1308 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_ 1298 #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698