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

Side by Side Diff: chrome/browser/renderer_host/download_throttling_resource_handler.cc

Issue 351029: Support dragging a virtual file out of the browser. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 11 months 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "chrome/browser/renderer_host/download_throttling_resource_handler.h" 5 #include "chrome/browser/renderer_host/download_throttling_resource_handler.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/renderer_host/download_resource_handler.h" 8 #include "chrome/browser/renderer_host/download_resource_handler.h"
9 #include "chrome/browser/renderer_host/resource_dispatcher_host.h" 9 #include "chrome/browser/renderer_host/resource_dispatcher_host.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 NOTREACHED(); 123 NOTREACHED();
124 return true; 124 return true;
125 } 125 }
126 126
127 void DownloadThrottlingResourceHandler::CancelDownload() { 127 void DownloadThrottlingResourceHandler::CancelDownload() {
128 host_->CancelRequest(render_process_host_id_, request_id_, false); 128 host_->CancelRequest(render_process_host_id_, request_id_, false);
129 } 129 }
130 130
131 void DownloadThrottlingResourceHandler::ContinueDownload() { 131 void DownloadThrottlingResourceHandler::ContinueDownload() {
132 DCHECK(!download_handler_.get()); 132 DCHECK(!download_handler_.get());
133 FilePath save_file_path;
133 download_handler_ = 134 download_handler_ =
134 new DownloadResourceHandler(host_, 135 new DownloadResourceHandler(host_,
135 render_process_host_id_, 136 render_process_host_id_,
136 render_view_id_, 137 render_view_id_,
137 request_id_, 138 request_id_,
138 url_, 139 url_,
139 host_->download_file_manager(), 140 host_->download_file_manager(),
140 request_, 141 request_,
141 false); 142 false,
143 save_file_path);
142 if (response_.get()) 144 if (response_.get())
143 download_handler_->OnResponseStarted(request_id_, response_.get()); 145 download_handler_->OnResponseStarted(request_id_, response_.get());
144 146
145 if (tmp_buffer_length_) 147 if (tmp_buffer_length_)
146 CopyTmpBufferToDownloadHandler(); 148 CopyTmpBufferToDownloadHandler();
147 149
148 // And let the request continue. 150 // And let the request continue.
149 host_->PauseRequest(render_process_host_id_, request_id_, false); 151 host_->PauseRequest(render_process_host_id_, request_id_, false);
150 } 152 }
151 153
152 int DownloadThrottlingResourceHandler::GetRequestId() { 154 int DownloadThrottlingResourceHandler::GetRequestId() {
153 return request_id_; 155 return request_id_;
154 } 156 }
155 157
156 void DownloadThrottlingResourceHandler::CopyTmpBufferToDownloadHandler() { 158 void DownloadThrottlingResourceHandler::CopyTmpBufferToDownloadHandler() {
157 // Copy over the tmp buffer. 159 // Copy over the tmp buffer.
158 net::IOBuffer* buffer; 160 net::IOBuffer* buffer;
159 int buf_size; 161 int buf_size;
160 if (download_handler_->OnWillRead(request_id_, &buffer, &buf_size, 162 if (download_handler_->OnWillRead(request_id_, &buffer, &buf_size,
161 tmp_buffer_length_)) { 163 tmp_buffer_length_)) {
162 CHECK(buf_size >= tmp_buffer_length_); 164 CHECK(buf_size >= tmp_buffer_length_);
163 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_); 165 memcpy(buffer->data(), tmp_buffer_->data(), tmp_buffer_length_);
164 download_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_); 166 download_handler_->OnReadCompleted(request_id_, &tmp_buffer_length_);
165 } 167 }
166 tmp_buffer_length_ = 0; 168 tmp_buffer_length_ = 0;
167 tmp_buffer_ = NULL; 169 tmp_buffer_ = NULL;
168 } 170 }
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/download_resource_handler.cc ('k') | chrome/browser/renderer_host/resource_dispatcher_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698