| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef WEBKIT_GLUE_WEBURLREQUEST_H_ | 5 #ifndef WEBKIT_GLUE_WEBURLREQUEST_H_ |
| 6 #define WEBKIT_GLUE_WEBURLREQUEST_H_ | 6 #define WEBKIT_GLUE_WEBURLREQUEST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/ref_counted.h" | 11 #include "base/ref_counted.h" |
| 12 | 12 |
| 13 enum WebRequestCachePolicy { | 13 enum WebRequestCachePolicy { |
| 14 WebRequestUseProtocolCachePolicy, | 14 WebRequestUseProtocolCachePolicy, |
| 15 WebRequestReloadIgnoringCacheData, | 15 WebRequestReloadIgnoringCacheData, |
| 16 WebRequestReturnCacheDataElseLoad, | 16 WebRequestReturnCacheDataElseLoad, |
| 17 WebRequestReturnCacheDataDontLoad | 17 WebRequestReturnCacheDataDontLoad |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 namespace net { | 20 namespace net { |
| 21 class UploadData; | 21 class UploadData; |
| 22 } | 22 } |
| 23 | 23 |
| 24 class GURL; | 24 class GURL; |
| 25 | 25 |
| 26 class WebRequest { | 26 class WebRequest { |
| 27 public: | 27 public: |
| 28 typedef std::map<std::string, std::string> HeaderMap; | 28 typedef std::map<std::string, std::string> HeaderMap; |
| 29 | 29 |
| 30 // Extra information that is associated with a request. The embedder derives | |
| 31 // from this REFERENCE COUNTED class to associated data with a request and | |
| 32 // get it back when the page loads. | |
| 33 // | |
| 34 // Note that for reloads (and possibly things like back/forward), there is no | |
| 35 // way to specify the request that it will use, so the extra data pointer | |
| 36 // will be invalid. Users should always check for NULL. | |
| 37 class ExtraData : public base::RefCounted<ExtraData> { | |
| 38 public: | |
| 39 virtual ~ExtraData() {} | |
| 40 }; | |
| 41 | |
| 42 // Creates a WebRequest. | 30 // Creates a WebRequest. |
| 43 static WebRequest* Create(const GURL& url); | 31 static WebRequest* Create(const GURL& url); |
| 44 | 32 |
| 45 // Creates a copy of this WebRequest. | 33 // Creates a copy of this WebRequest. |
| 46 virtual WebRequest* Clone() const = 0; | 34 virtual WebRequest* Clone() const = 0; |
| 47 | 35 |
| 48 // Sets the extra request info that the embedder can retrieve later. This | |
| 49 // will AddRef the ExtraData and store it with the request. | |
| 50 virtual void SetExtraData(ExtraData* extra) = 0; | |
| 51 | |
| 52 // Returns any previously set request info. It does not AddRef, the caller | |
| 53 // is assumed to assign this to a RefPtr. This may return NULL if no extra | |
| 54 // data has been set on this request. Even if the embedder sets request info | |
| 55 // for every request, WebRequests can get created during reload operations | |
| 56 // so callers should not assume the data is always valid. | |
| 57 virtual ExtraData* GetExtraData() const = 0; | |
| 58 | |
| 59 // Get/set the URL. | 36 // Get/set the URL. |
| 60 virtual GURL GetURL() const = 0; | 37 virtual GURL GetURL() const = 0; |
| 61 virtual void SetURL(const GURL& url) = 0; | 38 virtual void SetURL(const GURL& url) = 0; |
| 62 | 39 |
| 63 // Get/set the main document URL, which may be different from the URL for a | 40 // Get/set the main document URL, which may be different from the URL for a |
| 64 // subframe load. | 41 // subframe load. |
| 65 virtual GURL GetMainDocumentURL() const = 0; | 42 virtual GURL GetMainDocumentURL() const = 0; |
| 66 virtual void SetMainDocumentURL(const GURL& url) = 0; | 43 virtual void SetMainDocumentURL(const GURL& url) = 0; |
| 67 | 44 |
| 68 // Get/set the cache policy. | 45 // Get/set the cache policy. |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // Set the request upload data. | 100 // Set the request upload data. |
| 124 virtual void SetUploadData(const net::UploadData& data) = 0; | 101 virtual void SetUploadData(const net::UploadData& data) = 0; |
| 125 | 102 |
| 126 // Sets the requestor id. | 103 // Sets the requestor id. |
| 127 virtual void SetRequestorID(int requestor_id) = 0; | 104 virtual void SetRequestorID(int requestor_id) = 0; |
| 128 | 105 |
| 129 virtual ~WebRequest() { } | 106 virtual ~WebRequest() { } |
| 130 }; | 107 }; |
| 131 | 108 |
| 132 #endif // #ifndef WEBKIT_GLUE_WEBURLREQUEST_H_ | 109 #endif // #ifndef WEBKIT_GLUE_WEBURLREQUEST_H_ |
| OLD | NEW |