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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/host/UserMetrics.js

Issue 2466123002: DevTools: reformat front-end code to match chromium style. (Closed)
Patch Set: all done Created 4 years, 1 month 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
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
11 * copyright notice, this list of conditions and the following disclaimer 11 * copyright notice, this list of conditions and the following disclaimer
12 * in the documentation and/or other materials provided with the 12 * in the documentation and/or other materials provided with the
13 * distribution. 13 * distribution.
14 * * Neither the name of Google Inc. nor the names of its 14 * * Neither the name of Google Inc. nor the names of its
15 * contributors may be used to endorse or promote products derived from 15 * contributors may be used to endorse or promote products derived from
16 * this software without specific prior written permission. 16 * this software without specific prior written permission.
17 * 17 *
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 /**
31 * @unrestricted
32 */
33 WebInspector.UserMetrics = class {
34 /**
35 * @param {string} panelName
36 */
37 panelShown(panelName) {
38 var code = WebInspector.UserMetrics._PanelCodes[panelName] || 0;
39 var size = Object.keys(WebInspector.UserMetrics._PanelCodes).length + 1;
40 InspectorFrontendHost.recordEnumeratedHistogram('DevTools.PanelShown', code, size);
41 }
30 42
31 /** 43 /**
32 * @constructor 44 * @param {string} drawerId
33 */ 45 */
34 WebInspector.UserMetrics = function() 46 drawerShown(drawerId) {
35 { 47 this.panelShown('drawer-' + drawerId);
48 }
49
50 /**
51 * @param {!WebInspector.UserMetrics.Action} action
52 */
53 actionTaken(action) {
54 var size = Object.keys(WebInspector.UserMetrics.Action).length + 1;
55 InspectorFrontendHost.recordEnumeratedHistogram('DevTools.ActionTaken', acti on, size);
56 }
36 }; 57 };
37 58
38 // Codes below are used to collect UMA histograms in the Chromium port. 59 // Codes below are used to collect UMA histograms in the Chromium port.
39 // Do not change the values below, additional actions are needed on the Chromium side 60 // Do not change the values below, additional actions are needed on the Chromium side
40 // in order to add more codes. 61 // in order to add more codes.
41 62
42 /** @enum {number} */ 63 /** @enum {number} */
43 WebInspector.UserMetrics.Action = { 64 WebInspector.UserMetrics.Action = {
44 WindowDocked: 1, 65 WindowDocked: 1,
45 WindowUndocked: 2, 66 WindowUndocked: 2,
46 ScriptsBreakpointSet: 3, 67 ScriptsBreakpointSet: 3,
47 TimelineStarted: 4, 68 TimelineStarted: 4,
48 ProfilesCPUProfileTaken: 5, 69 ProfilesCPUProfileTaken: 5,
49 ProfilesHeapProfileTaken: 6, 70 ProfilesHeapProfileTaken: 6,
50 AuditsStarted: 7, 71 AuditsStarted: 7,
51 ConsoleEvaluated: 8, 72 ConsoleEvaluated: 8,
52 FileSavedInWorkspace: 9, 73 FileSavedInWorkspace: 9,
53 DeviceModeEnabled: 10, 74 DeviceModeEnabled: 10,
54 AnimationsPlaybackRateChanged: 11, 75 AnimationsPlaybackRateChanged: 11,
55 RevisionApplied: 12, 76 RevisionApplied: 12,
56 FileSystemDirectoryContentReceived: 13, 77 FileSystemDirectoryContentReceived: 13,
57 StyleRuleEdited: 14, 78 StyleRuleEdited: 14,
58 CommandEvaluatedInConsolePanel: 15, 79 CommandEvaluatedInConsolePanel: 15,
59 DOMPropertiesExpanded: 16, 80 DOMPropertiesExpanded: 16,
60 ResizedViewInResponsiveMode: 17 81 ResizedViewInResponsiveMode: 17
61 }; 82 };
62 83
63 WebInspector.UserMetrics._PanelCodes = { 84 WebInspector.UserMetrics._PanelCodes = {
64 elements: 1, 85 elements: 1,
65 resources: 2, 86 resources: 2,
66 network: 3, 87 network: 3,
67 sources: 4, 88 sources: 4,
68 timeline: 5, 89 timeline: 5,
69 profiles: 6, 90 profiles: 6,
70 audits: 7, 91 audits: 7,
71 console: 8, 92 console: 8,
72 layers: 9, 93 layers: 9,
73 "drawer-console": 10, 94 'drawer-console': 10,
74 "drawer-animations": 11, 95 'drawer-animations': 11,
75 "drawer-network.config": 12, 96 'drawer-network.config': 12,
76 "drawer-rendering": 13, 97 'drawer-rendering': 13,
77 "drawer-sensors": 14, 98 'drawer-sensors': 14,
78 "drawer-sources.search": 15, 99 'drawer-sources.search': 15,
79 security: 16 100 security: 16
80 };
81
82 WebInspector.UserMetrics.prototype = {
83 /**
84 * @param {string} panelName
85 */
86 panelShown: function(panelName)
87 {
88 var code = WebInspector.UserMetrics._PanelCodes[panelName] || 0;
89 var size = Object.keys(WebInspector.UserMetrics._PanelCodes).length + 1;
90 InspectorFrontendHost.recordEnumeratedHistogram("DevTools.PanelShown", c ode, size);
91 },
92
93 /**
94 * @param {string} drawerId
95 */
96 drawerShown: function(drawerId)
97 {
98 this.panelShown("drawer-" + drawerId);
99 },
100
101 /**
102 * @param {!WebInspector.UserMetrics.Action} action
103 */
104 actionTaken: function(action)
105 {
106 var size = Object.keys(WebInspector.UserMetrics.Action).length + 1;
107 InspectorFrontendHost.recordEnumeratedHistogram("DevTools.ActionTaken", action, size);
108 }
109 }; 101 };
110 102
111 /** @type {!WebInspector.UserMetrics} */ 103 /** @type {!WebInspector.UserMetrics} */
112 WebInspector.userMetrics = new WebInspector.UserMetrics(); 104 WebInspector.userMetrics = new WebInspector.UserMetrics();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698