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 #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 Loading... |
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 && |
| 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 } |
OLD | NEW |