summaryrefslogtreecommitdiffstats
path: root/chrome/browser/chromeos/gview_request_interceptor.cc
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-26 09:42:40 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-26 09:42:40 +0000
commitbbf8210732634d7869038db6dc1f98aea8b51ba8 (patch)
tree2dfcd4dd83cff2cd481bfca665d47dfb44f8ccb7 /chrome/browser/chromeos/gview_request_interceptor.cc
parent82616d315d614a2774f3b1b7cc5c19360ddb5ca7 (diff)
downloadchromium_src-bbf8210732634d7869038db6dc1f98aea8b51ba8.zip
chromium_src-bbf8210732634d7869038db6dc1f98aea8b51ba8.tar.gz
chromium_src-bbf8210732634d7869038db6dc1f98aea8b51ba8.tar.bz2
Remove ProtocolFactory/Interceptor uses in GViewRequestInterceptor.
Gets rid of more use of net/ globals, replacing with URLRequestJobFactory uses. Helps make net/ more thread-compatible. BUG=81979 TEST=none Review URL: http://codereview.chromium.org/7019030 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86802 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/gview_request_interceptor.cc')
-rw-r--r--chrome/browser/chromeos/gview_request_interceptor.cc28
1 files changed, 13 insertions, 15 deletions
diff --git a/chrome/browser/chromeos/gview_request_interceptor.cc b/chrome/browser/chromeos/gview_request_interceptor.cc
index 7f23708..fe98c15 100644
--- a/chrome/browser/chromeos/gview_request_interceptor.cc
+++ b/chrome/browser/chromeos/gview_request_interceptor.cc
@@ -5,14 +5,12 @@
#include "chrome/browser/chromeos/gview_request_interceptor.h"
#include "base/file_path.h"
-#include "base/memory/singleton.h"
#include "base/path_service.h"
#include "chrome/common/chrome_paths.h"
#include "googleurl/src/gurl.h"
#include "net/base/escape.h"
#include "net/base/load_flags.h"
#include "net/url_request/url_request.h"
-#include "net/url_request/url_request_job.h"
#include "net/url_request/url_request_redirect_job.h"
#include "webkit/glue/plugins/plugin_list.h"
@@ -21,37 +19,41 @@ namespace chromeos {
// The PDF mime type is treated special if the browser has a built-in
// PDF viewer plug-in installed - we want to intercept only if we're
// told to.
-static const char* const kPdfMimeType = "application/pdf";
+static const char kPdfMimeType[] = "application/pdf";
// This is the list of mime types currently supported by the Google
// Document Viewer.
-static const char* const supported_mime_type_list[] = {
+static const char* const kSupportedMimeTypeList[] = {
kPdfMimeType,
"application/vnd.ms-powerpoint"
};
-static const char* const kGViewUrlPrefix = "http://docs.google.com/gview?url=";
+static const char kGViewUrlPrefix[] = "http://docs.google.com/gview?url=";
GViewRequestInterceptor::GViewRequestInterceptor() {
- net::URLRequest::RegisterRequestInterceptor(this);
- for (size_t i = 0; i < arraysize(supported_mime_type_list); ++i) {
- supported_mime_types_.insert(supported_mime_type_list[i]);
+ for (size_t i = 0; i < arraysize(kSupportedMimeTypeList); ++i) {
+ supported_mime_types_.insert(kSupportedMimeTypeList[i]);
}
}
GViewRequestInterceptor::~GViewRequestInterceptor() {
- net::URLRequest::UnregisterRequestInterceptor(this);
}
net::URLRequestJob* GViewRequestInterceptor::MaybeIntercept(
- net::URLRequest* request) {
+ net::URLRequest* request) const {
// Don't attempt to intercept here as we want to wait until the mime
// type is fully determined.
return NULL;
}
+net::URLRequestJob* GViewRequestInterceptor::MaybeInterceptRedirect(
+ const GURL& location,
+ net::URLRequest* request) const {
+ return NULL;
+}
+
net::URLRequestJob* GViewRequestInterceptor::MaybeInterceptResponse(
- net::URLRequest* request) {
+ net::URLRequest* request) const {
// Do not intercept this request if it is a download.
if (request->load_flags() & net::LOAD_IS_DOWNLOAD) {
return NULL;
@@ -81,8 +83,4 @@ net::URLRequestJob* GViewRequestInterceptor::MaybeInterceptResponse(
return NULL;
}
-GViewRequestInterceptor* GViewRequestInterceptor::GetInstance() {
- return Singleton<GViewRequestInterceptor>::get();
-}
-
} // namespace chromeos