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

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

Issue 2574763003: Remove chrome-extension-resource:// scheme (Closed)
Patch Set: Remove BUILD reference to resources/extension outdir. Created 4 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
« no previous file with comments | « chrome/renderer/extensions/resource_request_policy.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/logging.h" 7 #include "base/logging.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/common/extensions/chrome_manifest_url_handlers.h" 9 #include "chrome/common/extensions/chrome_manifest_url_handlers.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 frame->addMessageToConsole( 107 frame->addMessageToConsole(
108 blink::WebConsoleMessage(blink::WebConsoleMessage::LevelError, 108 blink::WebConsoleMessage(blink::WebConsoleMessage::LevelError,
109 blink::WebString::fromUTF8(message))); 109 blink::WebString::fromUTF8(message)));
110 return false; 110 return false;
111 } 111 }
112 } 112 }
113 113
114 return true; 114 return true;
115 } 115 }
116 116
117 bool ResourceRequestPolicy::CanRequestExtensionResourceScheme(
118 const blink::WebURL& resource_url,
119 blink::WebFrame* frame) {
120 CHECK(resource_url.protocolIs(kExtensionResourceScheme));
121
122 GURL frame_url = frame->document().url();
123 if (!frame_url.is_empty() && !frame_url.SchemeIs(kExtensionScheme)) {
124 std::string message = base::StringPrintf(
125 "Denying load of %s. chrome-extension-resources:// can only be "
126 "loaded from extensions.",
127 resource_url.string().utf8().c_str());
128 frame->addMessageToConsole(
129 blink::WebConsoleMessage(blink::WebConsoleMessage::LevelError,
130 blink::WebString::fromUTF8(message)));
131 return false;
132 }
133
134 return true;
135 }
136
137 } // namespace extensions 117 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/resource_request_policy.h ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698