Commit 1f6710e7 authored by Zain Afzal's avatar Zain Afzal Committed by Commit Bot

Removed legacy save-copy delegate function

crrev/c/2316189 removed the need for a save copy delegate function by
adding the save as code path, to make sure TOT wasn't broken it left the
old save copy delegate function as is until the next version of the
media app was rolled in. crrev/c/2344327 should update the version of
media app so it no longer uses the "save copy" function and as such its
now safe to delete it.

Change-Id: I5f7a67ffec261a8d76c1c1e6e4ff2e82851f2743
BUG: b/161193454
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2344436Reviewed-by: default avatarPatti <patricialor@chromium.org>
Reviewed-by: default avatarTrent Apted <tapted@chromium.org>
Commit-Queue: Zain Afzal <zafzal@google.com>
Cr-Commit-Position: refs/heads/master@{#796302}
parent b73c258c
...@@ -184,17 +184,6 @@ guestMessagePipe.registerHandler(Message.REQUEST_SAVE_FILE, async (message) => { ...@@ -184,17 +184,6 @@ guestMessagePipe.registerHandler(Message.REQUEST_SAVE_FILE, async (message) => {
return response; return response;
}); });
guestMessagePipe.registerHandler(Message.SAVE_COPY, async (message) => {
const {blob, token} = /** @type {!SaveCopyMessage} */ (message);
const handle = tokenMap.get(token);
// Note `handle` could be the same as a `FileSystemFileHandle` that exists in
// `tokenMap`. Possibly even the `File` currently open. But that's OK. E.g.
// the next overwrite-file request will just invoke `saveBlobToFile` in the
// same way. Note there may be no currently writable file (e.g. save from
// clipboard).
await saveBlobToFile(handle, blob);
});
guestMessagePipe.registerHandler(Message.SAVE_AS, async (message) => { guestMessagePipe.registerHandler(Message.SAVE_AS, async (message) => {
const {blob, oldFileToken, pickedFileToken} = const {blob, oldFileToken, pickedFileToken} =
/** @type {!SaveAsMessage} */ (message); /** @type {!SaveAsMessage} */ (message);
......
...@@ -149,13 +149,6 @@ mediaApp.ClientApiDelegate.prototype.openFeedbackDialog = function() {}; ...@@ -149,13 +149,6 @@ mediaApp.ClientApiDelegate.prototype.openFeedbackDialog = function() {};
*/ */
mediaApp.ClientApiDelegate.prototype.requestSaveFile = function( mediaApp.ClientApiDelegate.prototype.requestSaveFile = function(
suggestedName, mimeType) {}; suggestedName, mimeType) {};
/**
* Saves a copy of `file` in the file specified by `token`.
* @param {!mediaApp.AbstractFile} file
* @param {number} token
* @return {!Promise<undefined>}
*/
mediaApp.ClientApiDelegate.prototype.saveCopy = function(file, token) {};
/** /**
* The client Api for interacting with the media app instance. * The client Api for interacting with the media app instance.
......
...@@ -131,15 +131,6 @@ let RequestSaveFileMessage; ...@@ -131,15 +131,6 @@ let RequestSaveFileMessage;
*/ */
let RequestSaveFileResponse; let RequestSaveFileResponse;
/**
* Message sent by the unprivileged context to the privileged context requesting
* for the provided file to be copied and saved in the location specified by
* `token`. This method can be called with any file, not just the currently
* writable file.
* @typedef {{blob: !Blob, token: number}}
*/
let SaveCopyMessage;
/** /**
* Message sent by the unprivileged context to the privileged context requesting * Message sent by the unprivileged context to the privileged context requesting
* for the provided blob to be saved in the location specified by * for the provided blob to be saved in the location specified by
......
...@@ -222,27 +222,7 @@ const DELEGATE = { ...@@ -222,27 +222,7 @@ const DELEGATE = {
await parentMessagePipe.sendMessage( await parentMessagePipe.sendMessage(
Message.REQUEST_SAVE_FILE, msg)); Message.REQUEST_SAVE_FILE, msg));
return response.token; return response.token;
}, }
/**
* @param {!mediaApp.AbstractFile} abstractFile
* @param {number} token
* @this {mediaApp.ClientApiDelegate}
* @return {!Promise<undefined>}
*/
async saveCopy(abstractFile, token) {
if (token === undefined) {
// The guest frame must be running an older version of backlight which is
// assuming the `saveCopy(abstractFile)` interface. Make the
// requestSaveFile call on its behalf for backwards compatibility.
// TODO(b/160938402): remove this.
token =
await this.requestSaveFile(abstractFile.name, abstractFile.mimeType);
}
/** @type {!SaveCopyMessage} */
const msg = {blob: abstractFile.blob, token};
await parentMessagePipe.sendMessage(Message.SAVE_COPY, msg);
},
}; };
/** /**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment