| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ |
| 6 #define CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ | 6 #define CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/supports_user_data.h" | 13 #include "base/supports_user_data.h" |
| 14 #include "content/public/browser/resource_request_info.h" | 14 #include "content/public/browser/resource_request_info.h" |
| 15 #include "content/public/common/process_type.h" | |
| 16 #include "content/public/common/referrer.h" | 15 #include "content/public/common/referrer.h" |
| 17 #include "net/base/load_states.h" | 16 #include "net/base/load_states.h" |
| 18 #include "webkit/glue/resource_type.h" | 17 #include "webkit/glue/resource_type.h" |
| 19 | 18 |
| 20 namespace webkit_blob { | 19 namespace webkit_blob { |
| 21 class BlobData; | 20 class BlobData; |
| 22 } | 21 } |
| 23 | 22 |
| 24 namespace content { | 23 namespace content { |
| 25 class CrossSiteResourceHandler; | 24 class CrossSiteResourceHandler; |
| 26 class ResourceContext; | 25 class ResourceContext; |
| 27 struct GlobalRequestID; | 26 struct GlobalRequestID; |
| 28 | 27 |
| 29 // Holds the data ResourceDispatcherHost associates with each request. | 28 // Holds the data ResourceDispatcherHost associates with each request. |
| 30 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest. | 29 // Retrieve this data by calling ResourceDispatcherHost::InfoForRequest. |
| 31 class ResourceRequestInfoImpl : public ResourceRequestInfo, | 30 class ResourceRequestInfoImpl : public ResourceRequestInfo, |
| 32 public base::SupportsUserData::Data { | 31 public base::SupportsUserData::Data { |
| 33 public: | 32 public: |
| 34 // Returns the ResourceRequestInfoImpl associated with the given URLRequest. | 33 // Returns the ResourceRequestInfoImpl associated with the given URLRequest. |
| 35 CONTENT_EXPORT static ResourceRequestInfoImpl* ForRequest( | 34 CONTENT_EXPORT static ResourceRequestInfoImpl* ForRequest( |
| 36 net::URLRequest* request); | 35 net::URLRequest* request); |
| 37 | 36 |
| 38 // And, a const version for cases where you only need read access. | 37 // And, a const version for cases where you only need read access. |
| 39 static const ResourceRequestInfoImpl* ForRequest( | 38 static const ResourceRequestInfoImpl* ForRequest( |
| 40 const net::URLRequest* request); | 39 const net::URLRequest* request); |
| 41 | 40 |
| 42 CONTENT_EXPORT ResourceRequestInfoImpl( | 41 CONTENT_EXPORT ResourceRequestInfoImpl( |
| 43 ProcessType process_type, | 42 int process_type, |
| 44 int child_id, | 43 int child_id, |
| 45 int route_id, | 44 int route_id, |
| 46 int origin_pid, | 45 int origin_pid, |
| 47 int request_id, | 46 int request_id, |
| 48 bool is_main_frame, | 47 bool is_main_frame, |
| 49 int64 frame_id, | 48 int64 frame_id, |
| 50 bool parent_is_main_frame, | 49 bool parent_is_main_frame, |
| 51 int64 parent_frame_id, | 50 int64 parent_frame_id, |
| 52 ResourceType::Type resource_type, | 51 ResourceType::Type resource_type, |
| 53 PageTransition transition_type, | 52 PageTransition transition_type, |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 85 |
| 87 // CrossSiteResourceHandler for this request. May be null. | 86 // CrossSiteResourceHandler for this request. May be null. |
| 88 CrossSiteResourceHandler* cross_site_handler() { | 87 CrossSiteResourceHandler* cross_site_handler() { |
| 89 return cross_site_handler_; | 88 return cross_site_handler_; |
| 90 } | 89 } |
| 91 void set_cross_site_handler(CrossSiteResourceHandler* h) { | 90 void set_cross_site_handler(CrossSiteResourceHandler* h) { |
| 92 cross_site_handler_ = h; | 91 cross_site_handler_ = h; |
| 93 } | 92 } |
| 94 | 93 |
| 95 // Identifies the type of process (renderer, plugin, etc.) making the request. | 94 // Identifies the type of process (renderer, plugin, etc.) making the request. |
| 96 ProcessType process_type() const { | 95 int process_type() const { return process_type_; } |
| 97 return process_type_; | |
| 98 } | |
| 99 | 96 |
| 100 // Downloads are allowed only as a top level request. | 97 // Downloads are allowed only as a top level request. |
| 101 bool allow_download() const { return allow_download_; } | 98 bool allow_download() const { return allow_download_; } |
| 102 | 99 |
| 103 // Whether this is a download. | 100 // Whether this is a download. |
| 104 bool is_download() const { return is_download_; } | 101 bool is_download() const { return is_download_; } |
| 105 void set_is_download(bool download) { is_download_ = download; } | 102 void set_is_download(bool download) { is_download_ = download; } |
| 106 | 103 |
| 107 // Whether this is a stream. | 104 // Whether this is a stream. |
| 108 bool is_stream() const { return is_stream_; } | 105 bool is_stream() const { return is_stream_; } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 121 // get finally released prior to the net::URLRequestJob being started. | 118 // get finally released prior to the net::URLRequestJob being started. |
| 122 webkit_blob::BlobData* requested_blob_data() const { | 119 webkit_blob::BlobData* requested_blob_data() const { |
| 123 return requested_blob_data_.get(); | 120 return requested_blob_data_.get(); |
| 124 } | 121 } |
| 125 void set_requested_blob_data(webkit_blob::BlobData* data); | 122 void set_requested_blob_data(webkit_blob::BlobData* data); |
| 126 | 123 |
| 127 private: | 124 private: |
| 128 // Non-owning, may be NULL. | 125 // Non-owning, may be NULL. |
| 129 CrossSiteResourceHandler* cross_site_handler_; | 126 CrossSiteResourceHandler* cross_site_handler_; |
| 130 | 127 |
| 131 ProcessType process_type_; | 128 int process_type_; |
| 132 int child_id_; | 129 int child_id_; |
| 133 int route_id_; | 130 int route_id_; |
| 134 int origin_pid_; | 131 int origin_pid_; |
| 135 int request_id_; | 132 int request_id_; |
| 136 bool is_main_frame_; | 133 bool is_main_frame_; |
| 137 int64 frame_id_; | 134 int64 frame_id_; |
| 138 bool parent_is_main_frame_; | 135 bool parent_is_main_frame_; |
| 139 int64 parent_frame_id_; | 136 int64 parent_frame_id_; |
| 140 bool is_download_; | 137 bool is_download_; |
| 141 bool is_stream_; | 138 bool is_stream_; |
| 142 bool allow_download_; | 139 bool allow_download_; |
| 143 bool has_user_gesture_; | 140 bool has_user_gesture_; |
| 144 bool was_ignored_by_handler_; | 141 bool was_ignored_by_handler_; |
| 145 ResourceType::Type resource_type_; | 142 ResourceType::Type resource_type_; |
| 146 PageTransition transition_type_; | 143 PageTransition transition_type_; |
| 147 int memory_cost_; | 144 int memory_cost_; |
| 148 scoped_refptr<webkit_blob::BlobData> requested_blob_data_; | 145 scoped_refptr<webkit_blob::BlobData> requested_blob_data_; |
| 149 WebKit::WebReferrerPolicy referrer_policy_; | 146 WebKit::WebReferrerPolicy referrer_policy_; |
| 150 ResourceContext* context_; | 147 ResourceContext* context_; |
| 151 bool is_async_; | 148 bool is_async_; |
| 152 | 149 |
| 153 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl); | 150 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl); |
| 154 }; | 151 }; |
| 155 | 152 |
| 156 } // namespace content | 153 } // namespace content |
| 157 | 154 |
| 158 #endif // CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ | 155 #endif // CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ |
| OLD | NEW |