OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_BROWSER_LOADER_DETACHED_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_DETACHED_RESOURCE_HANDLER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "content/browser/loader/resource_handler.h" |
| 12 #include "content/browser/loader/resource_message_delegate.h" |
| 13 #include "url/gurl.h" |
| 14 |
| 15 namespace net { |
| 16 class URLRequest; |
| 17 class IOBuffer; |
| 18 } |
| 19 |
| 20 namespace content { |
| 21 class ResourceDispatcherHostImpl; |
| 22 |
| 23 // Used to complete an asynchronous resource request in which the renderer only |
| 24 // cares about load and error events, and does not want to see the bytes. The |
| 25 // handler will continue if the renderer disappears. |
| 26 class DetachedResourceHandler : public ResourceHandler { |
| 27 public: |
| 28 DetachedResourceHandler(net::URLRequest* request, |
| 29 ResourceDispatcherHostImpl* rdh); |
| 30 |
| 31 virtual ~DetachedResourceHandler(); |
| 32 |
| 33 // ResourceHandler implementation: |
| 34 virtual bool OnUploadProgress(int request_id, uint64 position, |
| 35 uint64 size) OVERRIDE; |
| 36 |
| 37 virtual bool OnResponseStarted(int request_id, ResourceResponse* response, |
| 38 bool* defer) OVERRIDE; |
| 39 |
| 40 virtual bool OnWillStart(int request_id, const GURL& url, |
| 41 bool* defer) OVERRIDE; |
| 42 |
| 43 virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
| 44 int min_size) OVERRIDE; |
| 45 |
| 46 virtual bool OnReadCompleted(int request_id, int bytes_read, |
| 47 bool* defer) OVERRIDE; |
| 48 |
| 49 virtual bool OnRequestRedirected(int request_id, const GURL& new_url, |
| 50 ResourceResponse* response, |
| 51 bool* defer) OVERRIDE; |
| 52 |
| 53 virtual bool OnResponseCompleted(int request_id, |
| 54 const net::URLRequestStatus& status, |
| 55 const std::string& security_info) OVERRIDE; |
| 56 |
| 57 virtual void OnDataDownloaded(int request_id, int bytes_downloaded) OVERRIDE; |
| 58 |
| 59 private: |
| 60 net::URLRequest* request_; |
| 61 ResourceDispatcherHostImpl* rdh_; |
| 62 scoped_refptr<net::IOBuffer> read_buffer_; |
| 63 |
| 64 DISALLOW_COPY_AND_ASSIGN(DetachedResourceHandler); |
| 65 }; |
| 66 |
| 67 } // namespace content |
| 68 |
| 69 #endif // CONTENT_BROWSER_LOADER_DETACHED_RESOURCE_HANDLER_H_ |
OLD | NEW |