Commit 54e85384 authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Support Arc, crostini, and Plugin VM in drag drop FileHelper

The current code in FileHelper assumes all windows are Arc. We now
check the source and target aura::Window to detect and do the
appropriate path translations and share files when necessary with
crostini/pluginvm.

For example, when crostini is the drag source, we will convert paths
such as:

 <homedir>/file => /media/fuse/crostini_<hash>_termina_penguin/file

And do the opposite translation when crostini is the drop target.

We also convert paths and share files such as:

 <cryptohome>/MyFiles/file => /mnt/chromeos/MyFiles/file
 /media/removable/MyUSB => /mnt/chromeos/removable/MyUSB

For PluginVM, the translation is

 <cryptohome>/MyFiles/file => //ChromeOS/MyFiles/file
 /media/removable/MyUSB => //ChromeOS/removable/MyUSB

Bug: 1144138
Change-Id: I2bb38336537acf13c4797374d6dabe6e518d689e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2517346
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Reviewed-by: default avatarJason Lin <lxj@google.com>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#827956}
parent 79e7d157
......@@ -6,6 +6,7 @@
#include <utility>
#include "ash/public/cpp/app_types.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/callback_helpers.h"
......@@ -44,6 +45,7 @@
#include "components/prefs/pref_service.h"
#include "components/user_manager/user.h"
#include "google_apis/gaia/gaia_auth_util.h"
#include "ui/aura/client/aura_constants.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/time_format.h"
......@@ -574,4 +576,10 @@ const ContainerId& DefaultContainerId() {
kCrostiniDefaultVmName, kCrostiniDefaultContainerName);
return *container_id;
}
bool IsCrostiniWindow(aura::Window* window) {
return window->GetProperty(aura::client::kAppType) ==
static_cast<int>(ash::AppType::CROSTINI_APP);
}
} // namespace crostini
......@@ -18,6 +18,10 @@
#include "storage/browser/file_system/file_system_url.h"
#include "third_party/abseil-cpp/absl/types/variant.h"
namespace aura {
class Window;
} // namespace aura
namespace base {
class FilePath;
} // namespace base
......@@ -205,6 +209,8 @@ void UpdateContainerPref(Profile* profile,
const ContainerId& DefaultContainerId();
bool IsCrostiniWindow(aura::Window* window);
} // namespace crostini
#endif // CHROME_BROWSER_CHROMEOS_CROSTINI_CROSTINI_UTIL_H_
This diff is collapsed.
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