OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_ |
6 #define CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_ | 6 #define CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 int min_size); | 51 int min_size); |
52 virtual bool OnReadCompleted(int request_id, int* bytes_read); | 52 virtual bool OnReadCompleted(int request_id, int* bytes_read); |
53 virtual bool OnResponseCompleted(int request_id, | 53 virtual bool OnResponseCompleted(int request_id, |
54 const net::URLRequestStatus& status, | 54 const net::URLRequestStatus& status, |
55 const std::string& security_info); | 55 const std::string& security_info); |
56 virtual void OnRequestClosed(); | 56 virtual void OnRequestClosed(); |
57 | 57 |
58 // DownloadRequestLimiter::Callback implementation: | 58 // DownloadRequestLimiter::Callback implementation: |
59 virtual void CancelDownload(); | 59 virtual void CancelDownload(); |
60 virtual void ContinueDownload(); | 60 virtual void ContinueDownload(); |
61 virtual int GetRequestId(); | |
62 | 61 |
63 private: | 62 private: |
64 virtual ~DownloadThrottlingResourceHandler(); | 63 virtual ~DownloadThrottlingResourceHandler(); |
65 | 64 |
66 void CopyTmpBufferToDownloadHandler(); | 65 void CopyTmpBufferToDownloadHandler(); |
67 | 66 |
68 ResourceDispatcherHost* host_; | 67 ResourceDispatcherHost* host_; |
69 net::URLRequest* request_; | 68 net::URLRequest* request_; |
70 GURL url_; | 69 GURL url_; |
71 int render_process_host_id_; | 70 int render_process_host_id_; |
(...skipping 12 matching lines...) Expand all Loading... |
84 // a buffer. This is that buffer. | 83 // a buffer. This is that buffer. |
85 scoped_refptr<net::IOBuffer> tmp_buffer_; | 84 scoped_refptr<net::IOBuffer> tmp_buffer_; |
86 int tmp_buffer_length_; | 85 int tmp_buffer_length_; |
87 | 86 |
88 // If true the next call to OnReadCompleted is ignored. This is used if we're | 87 // If true the next call to OnReadCompleted is ignored. This is used if we're |
89 // paused during a call to OnReadCompleted. Pausing during OnReadCompleted | 88 // paused during a call to OnReadCompleted. Pausing during OnReadCompleted |
90 // results in two calls to OnReadCompleted for the same data. This make sure | 89 // results in two calls to OnReadCompleted for the same data. This make sure |
91 // we ignore one of them. | 90 // we ignore one of them. |
92 bool ignore_on_read_complete_; | 91 bool ignore_on_read_complete_; |
93 | 92 |
| 93 // Have we received OnRequestClosed()? If so, we shouldn't act on |
| 94 // CancelDownload()/ContinueDownload(). |
| 95 bool request_closed_; |
| 96 |
94 DISALLOW_COPY_AND_ASSIGN(DownloadThrottlingResourceHandler); | 97 DISALLOW_COPY_AND_ASSIGN(DownloadThrottlingResourceHandler); |
95 }; | 98 }; |
96 | 99 |
97 #endif // CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_ | 100 #endif // CHROME_BROWSER_RENDERER_HOST_DOWNLOAD_THROTTLING_RESOURCE_HANDLER_H_ |
OLD | NEW |