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

Side by Side Diff: Source/devtools/front_end/host/Platform.js

Issue 671463002: DevTools: make flame chart a web component. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: test fixed Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 * @return {boolean} 51 * @return {boolean}
52 */ 52 */
53 WebInspector.isWin = function() 53 WebInspector.isWin = function()
54 { 54 {
55 if (typeof WebInspector._isWin === "undefined") 55 if (typeof WebInspector._isWin === "undefined")
56 WebInspector._isWin = WebInspector.platform() === "windows"; 56 WebInspector._isWin = WebInspector.platform() === "windows";
57 57
58 return WebInspector._isWin; 58 return WebInspector._isWin;
59 } 59 }
60 60
61 WebInspector.PlatformFlavor = {
62 WindowsVista: "windows-vista",
63 MacTiger: "mac-tiger",
64 MacLeopard: "mac-leopard",
65 MacSnowLeopard: "mac-snowleopard",
66 MacLion: "mac-lion"
67 }
68
69 /** 61 /**
70 * @return {string} 62 * @return {string}
71 */ 63 */
72 WebInspector.platformFlavor = function()
73 {
74 function detectFlavor()
75 {
76 const userAgent = navigator.userAgent;
77
78 if (WebInspector.platform() === "windows") {
79 var match = userAgent.match(/Windows NT (\d+)\.(?:\d+)/);
80 if (match && match[1] >= 6)
81 return WebInspector.PlatformFlavor.WindowsVista;
82 return null;
83 } else if (WebInspector.platform() === "mac") {
84 var match = userAgent.match(/Mac OS X\s*(?:(\d+)_(\d+))?/);
85 if (!match || match[1] != 10)
86 return WebInspector.PlatformFlavor.MacSnowLeopard;
87 switch (Number(match[2])) {
88 case 4:
89 return WebInspector.PlatformFlavor.MacTiger;
90 case 5:
91 return WebInspector.PlatformFlavor.MacLeopard;
92 case 6:
93 return WebInspector.PlatformFlavor.MacSnowLeopard;
94 case 7:
95 return WebInspector.PlatformFlavor.MacLion;
96 case 8: // Matches the default version
97 case 9: // Matches the default version
98 default:
99 return "";
100 }
101 }
102 }
103
104 if (!WebInspector._platformFlavor)
105 WebInspector._platformFlavor = detectFlavor();
106
107 return WebInspector._platformFlavor;
108 }
109
110 /**
111 * @return {string}
112 */
113 WebInspector.port = function() 64 WebInspector.port = function()
114 { 65 {
115 if (!WebInspector._port) 66 if (!WebInspector._port)
116 WebInspector._port = InspectorFrontendHost.port(); 67 WebInspector._port = InspectorFrontendHost.port();
117 68
118 return WebInspector._port; 69 return WebInspector._port;
119 } 70 }
120 71
121 /** 72 /**
122 * @return {string} 73 * @return {string}
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 return WebInspector._monospaceFontFamily; 111 return WebInspector._monospaceFontFamily;
161 } 112 }
162 113
163 /** 114 /**
164 * @return {boolean} 115 * @return {boolean}
165 */ 116 */
166 WebInspector.isWorkerFrontend = function() 117 WebInspector.isWorkerFrontend = function()
167 { 118 {
168 return !!Runtime.queryParam("isSharedWorker"); 119 return !!Runtime.queryParam("isSharedWorker");
169 } 120 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/extensions/ExtensionPanel.js ('k') | Source/devtools/front_end/inspectorCommon.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698