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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/product_registry/ProductNameForURL.js

Issue 2696183005: [Devtools] Added Product Registry module in prep for Network Grouping (Closed)
Patch Set: [Devtools] Added Product Registry module in prep for Network Grouping Created 3 years, 10 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 /**
5 * @param {!Common.ParsedURL} parsedUrl
6 * @return {?string}
7 */
8 ProductRegistry.nameForUrl = function(parsedUrl) {
9 // TODO(allada) This should be expanded to allow paths as as well as domain to find a product.
10 var productsByDomain = ProductRegistry._productsByDomain;
11 var domain = parsedUrl.domain();
pfeldman 2017/02/16 01:48:04 data urls don't have domains.
allada 2017/02/16 04:23:30 Done.
12 var domainParts = domain.split('.');
13 while (domainParts.length > 1) {
14 var subDomain = domainParts.join('.');
15 if (subDomain in productsByDomain && (!productsByDomain[subDomain].exact || subDomain === domain))
16 return productsByDomain[subDomain].name;
17 domainParts.shift();
18 }
19 return null;
20 };
21
22 // See ProductRegistryData.js for actual data.
23 /** @type {!Object<string, !{name: string, exact: boolean}>} */
24 ProductRegistry._productsByDomain;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698