blob: 6e4c97aacb8f1a2bc1d178c75ab9c1417cbef476 [file] [log] [blame]
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/**
* @typedef {{path: string,
* pathDisplayText: string}}
*/
let CrostiniSharedPath;
/**
* @fileoverview A helper object used by the "Linux Apps" (Crostini) section
* to install and uninstall Crostini.
*/
cr.define('settings', function() {
/** @interface */
class CrostiniBrowserProxy {
/* Show crostini installer. */
requestCrostiniInstallerView() {}
/* Show remove crostini dialog. */
requestRemoveCrostini() {}
/**
* @param {!Array<string>} paths Paths to sanitze.
* @return {!Promise<!Array<string>>} Text to display in UI.
*/
getCrostiniSharedPathsDisplayText(paths) {}
/** @param {string} path Path to stop sharing. */
removeCrostiniSharedPath(path) {}
/* Export crostini container. */
exportCrostiniContainer() {}
/* Import crostini container. */
importCrostiniContainer() {}
}
/** @implements {settings.CrostiniBrowserProxy} */
class CrostiniBrowserProxyImpl {
/** @override */
requestCrostiniInstallerView() {
chrome.send('requestCrostiniInstallerView');
}
/** @override */
requestRemoveCrostini() {
chrome.send('requestRemoveCrostini');
}
/** @override */
getCrostiniSharedPathsDisplayText(paths) {
return cr.sendWithPromise('getCrostiniSharedPathsDisplayText', paths);
}
/** @override */
removeCrostiniSharedPath(path) {
chrome.send('removeCrostiniSharedPath', [path]);
}
/** @override */
exportCrostiniContainer() {
chrome.send('exportCrostiniContainer');
}
/** @override */
importCrostiniContainer() {
chrome.send('importCrostiniContainer');
}
}
// The singleton instance_ can be replaced with a test version of this wrapper
// during testing.
cr.addSingletonGetter(CrostiniBrowserProxyImpl);
return {
CrostiniBrowserProxy: CrostiniBrowserProxy,
CrostiniBrowserProxyImpl: CrostiniBrowserProxyImpl,
};
});