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

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

Issue 2137773002: [DevTools] Replace the target type with capabilities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/main/Main.js
diff --git a/third_party/WebKit/Source/devtools/front_end/main/Main.js b/third_party/WebKit/Source/devtools/front_end/main/Main.js
index bddafee38a9afece34dcdc045d3f2a3f18e13031..aa2042a304c877ba46ae61edfa01441cf45bb860 100644
--- a/third_party/WebKit/Source/devtools/front_end/main/Main.js
+++ b/third_party/WebKit/Source/devtools/front_end/main/Main.js
@@ -309,13 +309,13 @@ WebInspector.Main.prototype = {
WebInspector.RemoteDebuggingTerminatedScreen.show(event.data.reason);
}
- var targetType = WebInspector.Target.Type.Page;
+ var capabilities = WebInspector.Target.Capability.Browser | WebInspector.Target.Capability.JS | WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker;
if (Runtime.queryParam("isSharedWorker"))
- targetType = WebInspector.Target.Type.ServiceWorker;
+ capabilities = WebInspector.Target.Capability.Network | WebInspector.Target.Capability.Worker;
else if (Runtime.queryParam("v8only"))
- targetType = WebInspector.Target.Type.JSInspector;
+ capabilities = WebInspector.Target.Capability.JS;
- this._mainTarget = WebInspector.targetManager.createTarget(WebInspector.UIString("Main"), targetType, connection, null);
+ this._mainTarget = WebInspector.targetManager.createTarget(WebInspector.UIString("Main"), capabilities, connection, null);
console.timeStamp("Main._mainTargetCreated");
this._registerShortcuts();
@@ -323,8 +323,7 @@ WebInspector.Main.prototype = {
InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.ReloadInspectedPage, this._reloadInspectedPage, this);
InspectorFrontendHost.events.addEventListener(InspectorFrontendHostAPI.Events.EvaluateForTestInFrontend, this._evaluateForTestInFrontend, this);
- if (this._mainTarget.isServiceWorker() || this._mainTarget.isPage() || this._mainTarget.isJSInspector())
- this._mainTarget.runtimeAgent().run();
+ this._mainTarget.runtimeAgent().run();
this._mainTarget.inspectorAgent().enable();
InspectorFrontendHost.readyForTest();
@@ -694,26 +693,9 @@ WebInspector.Main.SearchActionDelegate.prototype = {
*/
WebInspector.Main._reloadPage = function(hard)
{
- if (!WebInspector.targetManager.hasTargets())
- return;
- if (WebInspector.targetManager.mainTarget().isServiceWorker())
- return;
- WebInspector.targetManager.reloadPage(hard);
-}
-
-/**
- * @param {string} ws
- */
-WebInspector.Main._addWebSocketTarget = function(ws)
-{
- /**
- * @param {!InspectorBackendClass.Connection} connection
- */
- function callback(connection)
- {
- WebInspector.targetManager.createTarget(ws, WebInspector.Target.Type.Page, connection, null);
- }
- new WebInspector.WebSocketConnection(ws, callback);
+ var mainTarget = WebInspector.targetManager.mainTarget();
+ if (mainTarget && mainTarget.hasBrowserCapability())
+ WebInspector.targetManager.reloadPage(hard);
}
/**
@@ -1056,7 +1038,7 @@ WebInspector.BackendSettingsSync = function()
this._disableJavascriptSetting.addChangeListener(this._update, this);
this._blockedEventsWarningSetting = WebInspector.settings.moduleSetting("blockedEventsWarningEnabled");
this._blockedEventsWarningSetting.addChangeListener(this._update, this);
- WebInspector.targetManager.observeTargets(this, WebInspector.Target.Type.Page);
+ WebInspector.targetManager.observeTargets(this, WebInspector.Target.Capability.Browser);
}
WebInspector.BackendSettingsSync.prototype = {
@@ -1073,7 +1055,7 @@ WebInspector.BackendSettingsSync.prototype = {
_update: function()
{
- WebInspector.targetManager.targets(WebInspector.Target.Type.Page).forEach(this._updateTarget, this);
+ WebInspector.targetManager.targets(WebInspector.Target.Capability.Browser).forEach(this._updateTarget, this);
},
/**

Powered by Google App Engine
This is Rietveld 408576698