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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/network/NetworkGroupers.js

Issue 2839273003: [Devtools] New structure and colorize rows for network products (Closed)
Patch Set: changes Created 3 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4 /**
pfeldman 2017/04/28 21:08:35 Where is my line? :)
allada 2017/04/28 22:21:09 Done.
5 * @implements {Network.GroupLookupInterface}
6 */
7 Network.ProductGrouper = class {
8 constructor() {
9 /** @type {?ProductRegistry.Registry} */
10 this._productRegistry = null;
11 }
12
13 /**
14 * @override
15 * @return {!Promise}
16 */
17 initialize() {
18 return ProductRegistry.instance().then(productRegistry => this._productRegis try = productRegistry);
19 }
20
21 /**
22 * @override
23 * @param {!SDK.NetworkRequest} request
24 * @return {?*}
25 */
26 groupForRequest(request) {
27 if (!this._productRegistry)
28 return null;
29 var productName = this._productRegistry.nameForUrl(request.parsedURL);
30 if (!productName)
31 return null;
32 return productName;
33 }
34
35 /**
36 * @override
37 * @param {!*} key
38 * @return {string}
39 */
40 groupName(key) {
41 return /** @type {string} */ (key);
42 }
43 };
44
45 /**
46 * @implements {Network.GroupLookupInterface}
47 */
48 Network.FrameGrouper = class {
49 constructor() {
50 /** @type {?ProductRegistry.Registry} */
51 this._productRegistry = null;
52 }
53
54 /**
55 * @override
56 * @return {!Promise}
57 */
58 initialize() {
59 return ProductRegistry.instance().then(productRegistry => this._productRegis try = productRegistry);
60 }
61
62 /**
63 * @override
64 * @param {!SDK.NetworkRequest} request
65 * @return {?*}
66 */
67 groupForRequest(request) {
68 var resourceTreeModel = request.networkManager().target().model(SDK.Resource TreeModel);
69 if (!resourceTreeModel)
70 return null;
71 var frame = resourceTreeModel.frameForId(request.frameId);
72 if (!frame || frame.isMainFrame())
73 return null;
74 return frame;
75 }
76
77 /**
78 * @override
79 * @param {!*} frameArg
80 * @return {string}
81 */
82 groupName(frameArg) {
83 var frame = /** @type {!SDK.ResourceTreeFrame} */ (frameArg);
84 var entry = this._productRegistry ? this._productRegistry.entryForFrame(fram e) : null;
85 if (entry)
86 return entry.name;
87 return (new Common.ParsedURL(frame.url)).host || frame.name || '<iframe>';
88 }
89 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698