Commit c4152f16 authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

FilesApp: show toast after sharing folder with crostini

Bug: 878324
Change-Id: I2f1448019648c70329d991485b31b7e0ccc4bde1
Reviewed-on: https://chromium-review.googlesource.com/c/1337147Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608628}
parent 1f068a7d
...@@ -1075,6 +1075,9 @@ ...@@ -1075,6 +1075,9 @@
<message name="IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_CROSTINI_DRIVE" desc="Confirmation message shown when a user shares the root of a Drive volume (My Drive, Team Drives, Computers) with the crostini container."> <message name="IDS_FILE_BROWSER_SHARE_ROOT_FOLDER_WITH_CROSTINI_DRIVE" desc="Confirmation message shown when a user shares the root of a Drive volume (My Drive, Team Drives, Computers) with the crostini container.">
Give Linux apps permission to open files in your Google Drive. Changes will sync to your other devices. Give Linux apps permission to open files in your Google Drive. Changes will sync to your other devices.
</message> </message>
<message name="IDS_FILE_BROWSER_FOLDER_SHARED_WITH_CROSTINI" desc="Confirmation message shown when a user shares a folder with the crostini container.">
1 folder shared with Linux
</message>
<message name="IDS_FILE_BROWSER_FOLDER" desc="Folder entry type"> <message name="IDS_FILE_BROWSER_FOLDER" desc="Folder entry type">
Folder Folder
......
fe3c3326cd686cf6006b175754c2716ba62750f6
\ No newline at end of file
...@@ -533,6 +533,8 @@ ExtensionFunction::ResponseAction FileManagerPrivateGetStringsFunction::Run() { ...@@ -533,6 +533,8 @@ ExtensionFunction::ResponseAction FileManagerPrivateGetStringsFunction::Run() {
SET_STRING("FAILED_SPACE_INFO", IDS_FILE_BROWSER_FAILED_SPACE_INFO); SET_STRING("FAILED_SPACE_INFO", IDS_FILE_BROWSER_FAILED_SPACE_INFO);
SET_STRING("FILENAME_LABEL", IDS_FILE_BROWSER_FILENAME_LABEL); SET_STRING("FILENAME_LABEL", IDS_FILE_BROWSER_FILENAME_LABEL);
SET_STRING("FILE_ALREADY_EXISTS", IDS_FILE_BROWSER_FILE_ALREADY_EXISTS); SET_STRING("FILE_ALREADY_EXISTS", IDS_FILE_BROWSER_FILE_ALREADY_EXISTS);
SET_STRING("FOLDER_SHARED_WITH_CROSTINI",
IDS_FILE_BROWSER_FOLDER_SHARED_WITH_CROSTINI);
SET_STRING("FORMATTING_FINISHED_FAILURE_MESSAGE", SET_STRING("FORMATTING_FINISHED_FAILURE_MESSAGE",
IDS_FORMATTING_FINISHED_FAILURE_MESSAGE); IDS_FORMATTING_FINISHED_FAILURE_MESSAGE);
SET_STRING("FORMATTING_FINISHED_SUCCESS_MESSAGE", SET_STRING("FORMATTING_FINISHED_SUCCESS_MESSAGE",
......
...@@ -21719,7 +21719,8 @@ Called by update_net_error_codes.py.--> ...@@ -21719,7 +21719,8 @@ Called by update_net_error_codes.py.-->
<int value="10" label="Toggle show hidden Android folders (on)"/> <int value="10" label="Toggle show hidden Android folders (on)"/>
<int value="11" label="Toggle show hidden Android folders (off)"/> <int value="11" label="Toggle show hidden Android folders (off)"/>
<int value="12" label="Share with Linux"/> <int value="12" label="Share with Linux"/>
<int value="13" label="Manage Linux sharing"/> <int value="13" label="Manage Linux sharing menu"/>
<int value="14" label="Manage Linux sharing toast"/>
</enum> </enum>
<enum name="FileManagerQuickViewWayToOpen"> <enum name="FileManagerQuickViewWayToOpen">
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
<link rel="import" href="chrome://resources/polymer/v1_0/paper-progress/paper-progress.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-progress/paper-progress.html">
<link rel="import" href="chrome://resources/polymer/v1_0/paper-ripple/paper-ripple.html"> <link rel="import" href="chrome://resources/polymer/v1_0/paper-ripple/paper-ripple.html">
<link rel="import" href="files_ripple.html"> <link rel="import" href="files_ripple.html">
<link rel="import" href="files_toast.html">
<link rel="import" href="files_toggle_ripple.html"> <link rel="import" href="files_toggle_ripple.html">
<link rel="import" href="files_tooltip.html"> <link rel="import" href="files_tooltip.html">
<link rel="import" href="icons.html"> <link rel="import" href="icons.html">
...@@ -396,6 +396,7 @@ CommandHandler.MenuCommandsForUMA = { ...@@ -396,6 +396,7 @@ CommandHandler.MenuCommandsForUMA = {
HIDDEN_ANDROID_FOLDERS_HIDE: 'toggle-hidden-android-folders-off', HIDDEN_ANDROID_FOLDERS_HIDE: 'toggle-hidden-android-folders-off',
SHARE_WITH_LINUX: 'share-with-linux', SHARE_WITH_LINUX: 'share-with-linux',
MANAGE_LINUX_SHARING: 'manage-linux-sharing', MANAGE_LINUX_SHARING: 'manage-linux-sharing',
MANAGE_LINUX_SHARING_TOAST: 'manage-linux-sharing-toast',
}; };
/** /**
...@@ -422,6 +423,7 @@ CommandHandler.ValidMenuCommandsForUMA = [ ...@@ -422,6 +423,7 @@ CommandHandler.ValidMenuCommandsForUMA = [
CommandHandler.MenuCommandsForUMA.HIDDEN_ANDROID_FOLDERS_HIDE, CommandHandler.MenuCommandsForUMA.HIDDEN_ANDROID_FOLDERS_HIDE,
CommandHandler.MenuCommandsForUMA.SHARE_WITH_LINUX, CommandHandler.MenuCommandsForUMA.SHARE_WITH_LINUX,
CommandHandler.MenuCommandsForUMA.MANAGE_LINUX_SHARING, CommandHandler.MenuCommandsForUMA.MANAGE_LINUX_SHARING,
CommandHandler.MenuCommandsForUMA.MANAGE_LINUX_SHARING_TOAST,
]; ];
console.assert( console.assert(
Object.keys(CommandHandler.MenuCommandsForUMA).length === Object.keys(CommandHandler.MenuCommandsForUMA).length ===
...@@ -1660,6 +1662,17 @@ CommandHandler.COMMANDS_['share-with-linux'] = /** @type {Command} */ ({ ...@@ -1660,6 +1662,17 @@ CommandHandler.COMMANDS_['share-with-linux'] = /** @type {Command} */ ({
chrome.runtime.lastError.message); chrome.runtime.lastError.message);
} else { } else {
fileManager.crostini.registerSharedPath(dir); fileManager.crostini.registerSharedPath(dir);
// Show toast with link to manage sharing.
fileManager.ui.toast.show(str('FOLDER_SHARED_WITH_CROSTINI'), {
text: str('MANAGE_LINUX_SHARING_BUTTON_LABEL'),
callback: () => {
chrome.fileManagerPrivate.openSettingsSubpage(
'crostini/sharedPaths');
CommandHandler.recordMenuItemSelected_(
CommandHandler.MenuCommandsForUMA
.MANAGE_LINUX_SHARING_TOAST);
}
});
} }
}); });
} }
......
...@@ -237,11 +237,12 @@ js_library("file_manager_ui") { ...@@ -237,11 +237,12 @@ js_library("file_manager_ui") {
":providers_menu", ":providers_menu",
":search_box", ":search_box",
":suggest_apps_dialog", ":suggest_apps_dialog",
"..:launch_param", "//ui/file_manager/file_manager/common/js:util",
"..:providers_model", "//ui/file_manager/file_manager/foreground/elements:files_toast",
"../../../common/js:util", "//ui/file_manager/file_manager/foreground/elements:files_toggle_ripple",
"../../elements:files_toggle_ripple", "//ui/file_manager/file_manager/foreground/elements:files_tooltip",
"../../elements:files_tooltip", "//ui/file_manager/file_manager/foreground/js:launch_param",
"//ui/file_manager/file_manager/foreground/js:providers_model",
"//ui/webui/resources/js:i18n_template_no_process", "//ui/webui/resources/js:i18n_template_no_process",
"//ui/webui/resources/js:util", "//ui/webui/resources/js:util",
"//ui/webui/resources/js/cr/ui:context_menu_button", "//ui/webui/resources/js/cr/ui:context_menu_button",
......
...@@ -347,6 +347,13 @@ function FileManagerUI(providersModel, element, launchParam) { ...@@ -347,6 +347,13 @@ function FileManagerUI(providersModel, element, launchParam) {
*/ */
this.actionsSubmenu = new ActionsSubmenu(this.fileContextMenu); this.actionsSubmenu = new ActionsSubmenu(this.fileContextMenu);
/**
* @type {!FilesToast}
* @const
*/
this.toast =
/** @type {!FilesToast} */ (document.querySelector('files-toast'));
// Initialize attributes. // Initialize attributes.
this.element.setAttribute('type', this.dialogType_); this.element.setAttribute('type', this.dialogType_);
......
...@@ -546,5 +546,6 @@ ...@@ -546,5 +546,6 @@
</files-quick-view> </files-quick-view>
<iframe id="command-dispatcher" hidden aria-hidden="true"></iframe> <iframe id="command-dispatcher" hidden aria-hidden="true"></iframe>
<div id="drop-label"></div> <div id="drop-label"></div>
<files-toast id="toast"></files-toast>
</body> </body>
</html> </html>
...@@ -53,6 +53,15 @@ crostiniShare.testSharePathsCrostiniSuccess = (done) => { ...@@ -53,6 +53,15 @@ crostiniShare.testSharePathsCrostiniSuccess = (done) => {
}); });
}) })
.then(() => { .then(() => {
// Check toast is shown.
return test.repeatUntil(() => {
return document.querySelector('#toast').shadowRoot.querySelector(
'#container:not([hidden])') ||
test.pending('wait for toast');
});
})
.then(() => {
// Right-click 'photos' directory. // Right-click 'photos' directory.
// Check 'Share with Linux' is not shown in menu. // Check 'Share with Linux' is not shown in menu.
assertTrue(test.fakeMouseRightClick(photos), 'right-click photos'); assertTrue(test.fakeMouseRightClick(photos), 'right-click photos');
......
...@@ -198,6 +198,7 @@ for filename, substitutions in ( ...@@ -198,6 +198,7 @@ for filename, substitutions in (
)), )),
('foreground/elements/elements_bundle.html', ( ('foreground/elements/elements_bundle.html', (
('="files_ripple', elements_path('files_ripple')), ('="files_ripple', elements_path('files_ripple')),
('="files_toast', elements_path('files_toast')),
('="files_toggle_ripple', elements_path('files_toggle_ripple')), ('="files_toggle_ripple', elements_path('files_toggle_ripple')),
('="files_tooltip', elements_path('files_tooltip')), ('="files_tooltip', elements_path('files_tooltip')),
('="icons', elements_path('icons')), ('="icons', elements_path('icons')),
......
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