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_BUFFERED_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_BUFFERED_RESOURCE_HANDLER_H_ |
6 #define CONTENT_BROWSER_LOADER_BUFFERED_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_BUFFERED_RESOURCE_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 struct WebPluginInfo; | 21 struct WebPluginInfo; |
22 | 22 |
23 // Used to buffer a request until enough data has been received. | 23 // Used to buffer a request until enough data has been received. |
24 class BufferedResourceHandler | 24 class BufferedResourceHandler |
25 : public LayeredResourceHandler, | 25 : public LayeredResourceHandler, |
26 public ResourceController { | 26 public ResourceController { |
27 public: | 27 public: |
28 BufferedResourceHandler(scoped_ptr<ResourceHandler> next_handler, | 28 BufferedResourceHandler(scoped_ptr<ResourceHandler> next_handler, |
29 ResourceDispatcherHostImpl* host, | 29 ResourceDispatcherHostImpl* host, |
30 net::URLRequest* request); | 30 net::URLRequest* request); |
31 virtual ~BufferedResourceHandler(); | 31 ~BufferedResourceHandler() override; |
32 | 32 |
33 private: | 33 private: |
34 // ResourceHandler implementation: | 34 // ResourceHandler implementation: |
35 virtual void SetController(ResourceController* controller) override; | 35 void SetController(ResourceController* controller) override; |
36 virtual bool OnResponseStarted(ResourceResponse* response, | 36 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; |
37 bool* defer) override; | 37 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
38 virtual bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 38 int* buf_size, |
39 int* buf_size, | 39 int min_size) override; |
40 int min_size) override; | 40 bool OnReadCompleted(int bytes_read, bool* defer) override; |
41 virtual bool OnReadCompleted(int bytes_read, bool* defer) override; | 41 void OnResponseCompleted(const net::URLRequestStatus& status, |
42 virtual void OnResponseCompleted(const net::URLRequestStatus& status, | 42 const std::string& security_info, |
43 const std::string& security_info, | 43 bool* defer) override; |
44 bool* defer) override; | |
45 | 44 |
46 // ResourceController implementation: | 45 // ResourceController implementation: |
47 virtual void Resume() override; | 46 void Resume() override; |
48 virtual void Cancel() override; | 47 void Cancel() override; |
49 virtual void CancelAndIgnore() override; | 48 void CancelAndIgnore() override; |
50 virtual void CancelWithError(int error_code) override; | 49 void CancelWithError(int error_code) override; |
51 | 50 |
52 bool ProcessResponse(bool* defer); | 51 bool ProcessResponse(bool* defer); |
53 | 52 |
54 bool ShouldSniffContent(); | 53 bool ShouldSniffContent(); |
55 bool DetermineMimeType(); | 54 bool DetermineMimeType(); |
56 bool SelectNextHandler(bool* defer); | 55 bool SelectNextHandler(bool* defer); |
57 bool UseAlternateNextHandler(scoped_ptr<ResourceHandler> handler, | 56 bool UseAlternateNextHandler(scoped_ptr<ResourceHandler> handler, |
58 const std::string& payload_for_old_handler); | 57 const std::string& payload_for_old_handler); |
59 | 58 |
60 bool ReplayReadCompleted(bool* defer); | 59 bool ReplayReadCompleted(bool* defer); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 bool must_download_is_set_; | 100 bool must_download_is_set_; |
102 | 101 |
103 base::WeakPtrFactory<BufferedResourceHandler> weak_ptr_factory_; | 102 base::WeakPtrFactory<BufferedResourceHandler> weak_ptr_factory_; |
104 | 103 |
105 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); | 104 DISALLOW_COPY_AND_ASSIGN(BufferedResourceHandler); |
106 }; | 105 }; |
107 | 106 |
108 } // namespace content | 107 } // namespace content |
109 | 108 |
110 #endif // CONTENT_BROWSER_LOADER_BUFFERED_RESOURCE_HANDLER_H_ | 109 #endif // CONTENT_BROWSER_LOADER_BUFFERED_RESOURCE_HANDLER_H_ |
OLD | NEW |