Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: content/browser/download/download_resource_handler.h

Issue 66993008: [Downloads] Cleanup DownloadResourceHandler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Annotate histogram enum with date it became obsolete. Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 std::string DebugString() const; 89 std::string DebugString() const;
90 90
91 private: 91 private:
92 virtual ~DownloadResourceHandler(); 92 virtual ~DownloadResourceHandler();
93 93
94 // Arrange for started_cb_ to be called on the UI thread with the 94 // Arrange for started_cb_ to be called on the UI thread with the
95 // below values, nulling out started_cb_. Should only be called 95 // below values, nulling out started_cb_. Should only be called
96 // on the IO thread. 96 // on the IO thread.
97 void CallStartedCB(DownloadItem* item, net::Error error); 97 void CallStartedCB(DownloadItem* item, net::Error error);
98 98
99 // If the content-length header is not present (or contains something other
100 // than numbers), the incoming content_length is -1 (unknown size).
101 // Set the content length to 0 to indicate unknown size to DownloadManager.
102 void SetContentLength(const int64& content_length);
103
104 void SetContentDisposition(const std::string& content_disposition);
105
106 uint32 download_id_; 99 uint32 download_id_;
107 std::string content_disposition_;
108 int64 content_length_;
109 // This is read only on the IO thread, but may only 100 // This is read only on the IO thread, but may only
110 // be called on the UI thread. 101 // be called on the UI thread.
111 DownloadUrlParameters::OnStartedCallback started_cb_; 102 DownloadUrlParameters::OnStartedCallback started_cb_;
112 scoped_ptr<DownloadSaveInfo> save_info_; 103 scoped_ptr<DownloadSaveInfo> save_info_;
113 104
114 // Data flow 105 // Data flow
115 scoped_refptr<net::IOBuffer> read_buffer_; // From URLRequest. 106 scoped_refptr<net::IOBuffer> read_buffer_; // From URLRequest.
116 scoped_ptr<ByteStreamWriter> stream_writer_; // To rest of system. 107 scoped_ptr<ByteStreamWriter> stream_writer_; // To rest of system.
117 108
118 // The following are used to collect stats. 109 // The following are used to collect stats.
119 base::TimeTicks download_start_time_; 110 base::TimeTicks download_start_time_;
120 base::TimeTicks last_read_time_; 111 base::TimeTicks last_read_time_;
121 base::TimeTicks last_stream_pause_time_; 112 base::TimeTicks last_stream_pause_time_;
122 base::TimeDelta total_pause_time_; 113 base::TimeDelta total_pause_time_;
123 size_t last_buffer_size_; 114 size_t last_buffer_size_;
124 int64 bytes_read_; 115 int64 bytes_read_;
125 std::string accept_ranges_;
126 std::string etag_;
127 116
128 int pause_count_; 117 int pause_count_;
129 bool was_deferred_; 118 bool was_deferred_;
130 119
131 // For DCHECKing 120 // For DCHECKing
132 bool on_response_started_called_; 121 bool on_response_started_called_;
133 122
134 static const int kReadBufSize = 32768; // bytes 123 static const int kReadBufSize = 32768; // bytes
135 static const int kThrottleTimeMs = 200; // milliseconds 124 static const int kThrottleTimeMs = 200; // milliseconds
136 125
137 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler); 126 DISALLOW_COPY_AND_ASSIGN(DownloadResourceHandler);
138 }; 127 };
139 128
140 } // namespace content 129 } // namespace content
141 130
142 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_ 131 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_RESOURCE_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/download/download_create_info.cc ('k') | content/browser/download/download_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698