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

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

Issue 2782773002: [DevTools] Remove SDKModels' fromTarget methods (Closed)
Patch Set: addressed review comments Created 3 years, 8 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) 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 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 * @this {Extensions.ExtensionServer} 474 * @this {Extensions.ExtensionServer}
475 */ 475 */
476 function pushResourceData(contentProvider) { 476 function pushResourceData(contentProvider) {
477 if (!resources.has(contentProvider.contentURL())) 477 if (!resources.has(contentProvider.contentURL()))
478 resources.set(contentProvider.contentURL(), this._makeResource(contentPr ovider)); 478 resources.set(contentProvider.contentURL(), this._makeResource(contentPr ovider));
479 } 479 }
480 var uiSourceCodes = Workspace.workspace.uiSourceCodesForProjectType(Workspac e.projectTypes.Network); 480 var uiSourceCodes = Workspace.workspace.uiSourceCodesForProjectType(Workspac e.projectTypes.Network);
481 uiSourceCodes = 481 uiSourceCodes =
482 uiSourceCodes.concat(Workspace.workspace.uiSourceCodesForProjectType(Wor kspace.projectTypes.ContentScripts)); 482 uiSourceCodes.concat(Workspace.workspace.uiSourceCodesForProjectType(Wor kspace.projectTypes.ContentScripts));
483 uiSourceCodes.forEach(pushResourceData.bind(this)); 483 uiSourceCodes.forEach(pushResourceData.bind(this));
484 for (var target of SDK.targetManager.targets(SDK.Target.Capability.DOM)) 484 for (var resourceTreeModel of SDK.targetManager.models(SDK.ResourceTreeModel ))
485 SDK.ResourceTreeModel.fromTarget(target).forAllResources(pushResourceData. bind(this)); 485 resourceTreeModel.forAllResources(pushResourceData.bind(this));
486 return resources.valuesArray(); 486 return resources.valuesArray();
487 } 487 }
488 488
489 /** 489 /**
490 * @param {!Common.ContentProvider} contentProvider 490 * @param {!Common.ContentProvider} contentProvider
491 * @param {!Object} message 491 * @param {!Object} message
492 * @param {!MessagePort} port 492 * @param {!MessagePort} port
493 */ 493 */
494 _getResourceContent(contentProvider, message, port) { 494 _getResourceContent(contentProvider, message, port) {
495 /** 495 /**
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
908 SDK.ResourceTreeModel.frames().some(hasMatchingURL); 908 SDK.ResourceTreeModel.frames().some(hasMatchingURL);
909 return found; 909 return found;
910 } 910 }
911 911
912 options = options || {}; 912 options = options || {};
913 var frame; 913 var frame;
914 if (options.frameURL) { 914 if (options.frameURL) {
915 frame = resolveURLToFrame(options.frameURL); 915 frame = resolveURLToFrame(options.frameURL);
916 } else { 916 } else {
917 var target = SDK.targetManager.mainTarget(); 917 var target = SDK.targetManager.mainTarget();
918 var resourceTreeModel = target && SDK.ResourceTreeModel.fromTarget(target) ; 918 var resourceTreeModel = target && target.model(SDK.ResourceTreeModel);
919 frame = resourceTreeModel && resourceTreeModel.mainFrame; 919 frame = resourceTreeModel && resourceTreeModel.mainFrame;
920 } 920 }
921 if (!frame) { 921 if (!frame) {
922 if (options.frameURL) 922 if (options.frameURL)
923 console.warn('evaluate: there is no frame with URL ' + options.frameURL) ; 923 console.warn('evaluate: there is no frame with URL ' + options.frameURL) ;
924 else 924 else
925 console.warn('evaluate: the main frame is not yet available'); 925 console.warn('evaluate: the main frame is not yet available');
926 return this._status.E_NOTFOUND(options.frameURL || '<top>'); 926 return this._status.E_NOTFOUND(options.frameURL || '<top>');
927 } 927 }
928 928
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 /** 1045 /**
1046 * @typedef {{code: string, description: string, details: !Array.<*>}} 1046 * @typedef {{code: string, description: string, details: !Array.<*>}}
1047 */ 1047 */
1048 Extensions.ExtensionStatus.Record; 1048 Extensions.ExtensionStatus.Record;
1049 1049
1050 Extensions.extensionAPI = {}; 1050 Extensions.extensionAPI = {};
1051 defineCommonExtensionSymbols(Extensions.extensionAPI); 1051 defineCommonExtensionSymbols(Extensions.extensionAPI);
1052 1052
1053 /** @type {!Extensions.ExtensionServer} */ 1053 /** @type {!Extensions.ExtensionServer} */
1054 Extensions.extensionServer; 1054 Extensions.extensionServer;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698