summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions/extension_resource_request_policy.cc
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-22 03:25:25 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-22 03:25:25 +0000
commit68f2f9eee86b0afd0236b10a5c1a762defe11b2d (patch)
tree34a8762d074ae5fbed1d023173e3a2219d4e20c0 /chrome/renderer/extensions/extension_resource_request_policy.cc
parent6a5a2e5017f3b4e3cecf2d5d2fb15efd838b0d30 (diff)
downloadchromium_src-68f2f9eee86b0afd0236b10a5c1a762defe11b2d.zip
chromium_src-68f2f9eee86b0afd0236b10a5c1a762defe11b2d.tar.gz
chromium_src-68f2f9eee86b0afd0236b10a5c1a762defe11b2d.tar.bz2
Add a helpful console message in case web-inaccessible request.
BUG=112620 Review URL: http://codereview.chromium.org/9805004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128157 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/extensions/extension_resource_request_policy.cc')
-rw-r--r--chrome/renderer/extensions/extension_resource_request_policy.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/chrome/renderer/extensions/extension_resource_request_policy.cc b/chrome/renderer/extensions/extension_resource_request_policy.cc
index 6e7e6c8..4bee495 100644
--- a/chrome/renderer/extensions/extension_resource_request_policy.cc
+++ b/chrome/renderer/extensions/extension_resource_request_policy.cc
@@ -6,18 +6,21 @@
#include "base/command_line.h"
#include "base/logging.h"
+#include "base/stringprintf.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/url_constants.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_set.h"
#include "googleurl/src/gurl.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/WebConsoleMessage.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
+#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h"
// static
bool ExtensionResourceRequestPolicy::CanRequestResource(
const GURL& resource_url,
- const WebKit::WebFrame* frame,
+ WebKit::WebFrame* frame,
const ExtensionSet* loaded_extensions) {
CHECK(resource_url.SchemeIs(chrome::kExtensionScheme));
@@ -59,8 +62,14 @@ bool ExtensionResourceRequestPolicy::CanRequestResource(
!(page_url.SchemeIs(chrome::kChromeDevToolsScheme) &&
!extension->devtools_url().is_empty()) &&
!extension->IsResourceWebAccessible(resource_url.path())) {
- LOG(ERROR) << "Denying load of " << resource_url.spec() << " which "
- << "is not a web accessible resource.";
+ std::string message = base::StringPrintf(
+ "Denying load of %s. Resources must be listed in the "
+ "web_accessible_resources manifest key in order to be loaded by web "
+ "pages.",
+ resource_url.spec().c_str());
+ frame->addMessageToConsole(
+ WebKit::WebConsoleMessage(WebKit::WebConsoleMessage::LevelError,
+ WebKit::WebString::fromUTF8(message)));
return false;
}