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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/extensions/ExtensionAPI.js

Issue 2073343002: Timeline addTraceProvider API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: checkbox prototype Created 4 years, 6 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
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 apiPrivate.panels = {}; 44 apiPrivate.panels = {};
45 apiPrivate.panels.SearchAction = { 45 apiPrivate.panels.SearchAction = {
46 CancelSearch: "cancelSearch", 46 CancelSearch: "cancelSearch",
47 PerformSearch: "performSearch", 47 PerformSearch: "performSearch",
48 NextSearchResult: "nextSearchResult", 48 NextSearchResult: "nextSearchResult",
49 PreviousSearchResult: "previousSearchResult" 49 PreviousSearchResult: "previousSearchResult"
50 }; 50 };
51 51
52 apiPrivate.Events = { 52 apiPrivate.Events = {
53 AuditStarted: "audit-started-", 53 AuditStarted: "audit-started-",
54 RecordingStarted: "recording-started-",
caseq 2016/06/21 07:29:51 nit: "trace-recording-started-"
54 ButtonClicked: "button-clicked-", 55 ButtonClicked: "button-clicked-",
55 PanelObjectSelected: "panel-objectSelected-", 56 PanelObjectSelected: "panel-objectSelected-",
56 NetworkRequestFinished: "network-request-finished", 57 NetworkRequestFinished: "network-request-finished",
57 OpenResource: "open-resource", 58 OpenResource: "open-resource",
58 PanelSearch: "panel-search-", 59 PanelSearch: "panel-search-",
59 ResourceAdded: "resource-added", 60 ResourceAdded: "resource-added",
60 ResourceContentCommitted: "resource-content-committed", 61 ResourceContentCommitted: "resource-content-committed",
61 ViewShown: "view-shown-", 62 ViewShown: "view-shown-",
62 ViewHidden: "view-hidden-" 63 ViewHidden: "view-hidden-"
63 }; 64 };
64 65
65 apiPrivate.Commands = { 66 apiPrivate.Commands = {
66 AddAuditCategory: "addAuditCategory", 67 AddAuditCategory: "addAuditCategory",
67 AddAuditResult: "addAuditResult", 68 AddAuditResult: "addAuditResult",
68 AddRequestHeaders: "addRequestHeaders", 69 AddRequestHeaders: "addRequestHeaders",
70 AddTraceProvider: "addTraceProvider",
69 ApplyStyleSheet: "applyStyleSheet", 71 ApplyStyleSheet: "applyStyleSheet",
70 CreatePanel: "createPanel", 72 CreatePanel: "createPanel",
71 CreateSidebarPane: "createSidebarPane", 73 CreateSidebarPane: "createSidebarPane",
72 CreateToolbarButton: "createToolbarButton", 74 CreateToolbarButton: "createToolbarButton",
73 EvaluateOnInspectedPage: "evaluateOnInspectedPage", 75 EvaluateOnInspectedPage: "evaluateOnInspectedPage",
74 ForwardKeyboardEvent: "_forwardKeyboardEvent", 76 ForwardKeyboardEvent: "_forwardKeyboardEvent",
75 GetHAR: "getHAR", 77 GetHAR: "getHAR",
76 GetPageResources: "getPageResources", 78 GetPageResources: "getPageResources",
77 GetRequestContent: "getRequestContent", 79 GetRequestContent: "getRequestContent",
78 GetResourceContent: "getResourceContent", 80 GetResourceContent: "getResourceContent",
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 this._fire.apply(this, request.arguments); 169 this._fire.apply(this, request.arguments);
168 } 170 }
169 } 171 }
170 172
171 /** 173 /**
172 * @constructor 174 * @constructor
173 */ 175 */
174 function InspectorExtensionAPI() 176 function InspectorExtensionAPI()
175 { 177 {
176 this.audits = new Audits(); 178 this.audits = new Audits();
179 this.timeline = new Timeline();
177 this.inspectedWindow = new InspectedWindow(); 180 this.inspectedWindow = new InspectedWindow();
178 this.panels = new Panels(); 181 this.panels = new Panels();
179 this.network = new Network(); 182 this.network = new Network();
180 defineDeprecatedProperty(this, "webInspector", "resources", "network"); 183 defineDeprecatedProperty(this, "webInspector", "resources", "network");
181 } 184 }
182 185
183 /** 186 /**
184 * @constructor 187 * @constructor
185 */ 188 */
186 function Network() 189 function Network()
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 tooltip: tooltipText, 549 tooltip: tooltipText,
547 disabled: !!disabled 550 disabled: !!disabled
548 }; 551 };
549 extensionServer.sendRequest(request); 552 extensionServer.sendRequest(request);
550 } 553 }
551 }; 554 };
552 555
553 /** 556 /**
554 * @constructor 557 * @constructor
555 */ 558 */
559 function Timeline()
560 {
561 }
562
563 Timeline.prototype = {
564 /**
565 * @param {string} categoryName
566 * @param {string} categoryTooltip
567 * @return {!TraceProvider}
568 */
569 addTraceProvider: function(categoryName, categoryTooltip)
570 {
571 var id = "extension-timeline-category-" + extensionServer.nextObjectId() ;
572 extensionServer.sendRequest({ command: commands.AddTraceProvider, id: id , categoryName: categoryName, categoryTooltip: categoryTooltip});
573 return new TraceProvider(id);
574 }
575 }
576
577 /**
578 * @constructor
579 */
580 function TraceProvider(id)
581 {
582 /**
583 * @this {EventSinkImpl}
584 */
585 function dispatchRecordingEvent(request)
caseq 2016/06/21 07:29:51 Looks like you don't need the custom dispatch call
586 {
587 this._fire();
588 }
589 this._id = id;
caseq 2016/06/21 07:29:51 do you need this?
590 this.onRecordingStarted = new EventSink(events.RecordingStarted + id, dispat chRecordingEvent);
591 }
592
593 /**
594 * @constructor
595 */
556 function Audits() 596 function Audits()
557 { 597 {
558 } 598 }
559 599
560 Audits.prototype = { 600 Audits.prototype = {
561 /** 601 /**
562 * @return {!AuditCategory} 602 * @return {!AuditCategory}
563 */ 603 */
564 addCategory: function(displayName, resultCount) 604 addCategory: function(displayName, resultCount)
565 { 605 {
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 { 1055 {
1016 return "(function(injectedScriptId){ " + 1056 return "(function(injectedScriptId){ " +
1017 "var extensionServer;" + 1057 "var extensionServer;" +
1018 defineCommonExtensionSymbols.toString() + ";" + 1058 defineCommonExtensionSymbols.toString() + ";" +
1019 injectedExtensionAPI.toString() + ";" + 1059 injectedExtensionAPI.toString() + ";" +
1020 buildPlatformExtensionAPI(extensionInfo, inspectedTabId) + ";" + 1060 buildPlatformExtensionAPI(extensionInfo, inspectedTabId) + ";" +
1021 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" + 1061 "platformExtensionAPI(injectedExtensionAPI(injectedScriptId));" +
1022 "return {};" + 1062 "return {};" +
1023 "})"; 1063 "})";
1024 } 1064 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698