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/extension_resource_request_policy.h" | 5 #include "chrome/renderer/extensions/extension_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/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "chrome/common/chrome_switches.h" | 10 #include "chrome/common/chrome_switches.h" |
11 #include "chrome/common/url_constants.h" | 11 #include "chrome/common/url_constants.h" |
12 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
13 #include "chrome/common/extensions/extension_set.h" | 13 #include "chrome/common/extensions/extension_set.h" |
14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h" |
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
19 | 19 |
| 20 using extensions::Extension; |
| 21 |
20 // static | 22 // static |
21 bool ExtensionResourceRequestPolicy::CanRequestResource( | 23 bool ExtensionResourceRequestPolicy::CanRequestResource( |
22 const GURL& resource_url, | 24 const GURL& resource_url, |
23 WebKit::WebFrame* frame, | 25 WebKit::WebFrame* frame, |
24 const ExtensionSet* loaded_extensions) { | 26 const ExtensionSet* loaded_extensions) { |
25 CHECK(resource_url.SchemeIs(chrome::kExtensionScheme)); | 27 CHECK(resource_url.SchemeIs(chrome::kExtensionScheme)); |
26 | 28 |
27 const Extension* extension = | 29 const Extension* extension = |
28 loaded_extensions->GetExtensionOrAppByURL(ExtensionURLInfo(resource_url)); | 30 loaded_extensions->GetExtensionOrAppByURL(ExtensionURLInfo(resource_url)); |
29 if (!extension) { | 31 if (!extension) { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 WebKit::WebConsoleMessage(WebKit::WebConsoleMessage::LevelError, | 100 WebKit::WebConsoleMessage(WebKit::WebConsoleMessage::LevelError, |
99 WebKit::WebString::fromUTF8(message))); | 101 WebKit::WebString::fromUTF8(message))); |
100 return false; | 102 return false; |
101 } | 103 } |
102 | 104 |
103 return true; | 105 return true; |
104 } | 106 } |
105 | 107 |
106 ExtensionResourceRequestPolicy::ExtensionResourceRequestPolicy() { | 108 ExtensionResourceRequestPolicy::ExtensionResourceRequestPolicy() { |
107 } | 109 } |
OLD | NEW |