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 // 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 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 private: | 268 private: |
269 DISALLOW_COPY_AND_ASSIGN(RequestInfo); | 269 DISALLOW_COPY_AND_ASSIGN(RequestInfo); |
270 }; | 270 }; |
271 | 271 |
272 // See the SyncLoad method declared below. (The name of this struct is not | 272 // See the SyncLoad method declared below. (The name of this struct is not |
273 // suffixed with "Info" because it also contains the response data.) | 273 // suffixed with "Info" because it also contains the response data.) |
274 struct SyncLoadResponse : ResourceResponseInfo { | 274 struct SyncLoadResponse : ResourceResponseInfo { |
275 SyncLoadResponse(); | 275 SyncLoadResponse(); |
276 ~SyncLoadResponse(); | 276 ~SyncLoadResponse(); |
277 | 277 |
278 // The response status. | 278 // The response error code. |
279 net::URLRequestStatus status; | 279 int error_code; |
280 | 280 |
281 // The final URL of the response. This may differ from the request URL in | 281 // The final URL of the response. This may differ from the request URL in |
282 // the case of a server redirect. | 282 // the case of a server redirect. |
283 GURL url; | 283 GURL url; |
284 | 284 |
285 // The response data. | 285 // The response data. |
286 std::string data; | 286 std::string data; |
287 }; | 287 }; |
288 | 288 |
289 // Generated by the bridge. This is implemented by our custom resource loader | 289 // Generated by the bridge. This is implemented by our custom resource loader |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 // gzipped content), or -1 if if unknown. | 328 // gzipped content), or -1 if if unknown. |
329 virtual void OnReceivedData(const char* data, | 329 virtual void OnReceivedData(const char* data, |
330 int data_length, | 330 int data_length, |
331 int encoded_data_length) = 0; | 331 int encoded_data_length) = 0; |
332 | 332 |
333 // Called when metadata generated by the renderer is retrieved from the | 333 // Called when metadata generated by the renderer is retrieved from the |
334 // cache. This method may be called zero or one times. | 334 // cache. This method may be called zero or one times. |
335 virtual void OnReceivedCachedMetadata(const char* data, int len) { } | 335 virtual void OnReceivedCachedMetadata(const char* data, int len) { } |
336 | 336 |
337 // Called when the response is complete. This method signals completion of | 337 // Called when the response is complete. This method signals completion of |
338 // the resource load.ff | 338 // the resource load. |
339 virtual void OnCompletedRequest( | 339 virtual void OnCompletedRequest( |
340 const net::URLRequestStatus& status, | 340 int error_code, |
| 341 bool was_ignored_by_handler, |
341 const std::string& security_info, | 342 const std::string& security_info, |
342 const base::TimeTicks& completion_time) = 0; | 343 const base::TimeTicks& completion_time) = 0; |
343 | 344 |
344 protected: | 345 protected: |
345 virtual ~Peer() {} | 346 virtual ~Peer() {} |
346 }; | 347 }; |
347 | 348 |
348 // use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but | 349 // use WebKitPlatformSupportImpl::CreateResourceLoader() for construction, but |
349 // anybody can delete at any time, INCLUDING during processing of callbacks. | 350 // anybody can delete at any time, INCLUDING during processing of callbacks. |
350 WEBKIT_GLUE_EXPORT virtual ~ResourceLoaderBridge(); | 351 WEBKIT_GLUE_EXPORT virtual ~ResourceLoaderBridge(); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 // methods may be called to construct the body of the request. | 384 // methods may be called to construct the body of the request. |
384 WEBKIT_GLUE_EXPORT ResourceLoaderBridge(); | 385 WEBKIT_GLUE_EXPORT ResourceLoaderBridge(); |
385 | 386 |
386 private: | 387 private: |
387 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); | 388 DISALLOW_COPY_AND_ASSIGN(ResourceLoaderBridge); |
388 }; | 389 }; |
389 | 390 |
390 } // namespace webkit_glue | 391 } // namespace webkit_glue |
391 | 392 |
392 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ | 393 #endif // WEBKIT_GLUE_RESOURCE_LOADER_BRIDGE_H_ |
OLD | NEW |