| OLD | NEW |
| 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/renderer/extensions/resource_request_policy.h" | 5 #include "chrome/renderer/extensions/resource_request_policy.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 // static | 33 // static |
| 34 bool ResourceRequestPolicy::CanRequestResource( | 34 bool ResourceRequestPolicy::CanRequestResource( |
| 35 const GURL& resource_url, | 35 const GURL& resource_url, |
| 36 WebKit::WebFrame* frame, | 36 WebKit::WebFrame* frame, |
| 37 content::PageTransition transition_type, | 37 content::PageTransition transition_type, |
| 38 const ExtensionSet* loaded_extensions) { | 38 const ExtensionSet* loaded_extensions) { |
| 39 CHECK(resource_url.SchemeIs(extensions::kExtensionScheme)); | 39 CHECK(resource_url.SchemeIs(extensions::kExtensionScheme)); |
| 40 | 40 |
| 41 const Extension* extension = | 41 const Extension* extension = |
| 42 loaded_extensions->GetExtensionOrAppByURL(ExtensionURLInfo(resource_url)); | 42 loaded_extensions->GetExtensionOrAppByURL(resource_url); |
| 43 if (!extension) { | 43 if (!extension) { |
| 44 // Allow the load in the case of a non-existent extension. We'll just get a | 44 // Allow the load in the case of a non-existent extension. We'll just get a |
| 45 // 404 from the browser process. | 45 // 404 from the browser process. |
| 46 return true; | 46 return true; |
| 47 } | 47 } |
| 48 | 48 |
| 49 // Disallow loading of packaged resources for hosted apps. We don't allow | 49 // Disallow loading of packaged resources for hosted apps. We don't allow |
| 50 // hybrid hosted/packaged apps. The one exception is access to icons, since | 50 // hybrid hosted/packaged apps. The one exception is access to icons, since |
| 51 // some extensions want to be able to do things like create their own | 51 // some extensions want to be able to do things like create their own |
| 52 // launchers. | 52 // launchers. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return false; | 123 return false; |
| 124 } | 124 } |
| 125 | 125 |
| 126 return true; | 126 return true; |
| 127 } | 127 } |
| 128 | 128 |
| 129 ResourceRequestPolicy::ResourceRequestPolicy() { | 129 ResourceRequestPolicy::ResourceRequestPolicy() { |
| 130 } | 130 } |
| 131 | 131 |
| 132 } // namespace extensions | 132 } // namespace extensions |
| OLD | NEW |