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_FILE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
7 | 7 |
8 #include "content/browser/download/download_file.h" | 8 #include "content/browser/download/download_file.h" |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/time.h" | 13 #include "base/time.h" |
14 #include "base/timer.h" | 14 #include "base/timer.h" |
15 #include "content/browser/byte_stream.h" | 15 #include "content/browser/byte_stream.h" |
16 #include "content/browser/download/base_file.h" | 16 #include "content/browser/download/base_file.h" |
| 17 #include "content/browser/download/rate_estimator.h" |
17 #include "content/public/browser/download_save_info.h" | 18 #include "content/public/browser/download_save_info.h" |
18 #include "net/base/net_log.h" | 19 #include "net/base/net_log.h" |
19 | 20 |
20 namespace content { | 21 namespace content { |
21 class ByteStreamReader; | 22 class ByteStreamReader; |
22 class DownloadDestinationObserver; | 23 class DownloadDestinationObserver; |
23 class DownloadManager; | 24 class DownloadManager; |
24 class PowerSaveBlocker; | 25 class PowerSaveBlocker; |
25 struct DownloadCreateInfo; | 26 struct DownloadCreateInfo; |
26 | 27 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // with DownloadFile and get rid of BaseFile. | 90 // with DownloadFile and get rid of BaseFile. |
90 scoped_ptr<ByteStreamReader> stream_reader_; | 91 scoped_ptr<ByteStreamReader> stream_reader_; |
91 | 92 |
92 // Used to trigger progress updates. | 93 // Used to trigger progress updates. |
93 scoped_ptr<base::RepeatingTimer<DownloadFileImpl> > update_timer_; | 94 scoped_ptr<base::RepeatingTimer<DownloadFileImpl> > update_timer_; |
94 | 95 |
95 // Statistics | 96 // Statistics |
96 size_t bytes_seen_; | 97 size_t bytes_seen_; |
97 base::TimeDelta disk_writes_time_; | 98 base::TimeDelta disk_writes_time_; |
98 base::TimeTicks download_start_; | 99 base::TimeTicks download_start_; |
| 100 RateEstimator rate_estimator_; |
99 | 101 |
100 net::BoundNetLog bound_net_log_; | 102 net::BoundNetLog bound_net_log_; |
101 | 103 |
102 base::WeakPtr<DownloadDestinationObserver> observer_; | 104 base::WeakPtr<DownloadDestinationObserver> observer_; |
103 | 105 |
104 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; | 106 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; |
105 | 107 |
106 // RAII handle to keep the system from sleeping while we're downloading. | 108 // RAII handle to keep the system from sleeping while we're downloading. |
107 scoped_ptr<PowerSaveBlocker> power_save_blocker_; | 109 scoped_ptr<PowerSaveBlocker> power_save_blocker_; |
108 | 110 |
109 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); | 111 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); |
110 }; | 112 }; |
111 | 113 |
112 } // namespace content | 114 } // namespace content |
113 | 115 |
114 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 116 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
OLD | NEW |