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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js

Issue 2536273003: [DevTools] Remove Workspace.projectTypes enum part1. (Closed)
Patch Set: Created 4 years 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) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 return uiSourceCode.contentType().canonicalMimeType(); 154 return uiSourceCode.contentType().canonicalMimeType();
155 155
156 var resource = uiSourceCode[Bindings.NetworkProject._resourceSymbol]; 156 var resource = uiSourceCode[Bindings.NetworkProject._resourceSymbol];
157 if (resource) 157 if (resource)
158 return resource.mimeType; 158 return resource.mimeType;
159 var mimeType = Common.ResourceType.mimeFromURL(uiSourceCode.url()); 159 var mimeType = Common.ResourceType.mimeFromURL(uiSourceCode.url());
160 return mimeType || uiSourceCode.contentType().canonicalMimeType(); 160 return mimeType || uiSourceCode.contentType().canonicalMimeType();
161 } 161 }
162 162
163 /** 163 /**
164 * @param {!Workspace.Workspace} workspace
165 * @return {!Array<!Workspace.UISourceCode>}
166 */
167 static uiSourceCodes(workspace) {
168 return workspace.uiSourceCodesForProjectType(Workspace.projectTypes.Network)
169 .concat(workspace.uiSourceCodesForProjectType(Workspace.projectTypes.Con tentScripts));
170 }
171
172 /**
173 * @param {!Workspace.UISourceCode} uiSourceCode
174 * @return {boolean}
175 */
176 static isContentScriptUISourceCode(uiSourceCode) {
177 return uiSourceCode.project().type() === Workspace.projectTypes.ContentScrip ts;
178 }
179
180 /**
181 * @param {!Workspace.UISourceCode} uiSourceCode
182 * @return {boolean}
183 */
184 static isNetworkUISourceCode(uiSourceCode) {
185 return uiSourceCode.project().type() === Workspace.projectTypes.ContentScrip ts ||
186 uiSourceCode.project().type() === Workspace.projectTypes.Network;
187 }
188
189 /**
164 * @param {?SDK.ResourceTreeFrame} frame 190 * @param {?SDK.ResourceTreeFrame} frame
165 * @param {boolean} isContentScripts 191 * @param {boolean} isContentScripts
166 * @return {!Bindings.ContentProviderBasedProject} 192 * @return {!Bindings.ContentProviderBasedProject}
167 */ 193 */
168 _workspaceProject(frame, isContentScripts) { 194 _workspaceProject(frame, isContentScripts) {
169 var projectId = Bindings.NetworkProject.projectId(this.target(), frame, isCo ntentScripts); 195 var projectId = Bindings.NetworkProject.projectId(this.target(), frame, isCo ntentScripts);
170 var projectType = isContentScripts ? Workspace.projectTypes.ContentScripts : Workspace.projectTypes.Network; 196 var projectType = isContentScripts ? Workspace.projectTypes.ContentScripts : Workspace.projectTypes.Network;
171 197
172 var project = this._workspaceProjects.get(projectId); 198 var project = this._workspaceProjects.get(projectId);
173 if (project) 199 if (project)
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 return workspace.uiSourceCode(Bindings.NetworkProject.projectId(header.targe t(), frame, false), url); 431 return workspace.uiSourceCode(Bindings.NetworkProject.projectId(header.targe t(), frame, false), url);
406 } 432 }
407 }; 433 };
408 434
409 Bindings.NetworkProject._networkProjectSymbol = Symbol('networkProject'); 435 Bindings.NetworkProject._networkProjectSymbol = Symbol('networkProject');
410 Bindings.NetworkProject._resourceSymbol = Symbol('resource'); 436 Bindings.NetworkProject._resourceSymbol = Symbol('resource');
411 Bindings.NetworkProject._scriptSymbol = Symbol('script'); 437 Bindings.NetworkProject._scriptSymbol = Symbol('script');
412 Bindings.NetworkProject._styleSheetSymbol = Symbol('styleSheet'); 438 Bindings.NetworkProject._styleSheetSymbol = Symbol('styleSheet');
413 Bindings.NetworkProject._targetSymbol = Symbol('target'); 439 Bindings.NetworkProject._targetSymbol = Symbol('target');
414 Bindings.NetworkProject._frameSymbol = Symbol('frame'); 440 Bindings.NetworkProject._frameSymbol = Symbol('frame');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698