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

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/Linkifier.js

Issue 2536273003: [DevTools] Remove Workspace.projectTypes enum part1. (Closed)
Patch Set: Created 4 years, 1 month 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/components/Linkifier.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js b/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
index 4492683065af9679dd8f7483e0cbc0f16ae151e7..cce18aeadd19f19ed6a8ed83872981c0eb832c42 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
@@ -738,44 +738,31 @@ Components.Linkifier.ContentProviderContextMenuProvider = class {
if (contentProvider instanceof SDK.NetworkRequest)
return;
- contextMenu.appendItem(
- UI.copyLinkAddressLabel(), () => InspectorFrontendHost.copyText(contentProvider.contentURL()));
- if (!contentProvider.contentType().isDocumentOrScriptOrStyleSheet())
+ if (contentProvider instanceof SDK.Resource) {
+ contextMenu.appendSeparator();
+ contextMenu.appendItem(Common.UIString('Save'), () => {
lushnikov 2016/11/30 02:51:36 Save as...
+ contentProvider.requestContent().then((content) => {
lushnikov 2016/11/30 02:51:36 let's pull this out as a function
+ var url = contentProvider.contentURL();
+ Workspace.fileManager.save(url, /** @type {string} */ (content), false);
+ Workspace.fileManager.close(url);
+ });
+ });
return;
-
- /**
- * @param {boolean} forceSaveAs
- * @param {?string} content
- */
- function doSave(forceSaveAs, content) {
- var url = contentProvider.contentURL();
- Workspace.fileManager.save(url, /** @type {string} */ (content), forceSaveAs);
- Workspace.fileManager.close(url);
}
- /**
- * @param {boolean} forceSaveAs
- */
- function save(forceSaveAs) {
- if (contentProvider instanceof Workspace.UISourceCode) {
- var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (contentProvider);
- if (forceSaveAs)
- uiSourceCode.saveAs();
- else
- uiSourceCode.commitWorkingCopy();
- return;
- }
- contentProvider.requestContent().then(doSave.bind(null, forceSaveAs));
- }
+ var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (contentProvider);
lushnikov 2016/11/30 02:51:36 let's assert!
+ contextMenu.appendItem(UI.copyLinkAddressLabel(), () => InspectorFrontendHost.copyText(uiSourceCode.contentURL()));
lushnikov 2016/11/30 02:51:36 move this and one below to the top
+ if (!uiSourceCode.contentType().isDocumentOrScriptOrStyleSheet())
+ return;
contextMenu.appendSeparator();
- contextMenu.appendItem(Common.UIString('Save'), save.bind(null, false));
-
- if (contentProvider instanceof Workspace.UISourceCode) {
- var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (contentProvider);
- if (uiSourceCode.project().type() !== Workspace.projectTypes.FileSystem &&
- uiSourceCode.project().type() !== Workspace.projectTypes.Snippets)
- contextMenu.appendItem(Common.UIString.capitalize('Save ^as...'), save.bind(null, true));
+ contextMenu.appendItem(Common.UIString('Save'), () => {
+ uiSourceCode.commitWorkingCopy();
lushnikov 2016/11/30 02:51:36 nit: oneliner possible
+ });
+ if (!uiSourceCode.project().canSetFileContent()) {
+ contextMenu.appendItem(Common.UIString.capitalize('Save ^as...'), () => {
+ uiSourceCode.saveAs();
lushnikov 2016/11/30 02:51:36 nit: oneliner possible
+ });
}
}
};

Powered by Google App Engine
This is Rietveld 408576698