summaryrefslogtreecommitdiffstats
path: root/net/url_request/url_request_http_job.h
diff options
context:
space:
mode:
authordarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-30 17:28:04 +0000
committerdarin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-30 17:28:04 +0000
commit175adac8a07694271f7a19d1b6204bb473b41b35 (patch)
tree462341ce097055bfa045c2b99bee8b6adb7f8c7e /net/url_request/url_request_http_job.h
parentc4319fff25090b1c7315fb25a85be57c3d40378b (diff)
downloadchromium_src-175adac8a07694271f7a19d1b6204bb473b41b35.zip
chromium_src-175adac8a07694271f7a19d1b6204bb473b41b35.tar.gz
chromium_src-175adac8a07694271f7a19d1b6204bb473b41b35.tar.bz2
Rename URLRequestHttpCacheJob to URLRequestHttpJob.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request/url_request_http_job.h')
-rw-r--r--net/url_request/url_request_http_job.h112
1 files changed, 112 insertions, 0 deletions
diff --git a/net/url_request/url_request_http_job.h b/net/url_request/url_request_http_job.h
new file mode 100644
index 0000000..e046886
--- /dev/null
+++ b/net/url_request/url_request_http_job.h
@@ -0,0 +1,112 @@
+// Copyright 2008, Google Inc.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+#ifndef NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H__
+#define NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H__
+
+#include "net/base/completion_callback.h"
+#include "net/http/http_request_info.h"
+#include "net/url_request/url_request_job.h"
+
+namespace net {
+class HttpResponseInfo;
+class HttpTransaction;
+}
+class URLRequestContext;
+
+// A URLRequestJob subclass that is built on top of HttpTransaction. It
+// provides an implementation for both HTTP and HTTPS.
+class URLRequestHttpJob : public URLRequestJob {
+ public:
+ static URLRequestJob* Factory(URLRequest* request, const std::string& scheme);
+
+ virtual ~URLRequestHttpJob();
+
+ protected:
+ URLRequestHttpJob(URLRequest* request);
+
+ // URLRequestJob methods:
+ virtual void SetUpload(net::UploadData* upload);
+ virtual void SetExtraRequestHeaders(const std::string& headers);
+ virtual void Start();
+ virtual void Kill();
+ virtual net::LoadState GetLoadState() const;
+ virtual uint64 GetUploadProgress() const;
+ virtual bool GetMimeType(std::string* mime_type);
+ virtual bool GetCharset(std::string* charset);
+ virtual void GetResponseInfo(net::HttpResponseInfo* info);
+ virtual bool GetResponseCookies(std::vector<std::string>* cookies);
+ virtual int GetResponseCode();
+ virtual bool GetContentEncoding(std::string* encoding_type);
+ virtual bool IsRedirectResponse(GURL* location, int* http_status_code);
+ virtual bool IsSafeRedirect(const GURL& location);
+ virtual bool NeedsAuth();
+ virtual void GetAuthChallengeInfo(scoped_refptr<net::AuthChallengeInfo>*);
+ virtual void GetCachedAuthData(const net::AuthChallengeInfo& auth_info,
+ scoped_refptr<net::AuthData>* auth_data);
+ virtual void SetAuth(const std::wstring& username,
+ const std::wstring& password);
+ virtual void CancelAuth();
+ virtual void ContinueDespiteLastError();
+ virtual bool GetMoreData();
+ virtual bool ReadRawData(char* buf, int buf_size, int *bytes_read);
+
+ // Shadows URLRequestJob's version of this method so we can grab cookies.
+ void NotifyHeadersComplete();
+
+ void DestroyTransaction();
+ void StartTransaction();
+ void AddExtraHeaders();
+ void FetchResponseCookies();
+
+ void OnStartCompleted(int result);
+ void OnReadCompleted(int result);
+
+ net::HttpRequestInfo request_info_;
+ net::HttpTransaction* transaction_;
+ const net::HttpResponseInfo* response_info_;
+ std::vector<std::string> response_cookies_;
+
+ // Auth states for proxy and origin server.
+ net::AuthState proxy_auth_state_;
+ net::AuthState server_auth_state_;
+
+ net::CompletionCallbackImpl<URLRequestHttpJob> start_callback_;
+ net::CompletionCallbackImpl<URLRequestHttpJob> read_callback_;
+
+ bool read_in_progress_;
+
+ // Keep a reference to the url request context to be sure it's not
+ // deleted before us.
+ scoped_refptr<URLRequestContext> context_;
+
+ DISALLOW_EVIL_CONSTRUCTORS(URLRequestHttpJob);
+};
+
+#endif // NET_URL_REQUEST_URL_REQUEST_HTTP_JOB_H__