| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H_ |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "content/common/child_process_info.h" | 13 #include "content/common/child_process_info.h" |
| 14 #include "net/base/load_states.h" | 14 #include "net/base/load_states.h" |
| 15 #include "net/url_request/url_request.h" | 15 #include "net/url_request/url_request.h" |
| 16 #include "webkit/glue/resource_type.h" | 16 #include "webkit/glue/resource_type.h" |
| 17 | 17 |
| 18 class CrossSiteResourceHandler; | 18 class CrossSiteResourceHandler; |
| 19 class LoginHandler; | 19 class LoginHandler; |
| 20 class ResourceDispatcherHost; | 20 class ResourceDispatcherHost; |
| 21 class ResourceHandler; | 21 class ResourceHandler; |
| 22 class SSLClientAuthHandler; | 22 class SSLClientAuthHandler; |
| 23 | 23 |
| 24 namespace content { |
| 25 class ResourceContext; |
| 26 } |
| 27 |
| 24 namespace webkit_blob { | 28 namespace webkit_blob { |
| 25 class BlobData; | 29 class BlobData; |
| 26 } | 30 } |
| 27 | 31 |
| 28 // Holds the data ResourceDispatcherHost associates with each request. | 32 // Holds the data ResourceDispatcherHost associates with each request. |
| 29 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest. | 33 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest. |
| 30 class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData { | 34 class ResourceDispatcherHostRequestInfo : public net::URLRequest::UserData { |
| 31 public: | 35 public: |
| 32 // This will take a reference to the handler. | 36 // This will take a reference to the handler. |
| 33 ResourceDispatcherHostRequestInfo( | 37 ResourceDispatcherHostRequestInfo( |
| 34 ResourceHandler* handler, | 38 ResourceHandler* handler, |
| 35 ChildProcessInfo::ProcessType process_type, | 39 ChildProcessInfo::ProcessType process_type, |
| 36 int child_id, | 40 int child_id, |
| 37 int route_id, | 41 int route_id, |
| 38 int request_id, | 42 int request_id, |
| 39 ResourceType::Type resource_type, | 43 ResourceType::Type resource_type, |
| 40 uint64 upload_size, | 44 uint64 upload_size, |
| 41 bool is_download, | 45 bool is_download, |
| 42 bool allow_download, | 46 bool allow_download, |
| 43 bool has_user_gesture); | 47 bool has_user_gesture, |
| 48 const content::ResourceContext* context); |
| 44 virtual ~ResourceDispatcherHostRequestInfo(); | 49 virtual ~ResourceDispatcherHostRequestInfo(); |
| 45 | 50 |
| 46 // Top-level ResourceHandler servicing this request. | 51 // Top-level ResourceHandler servicing this request. |
| 47 ResourceHandler* resource_handler() { return resource_handler_.get(); } | 52 ResourceHandler* resource_handler() { return resource_handler_.get(); } |
| 48 | 53 |
| 49 // CrossSiteResourceHandler for this request, if it is a cross-site request. | 54 // CrossSiteResourceHandler for this request, if it is a cross-site request. |
| 50 // (NULL otherwise.) This handler is part of the chain of ResourceHandlers | 55 // (NULL otherwise.) This handler is part of the chain of ResourceHandlers |
| 51 // pointed to by resource_handler, and is not owned by this class. | 56 // pointed to by resource_handler, and is not owned by this class. |
| 52 CrossSiteResourceHandler* cross_site_handler() { | 57 CrossSiteResourceHandler* cross_site_handler() { |
| 53 return cross_site_handler_; | 58 return cross_site_handler_; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 int memory_cost() const { return memory_cost_; } | 148 int memory_cost() const { return memory_cost_; } |
| 144 void set_memory_cost(int cost) { memory_cost_ = cost; } | 149 void set_memory_cost(int cost) { memory_cost_ = cost; } |
| 145 | 150 |
| 146 // We hold a reference to the requested blob data to ensure it doesn't | 151 // We hold a reference to the requested blob data to ensure it doesn't |
| 147 // get finally released prior to the net::URLRequestJob being started. | 152 // get finally released prior to the net::URLRequestJob being started. |
| 148 webkit_blob::BlobData* requested_blob_data() const { | 153 webkit_blob::BlobData* requested_blob_data() const { |
| 149 return requested_blob_data_.get(); | 154 return requested_blob_data_.get(); |
| 150 } | 155 } |
| 151 void set_requested_blob_data(webkit_blob::BlobData* data); | 156 void set_requested_blob_data(webkit_blob::BlobData* data); |
| 152 | 157 |
| 158 const content::ResourceContext* context() const { return context_; } |
| 159 |
| 153 private: | 160 private: |
| 154 friend class ResourceDispatcherHost; | 161 friend class ResourceDispatcherHost; |
| 155 | 162 |
| 156 // Request is temporarily not handling network data. Should be used only | 163 // Request is temporarily not handling network data. Should be used only |
| 157 // by the ResourceDispatcherHost, not the event handlers (accessors are | 164 // by the ResourceDispatcherHost, not the event handlers (accessors are |
| 158 // provided for consistency with the rest of the interface). | 165 // provided for consistency with the rest of the interface). |
| 159 bool is_paused() const { return is_paused_; } | 166 bool is_paused() const { return is_paused_; } |
| 160 void set_is_paused(bool paused) { is_paused_ = paused; } | 167 void set_is_paused(bool paused) { is_paused_ = paused; } |
| 161 | 168 |
| 162 // Whether we called OnResponseStarted for this request or not. Should be used | 169 // Whether we called OnResponseStarted for this request or not. Should be used |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 bool has_user_gesture_; | 203 bool has_user_gesture_; |
| 197 int pause_count_; | 204 int pause_count_; |
| 198 ResourceType::Type resource_type_; | 205 ResourceType::Type resource_type_; |
| 199 net::LoadState last_load_state_; | 206 net::LoadState last_load_state_; |
| 200 uint64 upload_size_; | 207 uint64 upload_size_; |
| 201 uint64 last_upload_position_; | 208 uint64 last_upload_position_; |
| 202 base::TimeTicks last_upload_ticks_; | 209 base::TimeTicks last_upload_ticks_; |
| 203 bool waiting_for_upload_progress_ack_; | 210 bool waiting_for_upload_progress_ack_; |
| 204 int memory_cost_; | 211 int memory_cost_; |
| 205 scoped_refptr<webkit_blob::BlobData> requested_blob_data_; | 212 scoped_refptr<webkit_blob::BlobData> requested_blob_data_; |
| 213 const content::ResourceContext* context_; |
| 206 | 214 |
| 207 // "Private" data accessible only to ResourceDispatcherHost (use the | 215 // "Private" data accessible only to ResourceDispatcherHost (use the |
| 208 // accessors above for consistency). | 216 // accessors above for consistency). |
| 209 bool is_paused_; | 217 bool is_paused_; |
| 210 bool called_on_response_started_; | 218 bool called_on_response_started_; |
| 211 bool has_started_reading_; | 219 bool has_started_reading_; |
| 212 int paused_read_bytes_; | 220 int paused_read_bytes_; |
| 213 | 221 |
| 214 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostRequestInfo); | 222 DISALLOW_COPY_AND_ASSIGN(ResourceDispatcherHostRequestInfo); |
| 215 }; | 223 }; |
| 216 | 224 |
| 217 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H
_ | 225 #endif // CONTENT_BROWSER_RENDERER_HOST_RESOURCE_DISPATCHER_HOST_REQUEST_INFO_H
_ |
| OLD | NEW |