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

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

Issue 2122353002: [DevTools] Make resource tree model optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments Created 4 years, 3 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 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 * @this {WebInspector.ExtensionServer} 491 * @this {WebInspector.ExtensionServer}
492 */ 492 */
493 function pushResourceData(contentProvider) 493 function pushResourceData(contentProvider)
494 { 494 {
495 if (!resources.has(contentProvider.contentURL())) 495 if (!resources.has(contentProvider.contentURL()))
496 resources.set(contentProvider.contentURL(), this._makeResource(c ontentProvider)); 496 resources.set(contentProvider.contentURL(), this._makeResource(c ontentProvider));
497 } 497 }
498 var uiSourceCodes = WebInspector.workspace.uiSourceCodesForProjectType(W ebInspector.projectTypes.Network); 498 var uiSourceCodes = WebInspector.workspace.uiSourceCodesForProjectType(W ebInspector.projectTypes.Network);
499 uiSourceCodes = uiSourceCodes.concat(WebInspector.workspace.uiSourceCode sForProjectType(WebInspector.projectTypes.ContentScripts)); 499 uiSourceCodes = uiSourceCodes.concat(WebInspector.workspace.uiSourceCode sForProjectType(WebInspector.projectTypes.ContentScripts));
500 uiSourceCodes.forEach(pushResourceData.bind(this)); 500 uiSourceCodes.forEach(pushResourceData.bind(this));
501 for (var target of WebInspector.targetManager.targets()) 501 for (var target of WebInspector.targetManager.targets(WebInspector.Targe t.Capability.DOM))
502 target.resourceTreeModel.forAllResources(pushResourceData.bind(this) ); 502 WebInspector.ResourceTreeModel.fromTarget(target).forAllResources(pu shResourceData.bind(this));
503 return resources.valuesArray(); 503 return resources.valuesArray();
504 }, 504 },
505 505
506 /** 506 /**
507 * @param {!WebInspector.ContentProvider} contentProvider 507 * @param {!WebInspector.ContentProvider} contentProvider
508 * @param {!Object} message 508 * @param {!Object} message
509 * @param {!MessagePort} port 509 * @param {!MessagePort} port
510 */ 510 */
511 _getResourceContent: function(contentProvider, message, port) 511 _getResourceContent: function(contentProvider, message, port)
512 { 512 {
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
936 function hasMatchingURL(frame) 936 function hasMatchingURL(frame)
937 { 937 {
938 found = (frame.url === url) ? frame : null; 938 found = (frame.url === url) ? frame : null;
939 return found; 939 return found;
940 } 940 }
941 WebInspector.ResourceTreeModel.frames().some(hasMatchingURL); 941 WebInspector.ResourceTreeModel.frames().some(hasMatchingURL);
942 return found; 942 return found;
943 } 943 }
944 944
945 if (typeof options === "object") { 945 if (typeof options === "object") {
946 var frame = options.frameURL ? resolveURLToFrame(options.frameURL) : WebInspector.targetManager.mainTarget().resourceTreeModel.mainFrame; 946 var frame;
947 if (options.frameURL) {
948 frame = resolveURLToFrame(options.frameURL);
949 } else {
950 var target = WebInspector.targetManager.mainTarget();
951 var resourceTreeModel = target && WebInspector.ResourceTreeModel .fromTarget(target);
952 frame = resourceTreeModel && resourceTreeModel.mainFrame;
953 }
947 if (!frame) { 954 if (!frame) {
948 if (options.frameURL) 955 if (options.frameURL)
949 console.warn("evaluate: there is no frame with URL " + optio ns.frameURL); 956 console.warn("evaluate: there is no frame with URL " + optio ns.frameURL);
950 else 957 else
951 console.warn("evaluate: the main frame is not yet available" ); 958 console.warn("evaluate: the main frame is not yet available" );
952 return this._status.E_NOTFOUND(options.frameURL || "<top>"); 959 return this._status.E_NOTFOUND(options.frameURL || "<top>");
953 } 960 }
954 961
955 var contextSecurityOrigin; 962 var contextSecurityOrigin;
956 if (options.useContentScriptContext) 963 if (options.useContentScriptContext)
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 /** 1092 /**
1086 * @typedef {{code: string, description: string, details: !Array.<*>}} 1093 * @typedef {{code: string, description: string, details: !Array.<*>}}
1087 */ 1094 */
1088 WebInspector.ExtensionStatus.Record; 1095 WebInspector.ExtensionStatus.Record;
1089 1096
1090 WebInspector.extensionAPI = {}; 1097 WebInspector.extensionAPI = {};
1091 defineCommonExtensionSymbols(WebInspector.extensionAPI); 1098 defineCommonExtensionSymbols(WebInspector.extensionAPI);
1092 1099
1093 /** @type {!WebInspector.ExtensionServer} */ 1100 /** @type {!WebInspector.ExtensionServer} */
1094 WebInspector.extensionServer; 1101 WebInspector.extensionServer;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698