Chromium Code Reviews| 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_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 74 void OnDataDownloaded(int bytes_downloaded) override; | 74 void OnDataDownloaded(int bytes_downloaded) override; |
| 75 | 75 |
| 76 void PauseRequest(); | 76 void PauseRequest(); |
| 77 void ResumeRequest(); | 77 void ResumeRequest(); |
| 78 | 78 |
| 79 // May result in this object being deleted by its owner. | 79 // May result in this object being deleted by its owner. |
| 80 void CancelRequest(); | 80 void CancelRequest(); |
| 81 | 81 |
| 82 std::string DebugString() const; | 82 std::string DebugString() const; |
| 83 | 83 |
| 84 void set_parent_download_manager(DownloadManager* download_manager) { | |
|
asanka
2015/11/20 19:57:46
Let's call this download_manager. The 'parent' rel
svaldez
2015/11/23 15:18:56
Done.
| |
| 85 parent_download_manager_ = download_manager; | |
| 86 } | |
| 87 | |
| 84 private: | 88 private: |
| 85 ~DownloadResourceHandler() override; | 89 ~DownloadResourceHandler() override; |
| 86 | 90 |
| 87 // Arrange for started_cb_ to be called on the UI thread with the | 91 // Arrange for started_cb_ to be called on the UI thread with the |
| 88 // below values, nulling out started_cb_. Should only be called | 92 // below values, nulling out started_cb_. Should only be called |
| 89 // on the IO thread. | 93 // on the IO thread. |
| 90 void CallStartedCB(DownloadItem* item, | 94 void CallStartedCB(DownloadItem* item, |
| 91 DownloadInterruptReason interrupt_reason); | 95 DownloadInterruptReason interrupt_reason); |
| 92 | 96 |
| 93 uint32 download_id_; | 97 uint32 download_id_; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 120 base::TimeDelta total_pause_time_; | 124 base::TimeDelta total_pause_time_; |
| 121 size_t last_buffer_size_; | 125 size_t last_buffer_size_; |
| 122 int64 bytes_read_; | 126 int64 bytes_read_; |
| 123 | 127 |
| 124 int pause_count_; | 128 int pause_count_; |
| 125 bool was_deferred_; | 129 bool was_deferred_; |
| 126 | 130 |
| 127 // For DCHECKing | 131 // For DCHECKing |
| 128 bool on_response_started_called_; | 132 bool on_response_started_called_; |
| 129 | 133 |
| 134 // DownloadManager passed in by the owner of DownloadResourceHandler for cases | |
| 135 // where WebContents is not available. | |
| 136 DownloadManager* parent_download_manager_; | |
| 137 | |
| 130 static const int kReadBufSize = 32768; // bytes | 138 static const int kReadBufSize = 32768; // bytes |
| 131 static const int kThrottleTimeMs = 200; // milliseconds | 139 static const int kThrottleTimeMs = 200; // milliseconds |
| 132 | 140 |
| 133 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); | 141 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); |
| 134 }; | 142 }; |
| 135 | 143 |
| 136 } // namespace content | 144 } // namespace content |
| 137 | 145 |
| 138 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ | 146 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ |
| OLD | NEW |