Index: content/browser/loader/detached_resource_handler.h |
diff --git a/content/browser/loader/detached_resource_handler.h b/content/browser/loader/detached_resource_handler.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..851da338ee390f4a4cd438eacebf67b611780ed4 |
--- /dev/null |
+++ b/content/browser/loader/detached_resource_handler.h |
@@ -0,0 +1,70 @@ |
+// Copyright (c) 2013 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CONTENT_BROWSER_LOADER_DETACHED_RESOURCE_HANDLER_H_ |
+#define CONTENT_BROWSER_LOADER_DETACHED_RESOURCE_HANDLER_H_ |
+ |
+#include <string> |
+ |
+#include "base/memory/ref_counted.h" |
+#include "content/browser/loader/resource_handler.h" |
+#include "content/browser/loader/resource_message_delegate.h" |
+#include "url/gurl.h" |
+ |
+namespace net { |
+class URLRequest; |
+class IOBuffer; |
+} |
+ |
+namespace content { |
+class ResourceDispatcherHostImpl; |
+ |
+// Used to complete an asynchronous resource request in which the renderer only |
+// cares about load and error events, and does not want to see the bytes. The |
+// handler will continue if the renderer dissappears. |
+class DetachedResourceHandler : public ResourceHandler { |
+ public: |
+ DetachedResourceHandler(net::URLRequest* request, |
+ ResourceDispatcherHostImpl* rdh); |
+ virtual ~DetachedResourceHandler(); |
+ |
+ // ResourceHandler implementation: |
+ virtual bool OnUploadProgress(int request_id, uint64 position, |
+ uint64 size) OVERRIDE; |
+ |
+ virtual bool OnResponseStarted(int request_id, ResourceResponse* response, |
+ bool* defer) OVERRIDE; |
+ |
+ virtual bool OnWillStart(int request_id, const GURL& url, |
+ bool* defer) OVERRIDE; |
+ |
+ virtual bool OnWillRead(int request_id, net::IOBuffer** buf, int* buf_size, |
+ int min_size) OVERRIDE; |
+ |
+ virtual bool OnReadCompleted(int request_id, int bytes_read, |
+ bool* defer) OVERRIDE; |
+ |
+ virtual bool OnRequestRedirected(int request_id, const GURL& new_url, |
+ ResourceResponse* response, |
+ bool* defer) OVERRIDE; |
+ |
+ virtual bool OnResponseCompleted(int request_id, |
+ const net::URLRequestStatus& status, |
+ const std::string& security_info) OVERRIDE; |
mmenke
2013/10/11 16:39:07
nit: Add blank line between methods.
jkarlin2
2013/10/11 18:37:04
Done.
|
+ virtual void OnDataDownloaded(int request_id, int bytes_downloaded) OVERRIDE { |
+ } |
mmenke
2013/10/11 16:39:07
Suggest not inlining this.
jkarlin2
2013/10/11 18:37:04
Done.
|
+ |
+ private: |
+ enum { |
+ kReadBufSize = 3840 |
mmenke
2013/10/11 16:39:07
Is there a motivation for making it this size? We
jkarlin2
2013/10/11 18:37:04
Done. I copied it from the SyncResourceHandler. 3
|
+ }; |
mmenke
2013/10/11 16:39:07
Why not just use static const int? This also does
jkarlin2
2013/10/11 18:37:04
Done. I was copying SyncResourceHandler. static c
|
+ net::URLRequest* request_; |
+ ResourceDispatcherHostImpl* rdh_; |
+ scoped_refptr<net::IOBuffer> read_buffer_; |
+ DISALLOW_COPY_AND_ASSIGN(DetachedResourceHandler); |
mmenke
2013/10/11 16:39:07
nit: There's generally a blank line before DISALL
jkarlin2
2013/10/11 18:37:04
Done.
|
+}; |
+ |
+} // namespace content |
+ |
+#endif // CONTENT_BROWSER_LOADER_DETACHED_RESOURCE_HANDLER_H_ |