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

Side by Side Diff: chrome/renderer/extensions/extension_resource_request_policy.cc

Issue 8849010: Add 'web_accessible_resource" keyword for version 2 extension manifests. This makes extension res... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years 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) 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 #include "chrome/renderer/extensions/extension_resource_request_policy.h" 5 #include "chrome/renderer/extensions/extension_resource_request_policy.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/common/url_constants.h" 8 #include "chrome/common/url_constants.h"
9 #include "chrome/common/extensions/extension.h" 9 #include "chrome/common/extensions/extension.h"
10 #include "chrome/common/extensions/extension_set.h" 10 #include "chrome/common/extensions/extension_set.h"
(...skipping 20 matching lines...) Expand all
31 // launchers. 31 // launchers.
32 std::string resource_root_relative_path = 32 std::string resource_root_relative_path =
33 resource_url.path().empty() ? "" : resource_url.path().substr(1); 33 resource_url.path().empty() ? "" : resource_url.path().substr(1);
34 if (extension->is_hosted_app() && 34 if (extension->is_hosted_app() &&
35 !extension->icons().ContainsPath(resource_root_relative_path)) { 35 !extension->icons().ContainsPath(resource_root_relative_path)) {
36 LOG(ERROR) << "Denying load of " << resource_url.spec() << " from " 36 LOG(ERROR) << "Denying load of " << resource_url.spec() << " from "
37 << "hosted app."; 37 << "hosted app.";
38 return false; 38 return false;
39 } 39 }
40 40
41 // Disallow loading of extension resources which are not explicitely listed
42 // as web accessible if the manifest version is 2 or greater.
43 if (extension->manifest_version() < 2 &&
abarth-chromium 2011/12/07 22:55:34 Do you mean >= 2?
Cris Neckar 2011/12/09 00:13:06 Done.
44 !extension->CanWebAccessResource(resource_url.path())) {
45 LOG(ERROR) << "Denying load of " << resource_url.spec() << " which "
46 << "is not a web accessible resource.";
47 return false;
48 }
49
41 return true; 50 return true;
42 } 51 }
43 52
44 ExtensionResourceRequestPolicy::ExtensionResourceRequestPolicy() { 53 ExtensionResourceRequestPolicy::ExtensionResourceRequestPolicy() {
45 } 54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698