| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_INTERCEPTING_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_INTERCEPTING_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_INTERCEPTING_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_INTERCEPTING_RESOURCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 public: | 39 public: |
| 40 InterceptingResourceHandler(std::unique_ptr<ResourceHandler> next_handler, | 40 InterceptingResourceHandler(std::unique_ptr<ResourceHandler> next_handler, |
| 41 net::URLRequest* request); | 41 net::URLRequest* request); |
| 42 ~InterceptingResourceHandler() override; | 42 ~InterceptingResourceHandler() override; |
| 43 | 43 |
| 44 // ResourceHandler implementation: | 44 // ResourceHandler implementation: |
| 45 void OnResponseStarted( | 45 void OnResponseStarted( |
| 46 ResourceResponse* response, | 46 ResourceResponse* response, |
| 47 std::unique_ptr<ResourceController> controller) override; | 47 std::unique_ptr<ResourceController> controller) override; |
| 48 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 48 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 49 int* buf_size, | 49 int* buf_size) override; |
| 50 int min_size) override; | |
| 51 void OnReadCompleted(int bytes_read, | 50 void OnReadCompleted(int bytes_read, |
| 52 std::unique_ptr<ResourceController> controller) override; | 51 std::unique_ptr<ResourceController> controller) override; |
| 53 void OnResponseCompleted( | 52 void OnResponseCompleted( |
| 54 const net::URLRequestStatus& status, | 53 const net::URLRequestStatus& status, |
| 55 std::unique_ptr<ResourceController> controller) override; | 54 std::unique_ptr<ResourceController> controller) override; |
| 56 | 55 |
| 57 // Replaces the next handler with |new_handler|, sending | 56 // Replaces the next handler with |new_handler|, sending |
| 58 // |payload_for_old_handler| to the old handler. Must be called after | 57 // |payload_for_old_handler| to the old handler. Must be called after |
| 59 // OnWillStart and OnRequestRedirected and before OnResponseStarted. One | 58 // OnWillStart and OnRequestRedirected and before OnResponseStarted. One |
| 60 // OnWillRead call is permitted beforehand. |new_handler|'s OnWillStart and | 59 // OnWillRead call is permitted beforehand. |new_handler|'s OnWillStart and |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 bool advance_to_next_state_ = false; | 150 bool advance_to_next_state_ = false; |
| 152 | 151 |
| 153 base::WeakPtrFactory<InterceptingResourceHandler> weak_ptr_factory_; | 152 base::WeakPtrFactory<InterceptingResourceHandler> weak_ptr_factory_; |
| 154 | 153 |
| 155 DISALLOW_COPY_AND_ASSIGN(InterceptingResourceHandler); | 154 DISALLOW_COPY_AND_ASSIGN(InterceptingResourceHandler); |
| 156 }; | 155 }; |
| 157 | 156 |
| 158 } // namespace content | 157 } // namespace content |
| 159 | 158 |
| 160 #endif // CONTENT_BROWSER_LOADER_INTERCEPTING_RESOURCE_HANDLER_H_ | 159 #endif // CONTENT_BROWSER_LOADER_INTERCEPTING_RESOURCE_HANDLER_H_ |
| OLD | NEW |