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 #ifndef CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 class ResourceMessageFilter; | 24 class ResourceMessageFilter; |
25 class SharedIOBuffer; | 25 class SharedIOBuffer; |
26 | 26 |
27 // Used to complete an asynchronous resource request in response to resource | 27 // Used to complete an asynchronous resource request in response to resource |
28 // load events from the resource dispatcher host. | 28 // load events from the resource dispatcher host. |
29 class AsyncResourceHandler : public ResourceHandler, | 29 class AsyncResourceHandler : public ResourceHandler, |
30 public ResourceMessageDelegate { | 30 public ResourceMessageDelegate { |
31 public: | 31 public: |
32 AsyncResourceHandler(net::URLRequest* request, | 32 AsyncResourceHandler(net::URLRequest* request, |
33 ResourceDispatcherHostImpl* rdh); | 33 ResourceDispatcherHostImpl* rdh); |
34 virtual ~AsyncResourceHandler(); | 34 ~AsyncResourceHandler() override; |
35 | 35 |
36 virtual bool OnMessageReceived(const IPC::Message& message) override; | 36 bool OnMessageReceived(const IPC::Message& message) override; |
37 | 37 |
38 // ResourceHandler implementation: | 38 // ResourceHandler implementation: |
39 virtual bool OnUploadProgress(uint64 position, uint64 size) override; | 39 bool OnUploadProgress(uint64 position, uint64 size) override; |
40 virtual bool OnRequestRedirected(const net::RedirectInfo& redirect_info, | 40 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, |
41 ResourceResponse* response, | 41 ResourceResponse* response, |
42 bool* defer) override; | 42 bool* defer) override; |
43 virtual bool OnResponseStarted(ResourceResponse* response, | 43 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; |
44 bool* defer) override; | 44 bool OnWillStart(const GURL& url, bool* defer) override; |
45 virtual bool OnWillStart(const GURL& url, bool* defer) override; | 45 bool OnBeforeNetworkStart(const GURL& url, bool* defer) override; |
46 virtual bool OnBeforeNetworkStart(const GURL& url, bool* defer) override; | 46 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
47 virtual bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 47 int* buf_size, |
48 int* buf_size, | 48 int min_size) override; |
49 int min_size) override; | 49 bool OnReadCompleted(int bytes_read, bool* defer) override; |
50 virtual bool OnReadCompleted(int bytes_read, bool* defer) override; | 50 void OnResponseCompleted(const net::URLRequestStatus& status, |
51 virtual void OnResponseCompleted(const net::URLRequestStatus& status, | 51 const std::string& security_info, |
52 const std::string& security_info, | 52 bool* defer) override; |
53 bool* defer) override; | 53 void OnDataDownloaded(int bytes_downloaded) override; |
54 virtual void OnDataDownloaded(int bytes_downloaded) override; | |
55 | 54 |
56 private: | 55 private: |
57 // IPC message handlers: | 56 // IPC message handlers: |
58 void OnFollowRedirect(int request_id); | 57 void OnFollowRedirect(int request_id); |
59 void OnDataReceivedACK(int request_id); | 58 void OnDataReceivedACK(int request_id); |
60 | 59 |
61 bool EnsureResourceBufferIsInitialized(); | 60 bool EnsureResourceBufferIsInitialized(); |
62 void ResumeIfDeferred(); | 61 void ResumeIfDeferred(); |
63 void OnDefer(); | 62 void OnDefer(); |
64 | 63 |
(...skipping 15 matching lines...) Expand all Loading... |
80 int64_t reported_transfer_size_; | 79 int64_t reported_transfer_size_; |
81 | 80 |
82 base::TimeTicks redirect_start_time_; | 81 base::TimeTicks redirect_start_time_; |
83 | 82 |
84 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); | 83 DISALLOW_COPY_AND_ASSIGN(AsyncResourceHandler); |
85 }; | 84 }; |
86 | 85 |
87 } // namespace content | 86 } // namespace content |
88 | 87 |
89 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ | 88 #endif // CONTENT_BROWSER_LOADER_ASYNC_RESOURCE_HANDLER_H_ |
OLD | NEW |