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 SourceRow = (function() { | 5 var SourceRow = (function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 /** | 8 /** |
9 * A SourceRow represents the row corresponding to a single SourceEntry | 9 * A SourceRow represents the row corresponding to a single SourceEntry |
10 * displayed by the EventsView. | 10 * displayed by the EventsView. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 | 158 |
159 setFilterStyles: function(isMatchedByFilter) { | 159 setFilterStyles: function(isMatchedByFilter) { |
160 // Hide rows which have been filtered away. | 160 // Hide rows which have been filtered away. |
161 if (isMatchedByFilter) { | 161 if (isMatchedByFilter) { |
162 this.row_.style.display = ''; | 162 this.row_.style.display = ''; |
163 } else { | 163 } else { |
164 this.row_.style.display = 'none'; | 164 this.row_.style.display = 'none'; |
165 } | 165 } |
166 }, | 166 }, |
167 | 167 |
168 matchesFilter: function(filter) { | 168 matchesFilter: function(filter) { |
eroman
2013/04/17 21:38:05
Actually I think this is only used in one place --
mmenke
2013/04/17 22:34:55
Done.
| |
169 if (filter.isActive && this.isInactive_) | 169 return filter(this.sourceEntry_); |
170 return false; | |
171 if (filter.isInactive && !this.isInactive_) | |
172 return false; | |
173 if (filter.isError && !this.isError_) | |
174 return false; | |
175 if (filter.isNotError && this.isError_) | |
176 return false; | |
177 | |
178 // Check source type, if needed. | |
179 if (filter.type) { | |
180 var i; | |
181 var sourceType = this.sourceEntry_.getSourceTypeString().toLowerCase(); | |
182 for (i = 0; i < filter.type.length; ++i) { | |
183 if (sourceType.search(filter.type[i]) != -1) | |
184 break; | |
185 } | |
186 if (i == filter.type.length) | |
187 return false; | |
188 } | |
189 | |
190 // Check source ID, if needed. | |
191 if (filter.id) { | |
192 if (filter.id.indexOf(this.getSourceId() + '') == -1) | |
193 return false; | |
194 } | |
195 | |
196 if (!filter.textFilters) | |
197 return true; | |
198 | |
199 // Used for searching for input strings. Lazily initialized. | |
200 var tablePrinter = null; | |
201 | |
202 for (var i = 0; i < filter.textFilters.length; ++i) { | |
203 // The description is not always contained in one of the log entries. | |
204 if (this.description_.toLowerCase().indexOf( | |
205 filter.textFilters[i]) != -1) { | |
206 continue; | |
207 } | |
208 | |
209 // Allow specifying source types by name. | |
210 var sourceType = this.sourceEntry_.getSourceTypeString(); | |
211 if (sourceType.toLowerCase().indexOf(filter.textFilters[i]) != -1) | |
212 continue; | |
213 | |
214 if (!tablePrinter) { | |
215 tablePrinter = createLogEntryTablePrinter( | |
216 this.sourceEntry_.getLogEntries(), | |
217 SourceTracker.getInstance().getPrivacyStripping()); | |
218 } | |
219 if (!tablePrinter.search(filter.textFilters[i])) | |
220 return false; | |
221 } | |
222 return true; | |
223 }, | 170 }, |
224 | 171 |
225 isSelected: function() { | 172 isSelected: function() { |
226 return this.isSelected_; | 173 return this.isSelected_; |
227 }, | 174 }, |
228 | 175 |
229 setSelected: function(isSelected) { | 176 setSelected: function(isSelected) { |
230 if (isSelected == this.isSelected()) | 177 if (isSelected == this.isSelected()) |
231 return; | 178 return; |
232 | 179 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
315 /** | 262 /** |
316 * Moves current object's row after |entry|'s row. | 263 * Moves current object's row after |entry|'s row. |
317 */ | 264 */ |
318 moveAfter: function(entry) { | 265 moveAfter: function(entry) { |
319 this.row_.parentNode.insertBefore(this.row_, entry.row_.nextSibling); | 266 this.row_.parentNode.insertBefore(this.row_, entry.row_.nextSibling); |
320 } | 267 } |
321 }; | 268 }; |
322 | 269 |
323 return SourceRow; | 270 return SourceRow; |
324 })(); | 271 })(); |
OLD | NEW |