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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 WebKit::WebConsoleMessage(WebKit::WebConsoleMessage::LevelError, | 73 WebKit::WebConsoleMessage(WebKit::WebConsoleMessage::LevelError, |
72 WebKit::WebString::fromUTF8(message))); | 74 WebKit::WebString::fromUTF8(message))); |
73 return false; | 75 return false; |
74 } | 76 } |
75 | 77 |
76 return true; | 78 return true; |
77 } | 79 } |
78 | 80 |
79 ExtensionResourceRequestPolicy::ExtensionResourceRequestPolicy() { | 81 ExtensionResourceRequestPolicy::ExtensionResourceRequestPolicy() { |
80 } | 82 } |
OLD | NEW |