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

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

Issue 207603003: Extract RequestInfo struct from ResourceLoaderBridge. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes Created 6 years, 9 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 | « content/test/test_webkit_platform_support.cc ('k') | webkit/child/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) 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 // 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. 7 // implemented by the embedder.
8 // 8 //
9 // One of these objects will be created by WebKit for each request. WebKit 9 // One of these objects will be created by WebKit for each request. WebKit
10 // will own the pointer to the bridge, and will delete it when the request is 10 // will own the pointer to the bridge, and will delete it when the request is
11 // no longer needed. 11 // no longer needed.
12 // 12 //
13 // In turn, the bridge's owner on the WebKit end will implement the Peer 13 // In turn, the bridge's owner on the WebKit end will implement the Peer
14 // interface, which we will use to communicate notifications back. 14 // interface, which we will use to communicate notifications back.
15 15
16 #ifndef WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_ 16 #ifndef WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_
17 #define WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_ 17 #define WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_
18 18
19 #include <utility> 19 #include <utility>
20 20
21 #include "build/build_config.h" 21 #include "build/build_config.h"
22 #if defined(OS_POSIX) 22 #if defined(OS_POSIX)
23 #include "base/file_descriptor_posix.h" 23 #include "base/file_descriptor_posix.h"
24 #endif 24 #endif
25 #include "base/memory/ref_counted.h" 25 #include "base/memory/ref_counted.h"
26 #include "base/platform_file.h" 26 #include "base/platform_file.h"
27 #include "base/values.h" 27 #include "base/values.h"
28 #include "net/base/request_priority.h" 28 #include "net/base/request_priority.h"
29 #include "third_party/WebKit/public/platform/WebReferrerPolicy.h"
30 #include "third_party/WebKit/public/platform/WebURLRequest.h"
31 #include "url/gurl.h" 29 #include "url/gurl.h"
32 #include "webkit/child/webkit_child_export.h" 30 #include "webkit/child/webkit_child_export.h"
33 #include "webkit/common/resource_response_info.h" 31 #include "webkit/common/resource_response_info.h"
34 #include "webkit/common/resource_type.h"
35 32
36 // TODO(pilgrim) remove this once resource loader is moved to content 33 // TODO(pilgrim) remove this once resource loader is moved to content
37 // http://crbug.com/338338 34 // http://crbug.com/338338
38 namespace content { 35 namespace content {
39 class ResourceRequestBody; 36 class ResourceRequestBody;
40 } 37 }
41 38
42 namespace webkit_glue { 39 namespace webkit_glue {
43 40
44 class ResourceLoaderBridge { 41 class ResourceLoaderBridge {
45 public: 42 public:
46 // Structure used when calling
47 // WebKitPlatformSupportImpl::CreateResourceLoader().
48 struct WEBKIT_CHILD_EXPORT RequestInfo {
49 RequestInfo();
50 ~RequestInfo();
51
52 // HTTP-style method name (e.g., "GET" or "POST").
53 std::string method;
54
55 // Absolute URL encoded in ASCII per the rules of RFC-2396.
56 GURL url;
57
58 // URL of the document in the top-level window, which may be checked by the
59 // third-party cookie blocking policy.
60 GURL first_party_for_cookies;
61
62 // Optional parameter, a URL with similar constraints in how it must be
63 // encoded as the url member.
64 GURL referrer;
65
66 // The referrer policy that applies to the referrer.
67 blink::WebReferrerPolicy referrer_policy;
68
69 // For HTTP(S) requests, the headers parameter can be a \r\n-delimited and
70 // \r\n-terminated list of MIME headers. They should be ASCII-encoded using
71 // the standard MIME header encoding rules. The headers parameter can also
72 // be null if no extra request headers need to be set.
73 std::string headers;
74
75 // Composed of the values defined in url_request_load_flags.h.
76 int load_flags;
77
78 // Process id of the process making the request.
79 int requestor_pid;
80
81 // Indicates if the current request is the main frame load, a sub-frame
82 // load, or a sub objects load.
83 ResourceType::Type request_type;
84
85 // Indicates the priority of this request, as determined by WebKit.
86 net::RequestPriority priority;
87
88 // Used for plugin to browser requests.
89 uint32 request_context;
90
91 // Identifies what appcache host this request is associated with.
92 int appcache_host_id;
93
94 // Used to associated the bridge with a frame's network context.
95 int routing_id;
96
97 // If true, then the response body will be downloaded to a file and the
98 // path to that file will be provided in ResponseInfo::download_file_path.
99 bool download_to_file;
100
101 // True if the request was user initiated.
102 bool has_user_gesture;
103
104 // Extra data associated with this request. We do not own this pointer.
105 blink::WebURLRequest::ExtraData* extra_data;
106
107 private:
108 DISALLOW_COPY_AND_ASSIGN(RequestInfo);
109 };
110
111 // See the SyncLoad method declared below. (The name of this struct is not 43 // See the SyncLoad method declared below. (The name of this struct is not
112 // suffixed with "Info" because it also contains the response data.) 44 // suffixed with "Info" because it also contains the response data.)
113 struct SyncLoadResponse : ResourceResponseInfo { 45 struct SyncLoadResponse : ResourceResponseInfo {
114 WEBKIT_CHILD_EXPORT SyncLoadResponse(); 46 WEBKIT_CHILD_EXPORT SyncLoadResponse();
115 WEBKIT_CHILD_EXPORT ~SyncLoadResponse(); 47 WEBKIT_CHILD_EXPORT ~SyncLoadResponse();
116 48
117 // The response error code. 49 // The response error code.
118 int error_code; 50 int error_code;
119 51
120 // The final URL of the response. This may differ from the request URL in 52 // The final URL of the response. This may differ from the request URL in
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // methods may be called to construct the body of the request. 165 // methods may be called to construct the body of the request.
234 WEBKIT_CHILD_EXPORT ResourceLoaderBridge(); 166 WEBKIT_CHILD_EXPORT ResourceLoaderBridge();
235 167
236 private: 168 private:
237 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); 169 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge);
238 }; 170 };
239 171
240 } // namespace webkit_glue 172 } // namespace webkit_glue
241 173
242 #endif // WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_ 174 #endif // WEBKIT_CHILD_RESOURCE_LOADER_BRIDGE_H_
OLDNEW
« no previous file with comments | « content/test/test_webkit_platform_support.cc ('k') | webkit/child/resource_loader_bridge.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698