blob: d671051fc771d2983a5a026128612b60fee3550e [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.
/**
* @fileoverview
* 'crostini-subpage' is the settings subpage for managing Crostini.
*/
Polymer({
is: 'settings-crostini-subpage',
behaviors: [PrefsBehavior],
properties: {
/** Preferences state. */
prefs: {
type: Object,
notify: true,
},
/**
* Whether CrostiniUsbSupport flag is enabled.
* @private {boolean}
*/
enableCrostiniUsbDeviceSupport_: {
type: Boolean,
value: function() {
return loadTimeData.getBoolean('enableCrostiniUsbDeviceSupport');
},
},
/**
* Whether export / import UI should be displayed.
* @private {boolean}
*/
showCrostiniExportImport_: {
type: Boolean,
value: function() {
return loadTimeData.getBoolean('showCrostiniExportImport');
},
},
},
observers: ['onCrostiniEnabledChanged_(prefs.crostini.enabled.value)'],
/** @private */
onCrostiniEnabledChanged_: function(enabled) {
if (!enabled &&
settings.getCurrentRoute() == settings.routes.CROSTINI_DETAILS) {
settings.navigateToPreviousRoute();
}
},
/**
* Shows a confirmation dialog when removing crostini.
* @param {!Event} event
* @private
*/
onRemoveTap_: function(event) {
settings.CrostiniBrowserProxyImpl.getInstance().requestRemoveCrostini();
},
/** @private */
onSharedPathsTap_: function(event) {
settings.navigateTo(settings.routes.CROSTINI_SHARED_PATHS);
},
/** @private */
onExportClick_: function(event) {
settings.CrostiniBrowserProxyImpl.getInstance().exportCrostiniContainer();
},
/** @private */
onImportClick_: function(event) {
settings.CrostiniBrowserProxyImpl.getInstance().importCrostiniContainer();
},
/** @private */
onSharedUsbDevicesTap_: function(event) {
settings.navigateTo(settings.routes.CROSTINI_SHARED_USB_DEVICES);
},
});