Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(580)

Side by Side Diff: webkit/glue/resource_loader_bridge.h

Issue 3053009: Pepper stream-to-file plumbing.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/glue/plugins/pepper_url_response_info.cc ('k') | webkit/glue/resource_loader_bridge.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // The intent of this file is to provide a type-neutral abstraction between 5 // The intent of this file is to provide a type-neutral abstraction between
6 // Chrome and WebKit for resource loading. This pure-virtual interface is 6 // Chrome and WebKit for resource loading. This pure-virtual interface is
7 // implemented by the embedder, which also provides a factory method Create 7 // implemented by the embedder, which also provides a factory method Create
8 // to instantiate this object. 8 // to instantiate this object.
9 // 9 //
10 // One of these objects will be created by WebKit for each request. WebKit 10 // One of these objects will be created by WebKit for each request. WebKit
11 // will own the pointer to the bridge, and will delete it when the request is 11 // will own the pointer to the bridge, and will delete it when the request is
12 // no longer needed. 12 // no longer needed.
13 // 13 //
14 // In turn, the bridge's owner on the WebKit end will implement the Peer 14 // In turn, the bridge's owner on the WebKit end will implement the Peer
15 // interface, which we will use to communicate notifications back. 15 // interface, which we will use to communicate notifications back.
16 16
17 #ifndef WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ 17 #ifndef WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_
18 #define WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ 18 #define WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_
19 19
20 #include "build/build_config.h" 20 #include "build/build_config.h"
21 #if defined(OS_POSIX) 21 #if defined(OS_POSIX)
22 #include "base/file_descriptor_posix.h" 22 #include "base/file_descriptor_posix.h"
23 #endif 23 #endif
24 #include "base/file_path.h"
24 #include "base/platform_file.h" 25 #include "base/platform_file.h"
25 #include "base/ref_counted.h" 26 #include "base/ref_counted.h"
26 #include "base/time.h" 27 #include "base/time.h"
27 #include "googleurl/src/gurl.h" 28 #include "googleurl/src/gurl.h"
28 #include "net/url_request/url_request_status.h" 29 #include "net/url_request/url_request_status.h"
29 #include "webkit/glue/resource_type.h" 30 #include "webkit/glue/resource_type.h"
30 31
31 namespace net { 32 namespace net {
32 class HttpResponseHeaders; 33 class HttpResponseHeaders;
33 } 34 }
34 35
35 class FilePath;
36
37 namespace webkit_glue { 36 namespace webkit_glue {
38 37
39 class ResourceLoaderBridge { 38 class ResourceLoaderBridge {
40 public: 39 public:
41 // Structure used when calling ResourceLoaderBridge::Create(). 40 // Structure used when calling ResourceLoaderBridge::Create().
42 struct RequestInfo { 41 struct RequestInfo {
43 RequestInfo(); 42 RequestInfo();
44 ~RequestInfo(); 43 ~RequestInfo();
45 44
46 // HTTP-style method name (e.g., "GET" or "POST"). 45 // HTTP-style method name (e.g., "GET" or "POST").
(...skipping 30 matching lines...) Expand all
77 ResourceType::Type request_type; 76 ResourceType::Type request_type;
78 77
79 // Used for plugin to browser requests. 78 // Used for plugin to browser requests.
80 uint32 request_context; 79 uint32 request_context;
81 80
82 // Identifies what appcache host this request is associated with. 81 // Identifies what appcache host this request is associated with.
83 int appcache_host_id; 82 int appcache_host_id;
84 83
85 // Used to associated the bridge with a frame's network context. 84 // Used to associated the bridge with a frame's network context.
86 int routing_id; 85 int routing_id;
86
87 // If true, then the response body will be downloaded to a file and the
88 // path to that file will be provided in ResponseInfo::download_file_path.
89 bool download_to_file;
87 }; 90 };
88 91
89 // Structure containing timing information for the request. It addresses 92 // Structure containing timing information for the request. It addresses
90 // http://groups.google.com/group/http-archive-specification/web/har-1-1-spec 93 // http://groups.google.com/group/http-archive-specification/web/har-1-1-spec
91 // and http://dev.w3.org/2006/webapi/WebTiming/ needs. 94 // and http://dev.w3.org/2006/webapi/WebTiming/ needs.
92 // 95 //
93 // All the values for starts and ends are given in milliseconds and are 96 // All the values for starts and ends are given in milliseconds and are
94 // offsets with respect to the given base time. 97 // offsets with respect to the given base time.
95 struct LoadTimingInfo { 98 struct LoadTimingInfo {
96 LoadTimingInfo(); 99 LoadTimingInfo();
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 // is no associated connection, contains 0. 187 // is no associated connection, contains 0.
185 uint32 connection_id; 188 uint32 connection_id;
186 189
187 // Determines whether physical connection reused. 190 // Determines whether physical connection reused.
188 bool connection_reused; 191 bool connection_reused;
189 192
190 // Detailed timing information used by the WebTiming, HAR and Developer 193 // Detailed timing information used by the WebTiming, HAR and Developer
191 // Tools. 194 // Tools.
192 LoadTimingInfo load_timing; 195 LoadTimingInfo load_timing;
193 196
197 // The path to a file that will contain the response body. It may only
198 // contain a portion of the response body at the time that the ResponseInfo
199 // becomes available.
200 FilePath download_file_path;
201
194 // True if the response was delivered using SPDY. 202 // True if the response was delivered using SPDY.
195 bool was_fetched_via_spdy; 203 bool was_fetched_via_spdy;
196 204
197 // True if the response was delivered after NPN is negotiated. 205 // True if the response was delivered after NPN is negotiated.
198 bool was_npn_negotiated; 206 bool was_npn_negotiated;
199 207
200 // True if response could use alternate protocol. However, browser will 208 // True if response could use alternate protocol. However, browser will
201 // ignore the alternate protocol when spdy is not enabled on browser side. 209 // ignore the alternate protocol when spdy is not enabled on browser side.
202 bool was_alternate_protocol_available; 210 bool was_alternate_protocol_available;
203 211
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 bool* has_new_first_party_for_cookies, 259 bool* has_new_first_party_for_cookies,
252 GURL* new_first_party_for_cookies) = 0; 260 GURL* new_first_party_for_cookies) = 0;
253 261
254 // Called when response headers are available (after all redirects have 262 // Called when response headers are available (after all redirects have
255 // been followed). |content_filtered| is set to true if the contents is 263 // been followed). |content_filtered| is set to true if the contents is
256 // altered or replaced (usually for security reasons when the resource is 264 // altered or replaced (usually for security reasons when the resource is
257 // deemed unsafe). 265 // deemed unsafe).
258 virtual void OnReceivedResponse(const ResponseInfo& info, 266 virtual void OnReceivedResponse(const ResponseInfo& info,
259 bool content_filtered) = 0; 267 bool content_filtered) = 0;
260 268
269 // Called when a chunk of response data is downloaded. This method may be
270 // called multiple times or not at all if an error occurs. This method is
271 // only called if RequestInfo::download_to_file was set to true, and in
272 // that case, OnReceivedData will not be called.
273 virtual void OnDownloadedData(int len) = 0;
274
261 // Called when a chunk of response data is available. This method may 275 // Called when a chunk of response data is available. This method may
262 // be called multiple times or not at all if an error occurs. 276 // be called multiple times or not at all if an error occurs.
263 virtual void OnReceivedData(const char* data, int len) = 0; 277 virtual void OnReceivedData(const char* data, int len) = 0;
264 278
265 // Called when metadata generated by the renderer is retrieved from the 279 // Called when metadata generated by the renderer is retrieved from the
266 // cache. This method may be called zero or one times. 280 // cache. This method may be called zero or one times.
267 virtual void OnReceivedCachedMetadata(const char* data, int len) { } 281 virtual void OnReceivedCachedMetadata(const char* data, int len) { }
268 282
269 // Called when the response is complete. This method signals completion of 283 // Called when the response is complete. This method signals completion of
270 // the resource load.ff 284 // the resource load.ff
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 // construction must go through Create() 350 // construction must go through Create()
337 ResourceLoaderBridge(); 351 ResourceLoaderBridge();
338 352
339 private: 353 private:
340 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); 354 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge);
341 }; 355 };
342 356
343 } // namespace webkit_glue 357 } // namespace webkit_glue
344 358
345 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ 359 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_
OLDNEW
« no previous file with comments | « webkit/glue/plugins/pepper_url_response_info.cc ('k') | webkit/glue/resource_loader_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698