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

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

Issue 1059843002: Refactor NetLog::LogLevel --> NetLogCaptureMode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing header Created 5 years, 8 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
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 // File method ordering: Methods in this file are in the same order as 5 // File method ordering: Methods in this file are in the same order as
6 // in download_item_impl.h, with the following exception: The public 6 // in download_item_impl.h, with the following exception: The public
7 // interface Start is placed in chronological order with the other 7 // interface Start is placed in chronological order with the other
8 // (private) routines that together define a DownloadItem's state 8 // (private) routines that together define a DownloadItem's state
9 // transitions as the download progresses. See "Download progression 9 // transitions as the download progresses. See "Download progression
10 // cascade" later in this file. 10 // cascade" later in this file.
(...skipping 1037 matching lines...) Expand 10 before | Expand all | Expand 10 after
1048 } 1048 }
1049 bytes_per_sec_ = bytes_per_sec; 1049 bytes_per_sec_ = bytes_per_sec;
1050 hash_state_ = hash_state; 1050 hash_state_ = hash_state;
1051 received_bytes_ = bytes_so_far; 1051 received_bytes_ = bytes_so_far;
1052 1052
1053 // If we've received more data than we were expecting (bad server info?), 1053 // If we've received more data than we were expecting (bad server info?),
1054 // revert to 'unknown size mode'. 1054 // revert to 'unknown size mode'.
1055 if (received_bytes_ > total_bytes_) 1055 if (received_bytes_ > total_bytes_)
1056 total_bytes_ = 0; 1056 total_bytes_ = 0;
1057 1057
1058 if (bound_net_log_.IsLogging()) { 1058 if (bound_net_log_.GetCaptureMode().enabled()) {
1059 bound_net_log_.AddEvent( 1059 bound_net_log_.AddEvent(
1060 net::NetLog::TYPE_DOWNLOAD_ITEM_UPDATED, 1060 net::NetLog::TYPE_DOWNLOAD_ITEM_UPDATED,
1061 net::NetLog::Int64Callback("bytes_so_far", received_bytes_)); 1061 net::NetLog::Int64Callback("bytes_so_far", received_bytes_));
1062 } 1062 }
1063 1063
1064 UpdateObservers(); 1064 UpdateObservers();
1065 } 1065 }
1066 1066
1067 void DownloadItemImpl::DestinationError(DownloadInterruptReason reason) { 1067 void DownloadItemImpl::DestinationError(DownloadInterruptReason reason) {
1068 // Postpone recognition of this error until after file name determination 1068 // Postpone recognition of this error until after file name determination
(...skipping 30 matching lines...) Expand all
1099 // See if it's set programmatically. 1099 // See if it's set programmatically.
1100 file_name = forced_file_path_.AsUTF8Unsafe(); 1100 file_name = forced_file_path_.AsUTF8Unsafe();
1101 // Possibly has a 'download' attribute for the anchor. 1101 // Possibly has a 'download' attribute for the anchor.
1102 if (file_name.empty()) 1102 if (file_name.empty())
1103 file_name = suggested_filename_; 1103 file_name = suggested_filename_;
1104 // From the URL file name. 1104 // From the URL file name.
1105 if (file_name.empty()) 1105 if (file_name.empty())
1106 file_name = GetURL().ExtractFileName(); 1106 file_name = GetURL().ExtractFileName();
1107 } 1107 }
1108 1108
1109 base::Callback<base::Value*(net::NetLog::LogLevel)> active_data = base::Bind( 1109 base::Callback<base::Value*(net::NetLogCaptureMode)> active_data =
mmenke 2015/04/22 18:52:18 While you're here, maybe just net::NetLog::Paramet
eroman 2015/04/22 20:01:47 Done.
1110 &ItemActivatedNetLogCallback, this, download_type, &file_name); 1110 base::Bind(&ItemActivatedNetLogCallback, this, download_type, &file_name);
1111 if (active) { 1111 if (active) {
1112 bound_net_log_.BeginEvent( 1112 bound_net_log_.BeginEvent(
1113 net::NetLog::TYPE_DOWNLOAD_ITEM_ACTIVE, active_data); 1113 net::NetLog::TYPE_DOWNLOAD_ITEM_ACTIVE, active_data);
1114 } else { 1114 } else {
1115 bound_net_log_.AddEvent( 1115 bound_net_log_.AddEvent(
1116 net::NetLog::TYPE_DOWNLOAD_ITEM_ACTIVE, active_data); 1116 net::NetLog::TYPE_DOWNLOAD_ITEM_ACTIVE, active_data);
1117 } 1117 }
1118 1118
1119 DVLOG(20) << __FUNCTION__ << "() " << DebugString(true); 1119 DVLOG(20) << __FUNCTION__ << "() " << DebugString(true);
1120 } 1120 }
(...skipping 683 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 case RESUME_MODE_USER_CONTINUE: 1804 case RESUME_MODE_USER_CONTINUE:
1805 return "USER_CONTINUE"; 1805 return "USER_CONTINUE";
1806 case RESUME_MODE_USER_RESTART: 1806 case RESUME_MODE_USER_RESTART:
1807 return "USER_RESTART"; 1807 return "USER_RESTART";
1808 } 1808 }
1809 NOTREACHED() << "Unknown resume mode " << mode; 1809 NOTREACHED() << "Unknown resume mode " << mode;
1810 return "unknown"; 1810 return "unknown";
1811 } 1811 }
1812 1812
1813 } // namespace content 1813 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698