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

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

Issue 9296012: Hooked up NetLog to DownloadItem, DownloadFile, and FileStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with parent Created 8 years, 10 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) 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 #include "content/browser/download/download_resource_handler.h" 5 #include "content/browser/download/download_resource_handler.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 22 matching lines...) Expand all
33 using content::DownloadId; 33 using content::DownloadId;
34 using content::DownloadItem; 34 using content::DownloadItem;
35 using content::DownloadManager; 35 using content::DownloadManager;
36 36
37 DownloadResourceHandler::DownloadResourceHandler( 37 DownloadResourceHandler::DownloadResourceHandler(
38 ResourceDispatcherHost* rdh, 38 ResourceDispatcherHost* rdh,
39 int render_process_host_id, 39 int render_process_host_id,
40 int render_view_id, 40 int render_view_id,
41 int request_id, 41 int request_id,
42 const GURL& url, 42 const GURL& url,
43 const net::BoundNetLog& bound_net_log,
43 DownloadFileManager* download_file_manager, 44 DownloadFileManager* download_file_manager,
44 net::URLRequest* request, 45 net::URLRequest* request,
45 const DownloadResourceHandler::OnStartedCallback& started_cb, 46 const DownloadResourceHandler::OnStartedCallback& started_cb,
46 const DownloadSaveInfo& save_info) 47 const DownloadSaveInfo& save_info)
47 : download_id_(DownloadId::Invalid()), 48 : download_id_(DownloadId::Invalid()),
48 global_id_(render_process_host_id, request_id), 49 global_id_(render_process_host_id, request_id),
49 render_view_id_(render_view_id), 50 render_view_id_(render_view_id),
50 content_length_(0), 51 content_length_(0),
51 download_file_manager_(download_file_manager), 52 download_file_manager_(download_file_manager),
52 request_(request), 53 request_(request),
53 started_cb_(started_cb), 54 started_cb_(started_cb),
54 save_info_(save_info), 55 save_info_(save_info),
55 buffer_(new content::DownloadBuffer), 56 buffer_(new content::DownloadBuffer),
56 rdh_(rdh), 57 rdh_(rdh),
57 is_paused_(false), 58 is_paused_(false),
58 last_buffer_size_(0), 59 last_buffer_size_(0),
59 bytes_read_(0) { 60 bytes_read_(0),
61 bound_net_log_(bound_net_log) {
60 download_stats::RecordDownloadCount(download_stats::UNTHROTTLED_COUNT); 62 download_stats::RecordDownloadCount(download_stats::UNTHROTTLED_COUNT);
61 } 63 }
62 64
63 bool DownloadResourceHandler::OnUploadProgress(int request_id, 65 bool DownloadResourceHandler::OnUploadProgress(int request_id,
64 uint64 position, 66 uint64 position,
65 uint64 size) { 67 uint64 size) {
66 return true; 68 return true;
67 } 69 }
68 70
69 // Not needed, as this event handler ought to be the final resource. 71 // Not needed, as this event handler ought to be the final resource.
(...skipping 21 matching lines...) Expand all
91 &content_disposition); 93 &content_disposition);
92 set_content_disposition(content_disposition); 94 set_content_disposition(content_disposition);
93 set_content_length(response->content_length); 95 set_content_length(response->content_length);
94 96
95 const ResourceDispatcherHostRequestInfo* request_info = 97 const ResourceDispatcherHostRequestInfo* request_info =
96 ResourceDispatcherHost::InfoForRequest(request_); 98 ResourceDispatcherHost::InfoForRequest(request_);
97 99
98 // Deleted in DownloadManager. 100 // Deleted in DownloadManager.
99 scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo(FilePath(), GURL(), 101 scoped_ptr<DownloadCreateInfo> info(new DownloadCreateInfo(FilePath(), GURL(),
100 base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS, 102 base::Time::Now(), 0, content_length_, DownloadItem::IN_PROGRESS,
101 request_info->has_user_gesture(), request_info->transition_type())); 103 bound_net_log_, request_info->has_user_gesture(),
104 request_info->transition_type()));
102 info->url_chain = request_->url_chain(); 105 info->url_chain = request_->url_chain();
103 info->referrer_url = GURL(request_->referrer()); 106 info->referrer_url = GURL(request_->referrer());
104 info->start_time = base::Time::Now(); 107 info->start_time = base::Time::Now();
105 info->received_bytes = save_info_.offset; 108 info->received_bytes = save_info_.offset;
106 info->total_bytes = content_length_; 109 info->total_bytes = content_length_;
107 info->state = DownloadItem::IN_PROGRESS; 110 info->state = DownloadItem::IN_PROGRESS;
108 info->has_user_gesture = request_info->has_user_gesture(); 111 info->has_user_gesture = request_info->has_user_gesture();
109 info->content_disposition = content_disposition_; 112 info->content_disposition = content_disposition_;
110 info->mime_type = response->mime_type; 113 info->mime_type = response->mime_type;
111 info->remote_address = request_->GetSocketAddress().host(); 114 info->remote_address = request_->GetSocketAddress().host();
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 " render_view_id_ = " "%d" 378 " render_view_id_ = " "%d"
376 " save_info_.file_path = \"%" PRFilePath "\"" 379 " save_info_.file_path = \"%" PRFilePath "\""
377 " }", 380 " }",
378 request_->url().spec().c_str(), 381 request_->url().spec().c_str(),
379 download_id_.local(), 382 download_id_.local(),
380 global_id_.child_id, 383 global_id_.child_id,
381 global_id_.request_id, 384 global_id_.request_id,
382 render_view_id_, 385 render_view_id_,
383 save_info_.file_path.value().c_str()); 386 save_info_.file_path.value().c_str());
384 } 387 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698