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

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

Issue 2333923004: Extracting NetLog inner classes into their own classes. (Closed)
Patch Set: Some nit fixes and better, impl-agnostic naming of net_log_parameters_callback_typedef.h -> net/log… Created 4 years, 2 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 #include "content/browser/web_contents/web_contents_impl.h" 47 #include "content/browser/web_contents/web_contents_impl.h"
48 #include "content/public/browser/browser_context.h" 48 #include "content/public/browser/browser_context.h"
49 #include "content/public/browser/browser_thread.h" 49 #include "content/public/browser/browser_thread.h"
50 #include "content/public/browser/content_browser_client.h" 50 #include "content/public/browser/content_browser_client.h"
51 #include "content/public/browser/download_danger_type.h" 51 #include "content/public/browser/download_danger_type.h"
52 #include "content/public/browser/download_interrupt_reasons.h" 52 #include "content/public/browser/download_interrupt_reasons.h"
53 #include "content/public/browser/download_url_parameters.h" 53 #include "content/public/browser/download_url_parameters.h"
54 #include "content/public/browser/storage_partition.h" 54 #include "content/public/browser/storage_partition.h"
55 #include "content/public/common/content_features.h" 55 #include "content/public/common/content_features.h"
56 #include "content/public/common/referrer.h" 56 #include "content/public/common/referrer.h"
57 #include "net/log/net_log.h"
57 #include "net/log/net_log_event_type.h" 58 #include "net/log/net_log_event_type.h"
59 #include "net/log/net_log_parameters_callback.h"
60 #include "net/log/net_log_source.h"
58 61
59 namespace content { 62 namespace content {
60 63
61 namespace { 64 namespace {
62 65
63 bool DeleteDownloadedFile(const base::FilePath& path) { 66 bool DeleteDownloadedFile(const base::FilePath& path) {
64 DCHECK_CURRENTLY_ON(BrowserThread::FILE); 67 DCHECK_CURRENTLY_ON(BrowserThread::FILE);
65 68
66 // Make sure we only delete files. 69 // Make sure we only delete files.
67 if (base::DirectoryExists(path)) 70 if (base::DirectoryExists(path))
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1107 // See if it's set programmatically. 1110 // See if it's set programmatically.
1108 file_name = forced_file_path_.AsUTF8Unsafe(); 1111 file_name = forced_file_path_.AsUTF8Unsafe();
1109 // Possibly has a 'download' attribute for the anchor. 1112 // Possibly has a 'download' attribute for the anchor.
1110 if (file_name.empty()) 1113 if (file_name.empty())
1111 file_name = suggested_filename_; 1114 file_name = suggested_filename_;
1112 // From the URL file name. 1115 // From the URL file name.
1113 if (file_name.empty()) 1116 if (file_name.empty())
1114 file_name = GetURL().ExtractFileName(); 1117 file_name = GetURL().ExtractFileName();
1115 } 1118 }
1116 1119
1117 net::NetLog::ParametersCallback active_data = 1120 net::NetLogParametersCallback active_data =
1118 base::Bind(&ItemActivatedNetLogCallback, this, download_type, &file_name); 1121 base::Bind(&ItemActivatedNetLogCallback, this, download_type, &file_name);
1119 if (active) { 1122 if (active) {
1120 net_log_.BeginEvent(net::NetLogEventType::DOWNLOAD_ITEM_ACTIVE, 1123 net_log_.BeginEvent(net::NetLogEventType::DOWNLOAD_ITEM_ACTIVE,
1121 active_data); 1124 active_data);
1122 } else { 1125 } else {
1123 net_log_.AddEvent(net::NetLogEventType::DOWNLOAD_ITEM_ACTIVE, 1126 net_log_.AddEvent(net::NetLogEventType::DOWNLOAD_ITEM_ACTIVE,
1124 active_data); 1127 active_data);
1125 } 1128 }
1126 1129
1127 DVLOG(20) << __func__ << "() " << DebugString(true); 1130 DVLOG(20) << __func__ << "() " << DebugString(true);
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after
2086 case RESUME_MODE_USER_CONTINUE: 2089 case RESUME_MODE_USER_CONTINUE:
2087 return "USER_CONTINUE"; 2090 return "USER_CONTINUE";
2088 case RESUME_MODE_USER_RESTART: 2091 case RESUME_MODE_USER_RESTART:
2089 return "USER_RESTART"; 2092 return "USER_RESTART";
2090 } 2093 }
2091 NOTREACHED() << "Unknown resume mode " << mode; 2094 NOTREACHED() << "Unknown resume mode " << mode;
2092 return "unknown"; 2095 return "unknown";
2093 } 2096 }
2094 2097
2095 } // namespace content 2098 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698