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

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

Issue 10826134: Revert 149610 - Extension resources should only load in contexts the extension has permission to ac… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
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 #include "chrome/common/extensions/extension.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after
529 return ResourceMatches(web_accessible_resources_, relative_path); 529 return ResourceMatches(web_accessible_resources_, relative_path);
530 } 530 }
531 531
532 bool Extension::HasWebAccessibleResources() const { 532 bool Extension::HasWebAccessibleResources() const {
533 if (web_accessible_resources_.size()) 533 if (web_accessible_resources_.size())
534 return true; 534 return true;
535 535
536 return false; 536 return false;
537 } 537 }
538 538
539 bool Extension::HasNaClModules() const {
540 if (nacl_modules_.size())
541 return true;
542
543 return false;
544 }
545
546 bool Extension::IsSandboxedPage(const std::string& relative_path) const { 539 bool Extension::IsSandboxedPage(const std::string& relative_path) const {
547 return ResourceMatches(sandboxed_pages_, relative_path); 540 return ResourceMatches(sandboxed_pages_, relative_path);
548 } 541 }
549 542
550 bool Extension::IsResourceNaClManifest(const std::string& resource) const {
551 GURL url = extension_url_.Resolve(resource);
552 for (std::vector<NaClModuleInfo>::const_iterator it = nacl_modules_.begin();
553 it != nacl_modules_.end(); it++) {
554 if (it->url == url)
555 return true;
556 }
557 return false;
558 }
559
560 543
561 std::string Extension::GetResourceContentSecurityPolicy( 544 std::string Extension::GetResourceContentSecurityPolicy(
562 const std::string& relative_path) const { 545 const std::string& relative_path) const {
563 return IsSandboxedPage(relative_path) ? 546 return IsSandboxedPage(relative_path) ?
564 sandboxed_pages_content_security_policy_ : content_security_policy_; 547 sandboxed_pages_content_security_policy_ : content_security_policy_;
565 } 548 }
566 549
567 bool Extension::GenerateId(const std::string& input, std::string* output) { 550 bool Extension::GenerateId(const std::string& input, std::string* output) {
568 DCHECK(output); 551 DCHECK(output);
569 uint8 hash[Extension::kIdSize]; 552 uint8 hash[Extension::kIdSize];
(...skipping 3345 matching lines...) Expand 10 before | Expand all | Expand 10 after
3915 3898
3916 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3899 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3917 const Extension* extension, 3900 const Extension* extension,
3918 const PermissionSet* permissions, 3901 const PermissionSet* permissions,
3919 Reason reason) 3902 Reason reason)
3920 : reason(reason), 3903 : reason(reason),
3921 extension(extension), 3904 extension(extension),
3922 permissions(permissions) {} 3905 permissions(permissions) {}
3923 3906
3924 } // namespace extensions 3907 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.h ('k') | chrome/renderer/extensions/extension_resource_request_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698