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

Side by Side Diff: Source/devtools/front_end/extensions/ExtensionServer.js

Issue 396993003: DevTools: get rid of WebInspector.cssModel, use target models instead (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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) 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
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 else 387 else
388 result = { value: resultPayload.value }; 388 result = { value: resultPayload.value };
389 389
390 this._dispatchCallback(message.requestId, port, result); 390 this._dispatchCallback(message.requestId, port, result);
391 } 391 }
392 return this.evaluate(message.expression, true, true, message.evaluateOpt ions, port._extensionOrigin, callback.bind(this)); 392 return this.evaluate(message.expression, true, true, message.evaluateOpt ions, port._extensionOrigin, callback.bind(this));
393 }, 393 },
394 394
395 _onGetConsoleMessages: function() 395 _onGetConsoleMessages: function()
396 { 396 {
397 return WebInspector.consoleModel.messages.map(this._makeConsoleMessage); 397 return WebInspector.multitargetConsoleModel.messages().map(this._makeCon soleMessage);
398 }, 398 },
399 399
400 _onAddConsoleMessage: function(message) 400 _onAddConsoleMessage: function(message)
401 { 401 {
402 function convertSeverity(level) 402 function convertSeverity(level)
403 { 403 {
404 switch (level) { 404 switch (level) {
405 case WebInspector.extensionAPI.console.Severity.Log: 405 case WebInspector.extensionAPI.console.Severity.Log:
406 return WebInspector.ConsoleMessage.MessageLevel.Log; 406 return WebInspector.ConsoleMessage.MessageLevel.Log;
407 case WebInspector.extensionAPI.console.Severity.Warning: 407 case WebInspector.extensionAPI.console.Severity.Warning:
408 return WebInspector.ConsoleMessage.MessageLevel.Warning; 408 return WebInspector.ConsoleMessage.MessageLevel.Warning;
409 case WebInspector.extensionAPI.console.Severity.Error: 409 case WebInspector.extensionAPI.console.Severity.Error:
410 return WebInspector.ConsoleMessage.MessageLevel.Error; 410 return WebInspector.ConsoleMessage.MessageLevel.Error;
411 case WebInspector.extensionAPI.console.Severity.Debug: 411 case WebInspector.extensionAPI.console.Severity.Debug:
412 return WebInspector.ConsoleMessage.MessageLevel.Debug; 412 return WebInspector.ConsoleMessage.MessageLevel.Debug;
413 } 413 }
414 } 414 }
415 var level = convertSeverity(message.severity); 415 var level = convertSeverity(message.severity);
416 if (!level) 416 if (!level)
417 return this._status.E_BADARG("message.severity", message.severity); 417 return this._status.E_BADARG("message.severity", message.severity);
418 418
419 var mainTarget = WebInspector.targetManager.mainTarget();
419 var consoleMessage = new WebInspector.ConsoleMessage( 420 var consoleMessage = new WebInspector.ConsoleMessage(
420 WebInspector.consoleModel.target(), 421 mainTarget,
421 WebInspector.ConsoleMessage.MessageSource.JS, 422 WebInspector.ConsoleMessage.MessageSource.JS,
422 level, 423 level,
423 message.text, 424 message.text,
424 WebInspector.ConsoleMessage.MessageType.Log, 425 WebInspector.ConsoleMessage.MessageType.Log,
425 message.url, 426 message.url,
426 message.line); 427 message.line);
427 WebInspector.consoleModel.addMessage(consoleMessage); 428 mainTarget.consoleModel.addMessage(consoleMessage);
428 }, 429 },
429 430
430 _makeConsoleMessage: function(message) 431 _makeConsoleMessage: function(message)
431 { 432 {
432 function convertLevel(level) 433 function convertLevel(level)
433 { 434 {
434 if (!level) 435 if (!level)
435 return; 436 return;
436 switch (level) { 437 switch (level) {
437 case WebInspector.ConsoleMessage.MessageLevel.Log: 438 case WebInspector.ConsoleMessage.MessageLevel.Log:
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 660
660 _dispatchCallback: function(requestId, port, result) 661 _dispatchCallback: function(requestId, port, result)
661 { 662 {
662 if (requestId) 663 if (requestId)
663 port.postMessage({ command: "callback", requestId: requestId, result : result }); 664 port.postMessage({ command: "callback", requestId: requestId, result : result });
664 }, 665 },
665 666
666 _initExtensions: function() 667 _initExtensions: function()
667 { 668 {
668 this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.C onsoleMessageAdded, 669 this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.C onsoleMessageAdded,
669 WebInspector.consoleModel, WebInspector.ConsoleModel.Events.MessageA dded, this._notifyConsoleMessageAdded); 670 WebInspector.multitargetConsoleModel, WebInspector.ConsoleModel.Even ts.MessageAdded, this._notifyConsoleMessageAdded);
670 this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.N etworkRequestFinished, 671 this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.N etworkRequestFinished,
671 WebInspector.networkManager, WebInspector.NetworkManager.EventTypes. RequestFinished, this._notifyRequestFinished); 672 WebInspector.networkManager, WebInspector.NetworkManager.EventTypes. RequestFinished, this._notifyRequestFinished);
672 this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.R esourceAdded, 673 this._registerAutosubscriptionHandler(WebInspector.extensionAPI.Events.R esourceAdded,
673 WebInspector.workspace, 674 WebInspector.workspace,
674 WebInspector.Workspace.Events.UISourceCodeAdded, 675 WebInspector.Workspace.Events.UISourceCodeAdded,
675 this._notifyResourceAdded); 676 this._notifyResourceAdded);
676 677
677 /** 678 /**
678 * @this {WebInspector.ExtensionServer} 679 * @this {WebInspector.ExtensionServer}
679 */ 680 */
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 /** 1078 /**
1078 * @typedef {{code: string, description: string, details: !Array.<*>}} 1079 * @typedef {{code: string, description: string, details: !Array.<*>}}
1079 */ 1080 */
1080 WebInspector.ExtensionStatus.Record; 1081 WebInspector.ExtensionStatus.Record;
1081 1082
1082 WebInspector.extensionAPI = {}; 1083 WebInspector.extensionAPI = {};
1083 defineCommonExtensionSymbols(WebInspector.extensionAPI); 1084 defineCommonExtensionSymbols(WebInspector.extensionAPI);
1084 1085
1085 importScript("ExtensionPanel.js"); 1086 importScript("ExtensionPanel.js");
1086 importScript("ExtensionView.js"); 1087 importScript("ExtensionView.js");
OLDNEW
« no previous file with comments | « Source/devtools/front_end/elements/MetricsSidebarPane.js ('k') | Source/devtools/front_end/host/InspectorFrontendHost.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698