summaryrefslogtreecommitdiffstats
path: root/net/url_request/url_request_job.h
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 /net/url_request/url_request_job.h
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 'net/url_request/url_request_job.h')
-rw-r--r--net/url_request/url_request_job.h20
1 files changed, 14 insertions, 6 deletions
diff --git a/net/url_request/url_request_job.h b/net/url_request/url_request_job.h
index aac3768..121519e 100644
--- a/net/url_request/url_request_job.h
+++ b/net/url_request/url_request_job.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/ref_counted.h"
+#include "base/scoped_ptr.h"
#include "net/base/filter.h"
#include "net/base/load_states.h"
@@ -27,7 +28,8 @@ class URLRequestJobMetrics;
// The URLRequestJob is using RefCounterThreadSafe because some sub classes
// can be destroyed on multiple threads. This is the case of the
// UrlRequestFileJob.
-class URLRequestJob : public base::RefCountedThreadSafe<URLRequestJob> {
+class URLRequestJob : public base::RefCountedThreadSafe<URLRequestJob>,
+ public FilterContext {
public:
explicit URLRequestJob(URLRequest* request);
virtual ~URLRequestJob();
@@ -86,11 +88,6 @@ class URLRequestJob : public base::RefCountedThreadSafe<URLRequestJob> {
// Called to get the upload progress in bytes.
virtual uint64 GetUploadProgress() const { return 0; }
- // Called to fetch the mime_type for this request. Only makes sense for some
- // types of requests. Returns true on success. Calling this on a type that
- // doesn't have a mime type will return false.
- virtual bool GetMimeType(std::string* mime_type) { return false; }
-
// Called to fetch the charset for this request. Only makes sense for some
// types of requests. Returns true on success. Calling this on a type that
// doesn't have a charset will return false.
@@ -195,6 +192,14 @@ class URLRequestJob : public base::RefCountedThreadSafe<URLRequestJob> {
// Whether we have processed the response for that request yet.
bool has_response_started() const { return has_handled_response_; }
+ // FilterContext methods:
+ // These methods are not applicable to all connections.
+ virtual bool GetMimeType(std::string* mime_type) const { return false; }
+ virtual bool GetURL(GURL* gurl) const;
+ virtual base::Time GetRequestTime() const;
+ virtual bool IsCachedContent() const;
+ virtual int GetInputStreambufferSize() const { return kFilterBufSize; }
+
protected:
// Notifies the job that headers have been received.
void NotifyHeadersComplete();
@@ -262,6 +267,9 @@ class URLRequestJob : public base::RefCountedThreadSafe<URLRequestJob> {
scoped_ptr<URLRequestJobMetrics> metrics_;
private:
+ // Size of filter input buffers used by this class.
+ static const int kFilterBufSize;
+
// When data filtering is enabled, this function is used to read data
// for the filter. Returns true if raw data was read. Returns false if
// an error occurred (or we are waiting for IO to complete).