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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/main/Main.js

Issue 2453673002: [DevTools] Scope common protocol infrastructure under Protocol namespace in a separate module. (Closed)
Patch Set: 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) 2006, 2007, 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com).
4 * Copyright (C) 2009 Joseph Pecoraro 4 * Copyright (C) 2009 Joseph Pecoraro
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 target.registerInspectorDispatcher(new WebInspector.Main.InspectorDomain Dispatcher(target)); 293 target.registerInspectorDispatcher(new WebInspector.Main.InspectorDomain Dispatcher(target));
294 target.runtimeAgent().runIfWaitingForDebugger(); 294 target.runtimeAgent().runIfWaitingForDebugger();
295 if (target.hasBrowserCapability()) 295 if (target.hasBrowserCapability())
296 target.inspectorAgent().enable(); 296 target.inspectorAgent().enable();
297 297
298 console.timeEnd("Main._connectAndCreateTarget"); 298 console.timeEnd("Main._connectAndCreateTarget");
299 }, 299 },
300 300
301 /** 301 /**
302 * @param {function(string)} onMessage 302 * @param {function(string)} onMessage
303 * @return {!Promise<!InspectorBackendClass.Connection>} 303 * @return {!Promise<!Protocol.Connection>}
304 */ 304 */
305 _interceptMainConnection: function(onMessage) 305 _interceptMainConnection: function(onMessage)
306 { 306 {
307 var params = { 307 var params = {
308 onMessage: onMessage, 308 onMessage: onMessage,
309 onDisconnect: this._connectAndCreateTarget.bind(this) 309 onDisconnect: this._connectAndCreateTarget.bind(this)
310 }; 310 };
311 return this._connection.disconnect().then(this._createMainConnection.bin d(this, params)); 311 return this._connection.disconnect().then(this._createMainConnection.bin d(this, params));
312 }, 312 },
313 313
314 /** 314 /**
315 * @param {!InspectorBackendClass.Connection.Params} params 315 * @param {!Protocol.Connection.Params} params
316 * @return {!InspectorBackendClass.Connection} 316 * @return {!Protocol.Connection}
317 */ 317 */
318 _createMainConnection: function(params) 318 _createMainConnection: function(params)
319 { 319 {
320 if (Runtime.queryParam("ws")) { 320 if (Runtime.queryParam("ws")) {
321 var ws = "ws://" + Runtime.queryParam("ws"); 321 var ws = "ws://" + Runtime.queryParam("ws");
322 params.onDisconnect = onDisconnect.bind(null, params.onDisconnect); 322 params.onDisconnect = onDisconnect.bind(null, params.onDisconnect);
323 this._connection = new WebInspector.WebSocketConnection(ws, params); 323 this._connection = new WebInspector.WebSocketConnection(ws, params);
324 } else if (InspectorFrontendHost.isHostedMode()) { 324 } else if (InspectorFrontendHost.isHostedMode()) {
325 this._connection = new WebInspector.StubConnection(params); 325 this._connection = new WebInspector.StubConnection(params);
326 } else { 326 } else {
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 }; 952 };
953 953
954 /** 954 /**
955 * @param {string} method 955 * @param {string} method
956 * @param {?Object} params 956 * @param {?Object} params
957 * @return {!Promise} 957 * @return {!Promise}
958 */ 958 */
959 WebInspector.sendOverProtocol = function(method, params) 959 WebInspector.sendOverProtocol = function(method, params)
960 { 960 {
961 return new Promise((resolve, reject) => { 961 return new Promise((resolve, reject) => {
962 InspectorBackendClass.sendRawMessageForTesting(method, params, (err, res ult) => { 962 Protocol.sendRawMessageForTesting(method, params, (err, result) => {
963 if (err) 963 if (err)
964 return reject(err); 964 return reject(err);
965 return resolve(result); 965 return resolve(result);
966 }); 966 });
967 }); 967 });
968 }; 968 };
969 969
970 /** 970 /**
971 * @constructor 971 * @constructor
972 * @extends {WebInspector.VBox} 972 * @extends {WebInspector.VBox}
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 * @override 1112 * @override
1113 * @return {?Element} 1113 * @return {?Element}
1114 */ 1114 */
1115 settingElement: function() 1115 settingElement: function()
1116 { 1116 {
1117 return WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStri ng("Show rulers"), WebInspector.moduleSetting("showMetricsRulers")); 1117 return WebInspector.SettingsUI.createSettingCheckbox(WebInspector.UIStri ng("Show rulers"), WebInspector.moduleSetting("showMetricsRulers"));
1118 } 1118 }
1119 }; 1119 };
1120 1120
1121 new WebInspector.Main(); 1121 new WebInspector.Main();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698