Chromium Code Reviews| 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 23 matching lines...) Expand all Loading... | |
| 176 } | 179 } |
| 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.findLastLogEntryByType_(LogEventType.DOWNLOAD_FILE_RENAMED); | 182 e = this.findLastLogEntryByType_(LogEventType.DOWNLOAD_FILE_RENAMED); |
| 180 if (e != undefined) | 183 if (e != undefined) |
| 181 return e; | 184 return e; |
| 182 // Otherwise, if the file was opened, use that name | 185 // Otherwise, if the file was opened, use that name |
| 183 e = this.findLogEntryByType_(LogEventType.DOWNLOAD_FILE_OPENED); | 186 e = this.findLogEntryByType_(LogEventType.DOWNLOAD_FILE_OPENED); |
| 184 if (e != undefined) | 187 if (e != undefined) |
| 185 return e; | 188 return e; |
| 189 // History items are never opened, so use the activation info | |
| 190 e = this.findLogEntryByType_(LogEventType.DOWNLOAD_ITEM_ACTIVE); | |
|
Randy Smith (Not in Mondays)
2012/02/03 18:23:37
Why aren't we using the DOWNLOAD_ITEM_ACTIVE in pr
ahendrickson
2012/02/04 05:24:04
This information is used to determine what to show
| |
| 191 if (e != undefined) | |
| 192 return e; | |
| 186 } | 193 } |
| 187 if (this.entries_.length >= 2) { | 194 if (this.entries_.length >= 2) { |
| 188 if (this.entries_[0].type == LogEventType.REQUEST_ALIVE || | 195 if (this.entries_[0].type == LogEventType.REQUEST_ALIVE || |
| 189 this.entries_[0].type == LogEventType.SOCKET_POOL_CONNECT_JOB || | 196 this.entries_[0].type == LogEventType.SOCKET_POOL_CONNECT_JOB || |
| 190 this.entries_[1].type == LogEventType.UDP_CONNECT) { | 197 this.entries_[1].type == LogEventType.UDP_CONNECT) { |
| 191 return this.entries_[1]; | 198 return this.entries_[1]; |
| 192 } | 199 } |
| 193 } | 200 } |
| 194 return this.entries_[0]; | 201 return this.entries_[0]; |
| 195 }, | 202 }, |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 283 * Prints descriptive text about |entries_| to a new node added to the end | 290 * Prints descriptive text about |entries_| to a new node added to the end |
| 284 * of |parent|. | 291 * of |parent|. |
| 285 */ | 292 */ |
| 286 printAsText: function(parent) { | 293 printAsText: function(parent) { |
| 287 printLogEntriesAsText(this.entries_, parent); | 294 printLogEntriesAsText(this.entries_, parent); |
| 288 } | 295 } |
| 289 }; | 296 }; |
| 290 | 297 |
| 291 return SourceEntry; | 298 return SourceEntry; |
| 292 })(); | 299 })(); |
| OLD | NEW |