| 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_SYNC_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_LOADER_SYNC_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_LOADER_SYNC_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_LOADER_SYNC_RESOURCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 class SyncResourceHandler : public ResourceHandler { | 29 class SyncResourceHandler : public ResourceHandler { |
| 30 public: | 30 public: |
| 31 using SyncLoadResultCallback = | 31 using SyncLoadResultCallback = |
| 32 ResourceDispatcherHostImpl::SyncLoadResultCallback; | 32 ResourceDispatcherHostImpl::SyncLoadResultCallback; |
| 33 | 33 |
| 34 SyncResourceHandler(net::URLRequest* request, | 34 SyncResourceHandler(net::URLRequest* request, |
| 35 const SyncLoadResultCallback& sync_result_handler, | 35 const SyncLoadResultCallback& sync_result_handler, |
| 36 ResourceDispatcherHostImpl* resource_dispatcher_host); | 36 ResourceDispatcherHostImpl* resource_dispatcher_host); |
| 37 ~SyncResourceHandler() override; | 37 ~SyncResourceHandler() override; |
| 38 | 38 |
| 39 bool OnRequestRedirected(const net::RedirectInfo& redirect_info, | 39 void OnRequestRedirected(const net::RedirectInfo& redirect_info, |
| 40 ResourceResponse* response, | 40 ResourceResponse* response, |
| 41 bool* defer) override; | 41 bool* defer_or_cancel) override; |
| 42 bool OnResponseStarted(ResourceResponse* response, bool* defer) override; | 42 void OnResponseStarted(ResourceResponse* response, |
| 43 bool OnWillStart(const GURL& url, bool* defer) override; | 43 bool* defer_or_cancel) override; |
| 44 void OnWillStart(const GURL& url, bool* defer_or_cancel) override; |
| 44 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, | 45 bool OnWillRead(scoped_refptr<net::IOBuffer>* buf, |
| 45 int* buf_size, | 46 int* buf_size, |
| 46 int min_size) override; | 47 int min_size) override; |
| 47 bool OnReadCompleted(int bytes_read, bool* defer) override; | 48 void OnReadCompleted(int bytes_read, bool* defer_or_cancel) override; |
| 48 void OnResponseCompleted(const net::URLRequestStatus& status, | 49 void OnResponseCompleted(const net::URLRequestStatus& status, |
| 49 bool* defer) override; | 50 bool* defer) override; |
| 50 void OnDataDownloaded(int bytes_downloaded) override; | 51 void OnDataDownloaded(int bytes_downloaded) override; |
| 51 | 52 |
| 52 private: | 53 private: |
| 53 enum { kReadBufSize = 3840 }; | 54 enum { kReadBufSize = 3840 }; |
| 54 | 55 |
| 55 scoped_refptr<net::IOBuffer> read_buffer_; | 56 scoped_refptr<net::IOBuffer> read_buffer_; |
| 56 | 57 |
| 57 SyncLoadResult result_; | 58 SyncLoadResult result_; |
| 58 SyncLoadResultCallback result_handler_; | 59 SyncLoadResultCallback result_handler_; |
| 59 ResourceDispatcherHostImpl* rdh_; | 60 ResourceDispatcherHostImpl* rdh_; |
| 60 int64_t total_transfer_size_; | 61 int64_t total_transfer_size_; |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 } // namespace content | 64 } // namespace content |
| 64 | 65 |
| 65 #endif // CONTENT_BROWSER_LOADER_SYNC_RESOURCE_HANDLER_H_ | 66 #endif // CONTENT_BROWSER_LOADER_SYNC_RESOURCE_HANDLER_H_ |
| OLD | NEW |