OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 * @implements {Network.NetworkColumnExtensionInterface} |
5 * @implements {Network.NetworkGroupLookupInterface} | 6 * @implements {Network.NetworkGroupLookupInterface} |
6 */ | 7 */ |
7 NetworkGroupLookup.NetworkProductGroupLookup = class { | 8 NetworkGroupLookup.NetworkProductGroupLookup = class { |
8 /** | 9 /** |
9 * @override | 10 * @override |
10 * @param {!SDK.NetworkRequest} request | 11 * @param {!SDK.NetworkRequest} request |
11 * @return {?string} | 12 * @return {?string} |
12 */ | 13 */ |
13 lookup(request) { | 14 lookup(request) { |
14 return ProductRegistry.nameForUrl(request.parsedURL); | 15 return ProductRegistry.nameForUrl(request.parsedURL); |
15 } | 16 } |
| 17 |
| 18 /** |
| 19 * @override |
| 20 * @param {!SDK.NetworkRequest} request |
| 21 * @return {string} |
| 22 */ |
| 23 lookupColumnValue(request) { |
| 24 return this.lookup(request) || ''; |
| 25 } |
| 26 |
| 27 /** |
| 28 * @override |
| 29 * @param {!SDK.NetworkRequest} aRequest |
| 30 * @param {!SDK.NetworkRequest} bRequest |
| 31 * @return {number} |
| 32 */ |
| 33 requestComparator(aRequest, bRequest) { |
| 34 var aValue = this.lookupColumnValue(aRequest); |
| 35 var bValue = this.lookupColumnValue(bRequest); |
| 36 if (aValue === bValue) |
| 37 return aRequest.indentityCompare(bRequest); |
| 38 return aValue > bValue ? 1 : -1; |
| 39 } |
16 }; | 40 }; |
OLD | NEW |