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

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

Issue 8602002: Move some webkit_glue embedder functions into WebKitPlatformSupport virtual methods (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright year Created 9 years, 1 month 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 | « ui/gfx/compositor/test/compositor_test_support.cc ('k') | webkit/glue/webkit_glue.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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.
8 // to instantiate this object.
9 // 8 //
10 // 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
11 // 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
12 // no longer needed. 11 // no longer needed.
13 // 12 //
14 // 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
15 // interface, which we will use to communicate notifications back. 14 // interface, which we will use to communicate notifications back.
16 15
17 #ifndef WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ 16 #ifndef WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_
18 #define WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ 17 #define WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 // transparent proxy). The proxy could be any type of proxy, HTTP or SOCKS. 189 // transparent proxy). The proxy could be any type of proxy, HTTP or SOCKS.
191 // Note: we cannot tell if a transparent proxy may have been involved. 190 // Note: we cannot tell if a transparent proxy may have been involved.
192 bool was_fetched_via_proxy; 191 bool was_fetched_via_proxy;
193 192
194 // Remote address of the socket which fetched this resource. 193 // Remote address of the socket which fetched this resource.
195 net::HostPortPair socket_address; 194 net::HostPortPair socket_address;
196 }; 195 };
197 196
198 class ResourceLoaderBridge { 197 class ResourceLoaderBridge {
199 public: 198 public:
200 // Structure used when calling ResourceLoaderBridge::Create(). 199 // Structure used when calling
200 // WebKitPlatformSupportImpl::CreateResourceLoader().
201 struct RequestInfo { 201 struct RequestInfo {
202 RequestInfo(); 202 RequestInfo();
203 ~RequestInfo(); 203 ~RequestInfo();
204 204
205 // HTTP-style method name (e.g., "GET" or "POST"). 205 // HTTP-style method name (e.g., "GET" or "POST").
206 std::string method; 206 std::string method;
207 207
208 // Absolute URL encoded in ASCII per the rules of RFC-2396. 208 // Absolute URL encoded in ASCII per the rules of RFC-2396.
209 GURL url; 209 GURL url;
210 210
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // cache. This method may be called zero or one times. 322 // cache. This method may be called zero or one times.
323 virtual void OnReceivedCachedMetadata(const char* data, int len) { } 323 virtual void OnReceivedCachedMetadata(const char* data, int len) { }
324 324
325 // Called when the response is complete. This method signals completion of 325 // Called when the response is complete. This method signals completion of
326 // the resource load.ff 326 // the resource load.ff
327 virtual void OnCompletedRequest(const net::URLRequestStatus& status, 327 virtual void OnCompletedRequest(const net::URLRequestStatus& status,
328 const std::string& security_info, 328 const std::string& security_info,
329 const base::Time& completion_time) = 0; 329 const base::Time& completion_time) = 0;
330 }; 330 };
331 331
332 // use Create() for construction, but anybody can delete at any time, 332 // use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but
333 // INCLUDING during processing of callbacks. 333 // anybody can delete at any time, INCLUDING during processing of callbacks.
334 virtual ~ResourceLoaderBridge(); 334 virtual ~ResourceLoaderBridge();
335 335
336 // Call this method to make a new instance.
337 //
338 // For HTTP(S) POST requests, the AppendDataToUpload and AppendFileToUpload
339 // methods may be called to construct the body of the request.
340 static ResourceLoaderBridge* Create(const RequestInfo& request_info);
341
342 // Call this method before calling Start() to append a chunk of binary data 336 // Call this method before calling Start() to append a chunk of binary data
343 // to the request body. May only be used with HTTP(S) POST requests. 337 // to the request body. May only be used with HTTP(S) POST requests.
344 virtual void AppendDataToUpload(const char* data, int data_len) = 0; 338 virtual void AppendDataToUpload(const char* data, int data_len) = 0;
345 339
346 // Call this method before calling Start() to append the contents of a file 340 // Call this method before calling Start() to append the contents of a file
347 // to the request body. May only be used with HTTP(S) POST requests. 341 // to the request body. May only be used with HTTP(S) POST requests.
348 void AppendFileToUpload(const FilePath& file_path) { 342 void AppendFileToUpload(const FilePath& file_path) {
349 AppendFileRangeToUpload(file_path, 0, kuint64max, base::Time()); 343 AppendFileRangeToUpload(file_path, 0, kuint64max, base::Time());
350 } 344 }
351 345
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 // use this if you really need it! There is also no way for the caller to 381 // use this if you really need it! There is also no way for the caller to
388 // interrupt this method. Errors are reported via the status field of the 382 // interrupt this method. Errors are reported via the status field of the
389 // response parameter. 383 // response parameter.
390 virtual void SyncLoad(SyncLoadResponse* response) = 0; 384 virtual void SyncLoad(SyncLoadResponse* response) = 0;
391 385
392 // When loader is transferred from one page to another, the IPC routing id 386 // When loader is transferred from one page to another, the IPC routing id
393 // can change (they are associated with pages). 387 // can change (they are associated with pages).
394 virtual void UpdateRoutingId(int new_routing_id) = 0; 388 virtual void UpdateRoutingId(int new_routing_id) = 0;
395 389
396 protected: 390 protected:
397 // construction must go through Create() 391 // Construction must go through
392 // WebKitPlatformSupportImpl::CreateResourceLoader()
393 // For HTTP(S) POST requests, the AppendDataToUpload and AppendFileToUpload
394 // methods may be called to construct the body of the request.
398 ResourceLoaderBridge(); 395 ResourceLoaderBridge();
399 396
400 private: 397 private:
401 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); 398 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge);
402 }; 399 };
403 400
404 } // namespace webkit_glue 401 } // namespace webkit_glue
405 402
406 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ 403 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_
OLDNEW
« no previous file with comments | « ui/gfx/compositor/test/compositor_test_support.cc ('k') | webkit/glue/webkit_glue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698