summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 16:53:31 +0000
committerjar@chromium.org <jar@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-09 16:53:31 +0000
commit60c413c96834553e182e8c9c34d1e8958f3b0fb5 (patch)
treedb8e37e57691ad25bd737895a5ec487e47107960 /chrome
parentdedf2055a80cf9d869767bbd0c99f51e4f31260e (diff)
downloadchromium_src-60c413c96834553e182e8c9c34d1e8958f3b0fb5.zip
chromium_src-60c413c96834553e182e8c9c34d1e8958f3b0fb5.tar.gz
chromium_src-60c413c96834553e182e8c9c34d1e8958f3b0fb5.tar.bz2
Use FilterContext to allow filters to access URLRequestJob data
r=wtc,darin,huanr Review URL: http://codereview.chromium.org/40138 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11248 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/automation/url_request_mock_http_job.cc11
-rw-r--r--chrome/browser/automation/url_request_mock_http_job.h6
-rw-r--r--chrome/browser/automation/url_request_slow_download_job.cc11
-rw-r--r--chrome/browser/automation/url_request_slow_download_job.h7
-rw-r--r--chrome/browser/dom_ui/chrome_url_data_manager.cc4
-rw-r--r--chrome/common/net/url_request_intercept_job.cc2
-rw-r--r--chrome/common/net/url_request_intercept_job.h5
7 files changed, 35 insertions, 11 deletions
diff --git a/chrome/browser/automation/url_request_mock_http_job.cc b/chrome/browser/automation/url_request_mock_http_job.cc
index 9c0376f..9220ba7 100644
--- a/chrome/browser/automation/url_request_mock_http_job.cc
+++ b/chrome/browser/automation/url_request_mock_http_job.cc
@@ -61,7 +61,14 @@ URLRequestMockHTTPJob::URLRequestMockHTTPJob(URLRequest* request,
const FilePath& file_path)
: URLRequestFileJob(request, file_path) { }
+// Public virtual version.
void URLRequestMockHTTPJob::GetResponseInfo(net::HttpResponseInfo* info) {
+ // Forward to private const version.
+ GetResponseInfoConst(info);
+}
+
+// Private const version.
+void URLRequestMockHTTPJob::GetResponseInfoConst(net::HttpResponseInfo* info) const {
std::wstring header_file = file_path_.ToWStringHack() + kMockHeaderFileSuffix;
std::string raw_headers;
if (!file_util::ReadFileToString(header_file, &raw_headers))
@@ -72,9 +79,9 @@ void URLRequestMockHTTPJob::GetResponseInfo(net::HttpResponseInfo* info) {
info->headers = new net::HttpResponseHeaders(raw_headers);
}
-bool URLRequestMockHTTPJob::GetMimeType(std::string* mime_type) {
+bool URLRequestMockHTTPJob::GetMimeType(std::string* mime_type) const {
net::HttpResponseInfo info;
- GetResponseInfo(&info);
+ GetResponseInfoConst(&info);
return info.headers && info.headers->GetMimeType(mime_type);
}
diff --git a/chrome/browser/automation/url_request_mock_http_job.h b/chrome/browser/automation/url_request_mock_http_job.h
index 2772f1b..d344e7b 100644
--- a/chrome/browser/automation/url_request_mock_http_job.h
+++ b/chrome/browser/automation/url_request_mock_http_job.h
@@ -7,6 +7,8 @@
#ifndef CHROME_BROWSER_AUTOMATION_URL_REQUEST_MOCK_HTTP_JOB_H__
#define CHROME_BROWSER_AUTOMATION_URL_REQUEST_MOCK_HTTP_JOB_H__
+#include <string>
+
#include "net/url_request/url_request_file_job.h"
class URLRequestMockHTTPJob : public URLRequestFileJob {
@@ -14,7 +16,7 @@ class URLRequestMockHTTPJob : public URLRequestFileJob {
URLRequestMockHTTPJob(URLRequest* request, const FilePath& file_path);
virtual ~URLRequestMockHTTPJob() { }
- virtual bool GetMimeType(std::string* mime_type);
+ virtual bool GetMimeType(std::string* mime_type) const;
virtual bool GetCharset(std::string* charset);
virtual void GetResponseInfo(net::HttpResponseInfo* info);
@@ -27,6 +29,8 @@ class URLRequestMockHTTPJob : public URLRequestFileJob {
static GURL GetMockUrl(const std::wstring& path);
private:
+ void GetResponseInfoConst(net::HttpResponseInfo* info) const;
+
// This is the file path leading to the root of the directory to use as the
// root of the http server.
static std::wstring base_path_;
diff --git a/chrome/browser/automation/url_request_slow_download_job.cc b/chrome/browser/automation/url_request_slow_download_job.cc
index e185204..7b4f6cb 100644
--- a/chrome/browser/automation/url_request_slow_download_job.cc
+++ b/chrome/browser/automation/url_request_slow_download_job.cc
@@ -131,7 +131,14 @@ void URLRequestSlowDownloadJob::CheckDoneStatus() {
}
}
+// Public virtual version.
void URLRequestSlowDownloadJob::GetResponseInfo(net::HttpResponseInfo* info) {
+ // Forward to private const version.
+ GetResponseInfoConst(info);
+}
+
+// Private const version.
+void URLRequestSlowDownloadJob::GetResponseInfoConst(net::HttpResponseInfo* info) const {
// Send back mock headers.
std::string raw_headers;
if (LowerCaseEqualsASCII(kFinishDownloadUrl,
@@ -156,9 +163,9 @@ void URLRequestSlowDownloadJob::GetResponseInfo(net::HttpResponseInfo* info) {
info->headers = new net::HttpResponseHeaders(raw_headers);
}
-bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) {
+bool URLRequestSlowDownloadJob::GetMimeType(std::string* mime_type) const {
net::HttpResponseInfo info;
- GetResponseInfo(&info);
+ GetResponseInfoConst(&info);
return info.headers && info.headers->GetMimeType(mime_type);
}
diff --git a/chrome/browser/automation/url_request_slow_download_job.h b/chrome/browser/automation/url_request_slow_download_job.h
index 847121e..58c1749 100644
--- a/chrome/browser/automation/url_request_slow_download_job.h
+++ b/chrome/browser/automation/url_request_slow_download_job.h
@@ -8,13 +8,14 @@
#ifndef CHROME_BROWSER_AUTOMATION_URL_REQUEST_SLOW_DOWNLOAD_JOB_H__
#define CHROME_BROWSER_AUTOMATION_URL_REQUEST_SLOW_DOWNLOAD_JOB_H__
+#include <string>
#include <vector>
#include "net/url_request/url_request_job.h"
class URLRequestSlowDownloadJob : public URLRequestJob {
public:
- URLRequestSlowDownloadJob(URLRequest* request);
+ explicit URLRequestSlowDownloadJob(URLRequest* request);
virtual ~URLRequestSlowDownloadJob() { }
// Timer callback, used to check to see if we should finish our download and
@@ -23,7 +24,7 @@ class URLRequestSlowDownloadJob : public URLRequestJob {
// URLRequestJob methods
virtual void Start();
- virtual bool GetMimeType(std::string* mime_type);
+ virtual bool GetMimeType(std::string* mime_type) const;
virtual void GetResponseInfo(net::HttpResponseInfo* info);
virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read);
@@ -39,6 +40,8 @@ class URLRequestSlowDownloadJob : public URLRequestJob {
static void AddUITestUrls();
private:
+ void GetResponseInfoConst(net::HttpResponseInfo* info) const;
+
// Mark all pending requests to be finished. We keep track of pending
// requests in |kPendingRequests|.
static void FinishPendingRequests();
diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc
index d0e4193..a75af74 100644
--- a/chrome/browser/dom_ui/chrome_url_data_manager.cc
+++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc
@@ -44,7 +44,7 @@ class URLRequestChromeJob : public URLRequestJob {
virtual void Start();
virtual void Kill();
virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read);
- virtual bool GetMimeType(std::string* mime_type);
+ virtual bool GetMimeType(std::string* mime_type) const;
// Called by ChromeURLDataManager to notify us that the data blob is ready
// for us.
@@ -287,7 +287,7 @@ void URLRequestChromeJob::Kill() {
chrome_url_data_manager.RemoveRequest(this);
}
-bool URLRequestChromeJob::GetMimeType(std::string* mime_type) {
+bool URLRequestChromeJob::GetMimeType(std::string* mime_type) const {
*mime_type = mime_type_;
return !mime_type_.empty();
}
diff --git a/chrome/common/net/url_request_intercept_job.cc b/chrome/common/net/url_request_intercept_job.cc
index 81d1a78..733967e 100644
--- a/chrome/common/net/url_request_intercept_job.cc
+++ b/chrome/common/net/url_request_intercept_job.cc
@@ -96,7 +96,7 @@ bool URLRequestInterceptJob::ReadRawData(net::IOBuffer* dest, int dest_size,
return false;
}
-bool URLRequestInterceptJob::GetMimeType(std::string* mime_type) {
+bool URLRequestInterceptJob::GetMimeType(std::string* mime_type) const {
return request_->response_headers()->GetMimeType(mime_type);
}
diff --git a/chrome/common/net/url_request_intercept_job.h b/chrome/common/net/url_request_intercept_job.h
index bc422af..06a9cdd 100644
--- a/chrome/common/net/url_request_intercept_job.h
+++ b/chrome/common/net/url_request_intercept_job.h
@@ -5,6 +5,9 @@
#ifndef CHROME_COMMON_NET_URL_REQUEST_INTERCEPT_JOB_H_
#define CHROME_COMMON_NET_URL_REQUEST_INTERCEPT_JOB_H_
+#include <string>
+
+#include "base/scoped_ptr.h"
#include "net/url_request/url_request_job.h"
#include "chrome/browser/chrome_plugin_host.h"
#include "chrome/common/chrome_plugin_api.h"
@@ -34,7 +37,7 @@ class URLRequestInterceptJob
virtual void Start();
virtual void Kill();
virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int* bytes_read);
- virtual bool GetMimeType(std::string* mime_type);
+ virtual bool GetMimeType(std::string* mime_type) const;
virtual bool GetCharset(std::string* charset);
virtual void GetResponseInfo(net::HttpResponseInfo* info);
virtual int GetResponseCode();