OLD | NEW |
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 var SourceEntry = (function() { | 5 var SourceEntry = (function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * A SourceEntry gathers all log entries with the same source. | 9 * A SourceEntry gathers all log entries with the same source. |
10 * | 10 * |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 this.description_ = e.params.hostname; | 133 this.description_ = e.params.hostname; |
134 break; | 134 break; |
135 case LogSourceType.DOWNLOAD: | 135 case LogSourceType.DOWNLOAD: |
136 switch (e.type) { | 136 switch (e.type) { |
137 case LogEventType.DOWNLOAD_FILE_RENAMED: | 137 case LogEventType.DOWNLOAD_FILE_RENAMED: |
138 this.description_ = e.params.new_filename; | 138 this.description_ = e.params.new_filename; |
139 break; | 139 break; |
140 case LogEventType.DOWNLOAD_FILE_OPENED: | 140 case LogEventType.DOWNLOAD_FILE_OPENED: |
141 this.description_ = e.params.file_name; | 141 this.description_ = e.params.file_name; |
142 break; | 142 break; |
| 143 case LogEventType.DOWNLOAD_ITEM_ACTIVE: |
| 144 this.description_ = e.params.intermediate_name; |
| 145 break; |
143 } | 146 } |
144 break; | 147 break; |
145 case LogSourceType.FILESTREAM: | 148 case LogSourceType.FILESTREAM: |
146 this.description_ = e.params.file_name; | 149 this.description_ = e.params.file_name; |
147 break; | 150 break; |
148 } | 151 } |
149 | 152 |
150 if (this.description_ == undefined) | 153 if (this.description_ == undefined) |
151 this.description_ = ''; | 154 this.description_ = ''; |
152 }, | 155 }, |
(...skipping 24 matching lines...) Expand all Loading... |
177 if (this.entries_[0].source.type == LogSourceType.DOWNLOAD) { | 180 if (this.entries_[0].source.type == LogSourceType.DOWNLOAD) { |
178 // If any rename occurred, use the last name | 181 // If any rename occurred, use the last name |
179 e = this.findLastLogEntryStartByType_( | 182 e = this.findLastLogEntryStartByType_( |
180 LogEventType.DOWNLOAD_FILE_RENAMED); | 183 LogEventType.DOWNLOAD_FILE_RENAMED); |
181 if (e != undefined) | 184 if (e != undefined) |
182 return e; | 185 return e; |
183 // Otherwise, if the file was opened, use that name | 186 // Otherwise, if the file was opened, use that name |
184 e = this.findLogEntryByType_(LogEventType.DOWNLOAD_FILE_OPENED); | 187 e = this.findLogEntryByType_(LogEventType.DOWNLOAD_FILE_OPENED); |
185 if (e != undefined) | 188 if (e != undefined) |
186 return e; | 189 return e; |
| 190 // History items are never opened, so use the activation info |
| 191 e = this.findLogEntryByType_(LogEventType.DOWNLOAD_ITEM_ACTIVE); |
| 192 if (e != undefined) |
| 193 return e; |
187 } | 194 } |
188 if (this.entries_.length >= 2) { | 195 if (this.entries_.length >= 2) { |
189 if (this.entries_[0].type == LogEventType.REQUEST_ALIVE || | 196 if (this.entries_[0].type == LogEventType.REQUEST_ALIVE || |
190 this.entries_[0].type == LogEventType.SOCKET_POOL_CONNECT_JOB || | 197 this.entries_[0].type == LogEventType.SOCKET_POOL_CONNECT_JOB || |
191 this.entries_[1].type == LogEventType.UDP_CONNECT) { | 198 this.entries_[1].type == LogEventType.UDP_CONNECT) { |
192 return this.entries_[1]; | 199 return this.entries_[1]; |
193 } | 200 } |
194 } | 201 } |
195 return this.entries_[0]; | 202 return this.entries_[0]; |
196 }, | 203 }, |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 * Prints descriptive text about |entries_| to a new node added to the end | 289 * Prints descriptive text about |entries_| to a new node added to the end |
283 * of |parent|. | 290 * of |parent|. |
284 */ | 291 */ |
285 printAsText: function(parent) { | 292 printAsText: function(parent) { |
286 printLogEntriesAsText(this.entries_, parent); | 293 printLogEntriesAsText(this.entries_, parent); |
287 } | 294 } |
288 }; | 295 }; |
289 | 296 |
290 return SourceEntry; | 297 return SourceEntry; |
291 })(); | 298 })(); |
OLD | NEW |