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/gtest_prod_util.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
14 #include "base/supports_user_data.h" | 15 #include "base/supports_user_data.h" |
15 #include "content/public/browser/resource_request_info.h" | 16 #include "content/public/browser/resource_request_info.h" |
16 #include "content/public/common/referrer.h" | 17 #include "content/public/common/referrer.h" |
17 #include "net/base/load_states.h" | 18 #include "net/base/load_states.h" |
18 #include "webkit/common/resource_type.h" | 19 #include "webkit/common/resource_type.h" |
19 | 20 |
20 namespace content { | 21 namespace content { |
(...skipping 23 matching lines...) Expand all Loading... |
44 int origin_pid, | 45 int origin_pid, |
45 int request_id, | 46 int request_id, |
46 bool is_main_frame, | 47 bool is_main_frame, |
47 int64 frame_id, | 48 int64 frame_id, |
48 bool parent_is_main_frame, | 49 bool parent_is_main_frame, |
49 int64 parent_frame_id, | 50 int64 parent_frame_id, |
50 ResourceType::Type resource_type, | 51 ResourceType::Type resource_type, |
51 PageTransition transition_type, | 52 PageTransition transition_type, |
52 bool is_download, | 53 bool is_download, |
53 bool is_stream, | 54 bool is_stream, |
| 55 bool is_detachable, |
54 bool allow_download, | 56 bool allow_download, |
55 bool has_user_gesture, | 57 bool has_user_gesture, |
56 WebKit::WebReferrerPolicy referrer_policy, | 58 WebKit::WebReferrerPolicy referrer_policy, |
57 ResourceContext* context, | 59 ResourceContext* context, |
58 base::WeakPtr<ResourceMessageFilter> filter, | 60 base::WeakPtr<ResourceMessageFilter> filter, |
59 bool is_async); | 61 bool is_async); |
60 virtual ~ResourceRequestInfoImpl(); | 62 virtual ~ResourceRequestInfoImpl(); |
61 | 63 |
62 // ResourceRequestInfo implementation: | 64 // ResourceRequestInfo implementation: |
63 virtual ResourceContext* GetContext() const OVERRIDE; | 65 virtual ResourceContext* GetContext() const OVERRIDE; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 bool allow_download() const { return allow_download_; } | 118 bool allow_download() const { return allow_download_; } |
117 | 119 |
118 // Whether this is a download. | 120 // Whether this is a download. |
119 bool is_download() const { return is_download_; } | 121 bool is_download() const { return is_download_; } |
120 void set_is_download(bool download) { is_download_ = download; } | 122 void set_is_download(bool download) { is_download_ = download; } |
121 | 123 |
122 // Whether this is a stream. | 124 // Whether this is a stream. |
123 bool is_stream() const { return is_stream_; } | 125 bool is_stream() const { return is_stream_; } |
124 void set_is_stream(bool stream) { is_stream_ = stream; } | 126 void set_is_stream(bool stream) { is_stream_ = stream; } |
125 | 127 |
| 128 // Whether this is a detachable resource. Detachable resource requests can |
| 129 // live beyond the life of the renderer. |
| 130 bool is_detachable() const { return is_detachable_; } |
| 131 void set_is_detachable(bool is_detachable) { is_detachable_ = is_detachable; } |
| 132 |
| 133 // Detached resources are detachable resources that have ignored a request by |
| 134 // the renderer to cancel and will continue to fetch but stops sending |
| 135 // messages to the renderer. Detached resources eventually timeout. |
| 136 bool is_detached() const { return is_detached_; } |
| 137 void set_detached() { is_detached_ = true; } |
| 138 |
126 void set_was_ignored_by_handler(bool value) { | 139 void set_was_ignored_by_handler(bool value) { |
127 was_ignored_by_handler_ = value; | 140 was_ignored_by_handler_ = value; |
128 } | 141 } |
129 | 142 |
130 // The approximate in-memory size (bytes) that we credited this request | 143 // The approximate in-memory size (bytes) that we credited this request |
131 // as consuming in |outstanding_requests_memory_cost_map_|. | 144 // as consuming in |outstanding_requests_memory_cost_map_|. |
132 int memory_cost() const { return memory_cost_; } | 145 int memory_cost() const { return memory_cost_; } |
133 void set_memory_cost(int cost) { memory_cost_ = cost; } | 146 void set_memory_cost(int cost) { memory_cost_ = cost; } |
134 | 147 |
135 private: | 148 private: |
| 149 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| 150 DeletedFilterDetachable); |
| 151 FRIEND_TEST_ALL_PREFIXES(ResourceDispatcherHostTest, |
| 152 DeletedFilterDetachableRedirect); |
136 // Non-owning, may be NULL. | 153 // Non-owning, may be NULL. |
137 CrossSiteResourceHandler* cross_site_handler_; | 154 CrossSiteResourceHandler* cross_site_handler_; |
138 | 155 |
139 int process_type_; | 156 int process_type_; |
140 int child_id_; | 157 int child_id_; |
141 int route_id_; | 158 int route_id_; |
142 int origin_pid_; | 159 int origin_pid_; |
143 int request_id_; | 160 int request_id_; |
144 bool is_main_frame_; | 161 bool is_main_frame_; |
145 int64 frame_id_; | 162 int64 frame_id_; |
146 bool parent_is_main_frame_; | 163 bool parent_is_main_frame_; |
147 int64 parent_frame_id_; | 164 int64 parent_frame_id_; |
148 bool is_download_; | 165 bool is_download_; |
149 bool is_stream_; | 166 bool is_stream_; |
| 167 bool is_detachable_; |
| 168 bool is_detached_; |
150 bool allow_download_; | 169 bool allow_download_; |
151 bool has_user_gesture_; | 170 bool has_user_gesture_; |
152 bool was_ignored_by_handler_; | 171 bool was_ignored_by_handler_; |
153 ResourceType::Type resource_type_; | 172 ResourceType::Type resource_type_; |
154 PageTransition transition_type_; | 173 PageTransition transition_type_; |
155 int memory_cost_; | 174 int memory_cost_; |
156 WebKit::WebReferrerPolicy referrer_policy_; | 175 WebKit::WebReferrerPolicy referrer_policy_; |
157 ResourceContext* context_; | 176 ResourceContext* context_; |
158 // The filter might be deleted without deleting this object if the process | 177 // The filter might be deleted without deleting this object if the process |
159 // exits during a transfer. | 178 // exits during a transfer. |
160 base::WeakPtr<ResourceMessageFilter> filter_; | 179 base::WeakPtr<ResourceMessageFilter> filter_; |
161 bool is_async_; | 180 bool is_async_; |
162 | 181 |
163 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl); | 182 DISALLOW_COPY_AND_ASSIGN(ResourceRequestInfoImpl); |
164 }; | 183 }; |
165 | 184 |
166 } // namespace content | 185 } // namespace content |
167 | 186 |
168 #endif // CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ | 187 #endif // CONTENT_BROWSER_LOADER_RESOURCE_REQUEST_INFO_IMPL_H_ |
OLD | NEW |