Commit 3b5e9a20 authored by Eric Willigers's avatar Eric Willigers Committed by Chromium LUCI CQ

Web Share for Chrome OS - Place shared files in MyFiles/.WebShare

We write files to MyFiles/.WebShare

Design doc:
https://docs.google.com/document/d/1EjpgseTbBhT9ogQv6HV6sLlBl4hpb2viOcmPtFJorMQ/edit?usp=sharing

The previous location used for Web Share files for Chrome OS worked
with Ozone (Chrome on Linux), but not on Chromebooks or VMs.


Bug: 1151773
Change-Id: Ia68f9e6c8c38fde50a278c9bec7b01eb8f8feb9f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2563011
Auto-Submit: Eric Willigers <ericwilligers@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Reviewed-by: default avatarJosh Simmons <simmonsjosh@google.com>
Reviewed-by: default avatarSergei Datsenko <dats@chromium.org>
Commit-Queue: Eric Willigers <ericwilligers@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834066}
parent 58c4e070
......@@ -13,6 +13,7 @@
#include "base/strings/string_piece.h"
#include "base/strings/stringprintf.h"
#include "chrome/browser/apps/app_service/intent_util.h"
#include "chrome/browser/chromeos/file_manager/path_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/sharesheet/sharesheet_service.h"
#include "chrome/browser/sharesheet/sharesheet_service_factory.h"
......@@ -20,7 +21,6 @@
#include "chrome/browser/webshare/chromeos/store_files_task.h"
#include "chrome/browser/webshare/share_service_impl.h"
#include "chrome/common/chrome_features.h"
#include "chromeos/dbus/cros_disks_client.h"
#include "components/services/app_service/public/cpp/intent_util.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_thread.h"
......@@ -33,7 +33,7 @@ using content::WebContents;
namespace {
constexpr base::FilePath::CharType kWebShareDirname[] =
FILE_PATH_LITERAL("WebShare");
FILE_PATH_LITERAL(".WebShare");
// We don't use |supplied_name| as it may contain special characters, and it may
// not be unique. The suffix has been checked by
......@@ -97,10 +97,14 @@ void SharesheetClient::Share(
return;
}
Profile* const profile =
Profile::FromBrowserContext(web_contents()->GetBrowserContext());
DCHECK(profile);
current_share_ = CurrentShare();
current_share_->files = std::move(files);
current_share_->directory =
chromeos::CrosDisksClient::GetArchiveMountPoint().Append(
file_manager::util::GetMyFilesFolderForProfile(profile).Append(
kWebShareDirname);
if (share_url.is_valid()) {
if (text.empty())
......
......@@ -14,6 +14,7 @@
#include "base/test/bind.h"
#include "base/test/scoped_feature_list.h"
#include "base/threading/scoped_blocking_call.h"
#include "chrome/browser/chromeos/file_manager/path_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_features.h"
......@@ -112,6 +113,12 @@ IN_PROC_BROWSER_TEST_F(SharesheetClientBrowserTest, ShareTwoFiles) {
EXPECT_EQ("share succeeded", content::EvalJs(contents, script));
EXPECT_EQ(file_paths.size(), 2U);
const base::FilePath my_files =
file_manager::util::GetMyFilesFolderForProfile(browser()->profile());
EXPECT_EQ(file_paths[0], my_files.AppendASCII(".WebShare/share1.mp3"));
EXPECT_EQ(file_paths[1], my_files.AppendASCII(".WebShare/share2.mp4"));
CheckSize(file_paths[0], /*expected_size=*/345);
CheckSize(file_paths[1], /*expected_size=*/67890);
}
......
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