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

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

Issue 6131009: Fix bug 69468: Drag download does not work if there is URL redirection involv... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_resource_handler.h" 5 #include "chrome/browser/renderer_host/download_resource_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 18 matching lines...) Expand all
29 int request_id, 29 int request_id,
30 const GURL& url, 30 const GURL& url,
31 DownloadFileManager* download_file_manager, 31 DownloadFileManager* download_file_manager,
32 net::URLRequest* request, 32 net::URLRequest* request,
33 bool save_as, 33 bool save_as,
34 const DownloadSaveInfo& save_info) 34 const DownloadSaveInfo& save_info)
35 : download_id_(-1), 35 : download_id_(-1),
36 global_id_(render_process_host_id, request_id), 36 global_id_(render_process_host_id, request_id),
37 render_view_id_(render_view_id), 37 render_view_id_(render_view_id),
38 url_(url), 38 url_(url),
39 original_url_(url),
39 content_length_(0), 40 content_length_(0),
40 download_file_manager_(download_file_manager), 41 download_file_manager_(download_file_manager),
41 request_(request), 42 request_(request),
42 save_as_(save_as), 43 save_as_(save_as),
43 save_info_(save_info), 44 save_info_(save_info),
44 buffer_(new DownloadBuffer), 45 buffer_(new DownloadBuffer),
45 rdh_(rdh), 46 rdh_(rdh),
46 is_paused_(false), 47 is_paused_(false),
47 url_check_pending_(false) { 48 url_check_pending_(false) {
48 } 49 }
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 set_content_disposition(content_disposition); 118 set_content_disposition(content_disposition);
118 set_content_length(response->response_head.content_length); 119 set_content_length(response->response_head.content_length);
119 120
120 const ResourceDispatcherHostRequestInfo* request_info = 121 const ResourceDispatcherHostRequestInfo* request_info =
121 ResourceDispatcherHost::InfoForRequest(request_); 122 ResourceDispatcherHost::InfoForRequest(request_);
122 123
123 download_id_ = download_file_manager_->GetNextId(); 124 download_id_ = download_file_manager_->GetNextId();
124 // |download_file_manager_| consumes (deletes): 125 // |download_file_manager_| consumes (deletes):
125 DownloadCreateInfo* info = new DownloadCreateInfo; 126 DownloadCreateInfo* info = new DownloadCreateInfo;
126 info->url = url_; 127 info->url = url_;
128 info->original_url = original_url_;
127 info->referrer_url = GURL(request_->referrer()); 129 info->referrer_url = GURL(request_->referrer());
128 info->start_time = base::Time::Now(); 130 info->start_time = base::Time::Now();
129 info->received_bytes = 0; 131 info->received_bytes = 0;
130 info->total_bytes = content_length_; 132 info->total_bytes = content_length_;
131 info->state = DownloadItem::IN_PROGRESS; 133 info->state = DownloadItem::IN_PROGRESS;
132 info->download_id = download_id_; 134 info->download_id = download_id_;
133 info->has_user_gesture = request_info->has_user_gesture(); 135 info->has_user_gesture = request_info->has_user_gesture();
134 info->child_id = global_id_.child_id; 136 info->child_id = global_id_.child_id;
135 info->render_view_id = render_view_id_; 137 info->render_view_id = render_view_id_;
136 info->request_id = global_id_.request_id; 138 info->request_id = global_id_.request_id;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 render_view_id_, 309 render_view_id_,
308 save_info_.file_path.value().c_str()); 310 save_info_.file_path.value().c_str());
309 } 311 }
310 312
311 void DownloadResourceHandler::UpdateDownloadUrlCheckStats( 313 void DownloadResourceHandler::UpdateDownloadUrlCheckStats(
312 SBStatsType stat_type) { 314 SBStatsType stat_type) {
313 UMA_HISTOGRAM_ENUMERATION("SB2.DownloadUrlChecks", 315 UMA_HISTOGRAM_ENUMERATION("SB2.DownloadUrlChecks",
314 stat_type, 316 stat_type,
315 DOWNLOAD_URL_CHECKS_MAX); 317 DOWNLOAD_URL_CHECKS_MAX);
316 } 318 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698