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

Unified Diff: chrome/browser/renderer_host/buffered_resource_handler.cc

Issue 340057: Add first-class support for user scripts (Closed)
Patch Set: newness Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/renderer_host/buffered_resource_handler.cc
diff --git a/chrome/browser/renderer_host/buffered_resource_handler.cc b/chrome/browser/renderer_host/buffered_resource_handler.cc
index 33e6489c6b2fb0e2df89fd35be861393b7ab691d..097cd17e5cad007f81adeb4c713da33b3e6e26b5 100644
--- a/chrome/browser/renderer_host/buffered_resource_handler.cc
+++ b/chrome/browser/renderer_host/buffered_resource_handler.cc
@@ -15,6 +15,7 @@
#include "chrome/browser/renderer_host/resource_dispatcher_host.h"
#include "chrome/browser/renderer_host/resource_dispatcher_host_request_info.h"
#include "chrome/browser/renderer_host/x509_user_cert_resource_handler.h"
+#include "chrome/common/extensions/user_script.h"
#include "chrome/common/url_constants.h"
#include "net/base/io_buffer.h"
#include "net/base/mime_sniffer.h"
@@ -448,6 +449,10 @@ bool BufferedResourceHandler::ShouldDownload(bool* need_plugin_list) {
return true;
}
+ // Special-case user scripts to get downloaded instead of viewed.
+ if (UserScript::HasUserScriptFileExtension(request_->url()))
+ return true;
+
// MIME type checking.
if (net::IsSupportedMimeType(type))
return false;

Powered by Google App Engine
This is Rietveld 408576698