Commit 12a824eb authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

Remove unused crostini.shared_paths pref

Migration first implemented in M77, so safe to now remove
in M81.

Bug: 946273
Change-Id: I7944f601b6193c983fec66a3859ca079f4b8a5a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1958269Reviewed-by: default avatarDominic Battré <battre@chromium.org>
Reviewed-by: default avatarJason Lin <lxj@google.com>
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#723594}
parent 292e8ca6
......@@ -9,15 +9,11 @@
namespace guest_os {
namespace prefs {
// TODO(crbug.com/946273): Remove crostini.shared_paths and migration code after
// M77.
const char kCrostiniSharedPaths[] = "crostini.shared_paths";
// Dictionary of filesystem paths mapped to the list of VMs that the paths are
// shared with.
const char kGuestOSPathsSharedToVms[] = "guest_os.paths_shared_to_vms";
void RegisterProfilePrefs(PrefRegistrySimple* registry) {
registry->RegisterListPref(kCrostiniSharedPaths);
registry->RegisterDictionaryPref(kGuestOSPathsSharedToVms);
}
......
......@@ -18,7 +18,6 @@
#include "chrome/browser/chromeos/guest_os/guest_os_share_path_factory.h"
#include "chrome/browser/chromeos/plugin_vm/plugin_vm_manager.h"
#include "chrome/browser/chromeos/plugin_vm/plugin_vm_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chromeos/components/drivefs/mojom/drivefs.mojom.h"
#include "chromeos/dbus/concierge/concierge_service.pb.h"
#include "chromeos/dbus/dbus_thread_manager.h"
......@@ -509,25 +508,6 @@ void GuestOsSharePath::RegisterPersistedPath(const std::string& vm_name,
}
}
void GuestOsSharePath::MigratePersistedPathsToMultiVM(
PrefService* profile_prefs) {
const base::ListValue* shared_paths =
profile_prefs->GetList(prefs::kCrostiniSharedPaths);
if (shared_paths->GetSize() == 0) {
return;
}
// Convert ['foo', 'bar'] to {'foo':['termina'], 'bar':['termina']}.
base::Value dict(base::Value::Type::DICTIONARY);
for (const auto& shared_path : *shared_paths) {
base::Value termina(base::Value::Type::LIST);
termina.Append(base::Value(crostini::kCrostiniDefaultVmName));
dict.SetKey(shared_path.GetString(), std::move(termina));
}
profile_prefs->Set(prefs::kGuestOSPathsSharedToVms, std::move(dict));
profile_prefs->ClearPref(prefs::kCrostiniSharedPaths);
}
void GuestOsSharePath::OnVolumeMounted(chromeos::MountError error_code,
const file_manager::Volume& volume) {
if (error_code != chromeos::MountError::MOUNT_ERROR_NONE) {
......
......@@ -18,13 +18,11 @@
#include "base/sequenced_task_runner.h"
#include "chrome/browser/chromeos/crostini/crostini_manager.h"
#include "chrome/browser/chromeos/file_manager/volume_manager_observer.h"
#include "chrome/browser/profiles/profile.h"
#include "chromeos/components/drivefs/drivefs_host_observer.h"
#include "chromeos/dbus/seneschal/seneschal_service.pb.h"
#include "components/keyed_service/core/keyed_service.h"
class PrefService;
class Profile;
namespace guest_os {
using SuccessCallback =
......@@ -60,12 +58,6 @@ class GuestOsSharePath : public KeyedService,
const base::FilePath& path) = 0;
};
// Migrates from crostini.shared_paths to crostini.paths_shared_to_vms which
// supports multi VM sharing.
// TODO(crbug.com/946273): Remove crostini.shared_paths and migration code
// after M77.
static void MigratePersistedPathsToMultiVM(PrefService* profile_prefs);
static GuestOsSharePath* GetForProfile(Profile* profile);
explicit GuestOsSharePath(Profile* profile);
~GuestOsSharePath() override;
......
......@@ -747,29 +747,6 @@ TEST_F(GuestOsSharePathTest, UnsharePathInvalidPath) {
run_loop()->Run();
}
TEST_F(GuestOsSharePathTest, MigratePersistedPathsToMultiVM) {
SetUpVolume();
base::ListValue shared_paths = base::ListValue();
base::FilePath downloads_file = profile()->GetPath().Append("Downloads/file");
shared_paths.AppendString(downloads_file.value());
base::FilePath not_downloads("/not/downloads");
shared_paths.AppendString(not_downloads.value());
profile()->GetPrefs()->Set(prefs::kCrostiniSharedPaths, shared_paths);
GuestOsSharePath::MigratePersistedPathsToMultiVM(profile()->GetPrefs());
EXPECT_EQ(
profile()->GetPrefs()->GetList(prefs::kCrostiniSharedPaths)->GetSize(),
0U);
const base::DictionaryValue* prefs =
profile()->GetPrefs()->GetDictionary(prefs::kGuestOSPathsSharedToVms);
EXPECT_EQ(prefs->size(), 2U);
EXPECT_EQ(prefs->FindKey(downloads_file.value())->GetList().size(), 1U);
EXPECT_EQ(prefs->FindKey(downloads_file.value())->GetList()[0].GetString(),
"termina");
EXPECT_EQ(prefs->FindKey(not_downloads.value())->GetList().size(), 1U);
EXPECT_EQ(prefs->FindKey(not_downloads.value())->GetList()[0].GetString(),
"termina");
}
TEST_F(GuestOsSharePathTest, GetPersistedSharedPaths) {
SetUpVolume();
// path1:['vm1'], path2:['vm2'], path3:['vm3'], path12:['vm1','vm2']
......
......@@ -1141,9 +1141,6 @@ void MigrateObsoleteProfilePrefs(Profile* profile) {
#if defined(OS_CHROMEOS)
// Added 12/2018.
profile_prefs->ClearPref(prefs::kDataSaverPromptsShown);
// Added 4/2019
guest_os::GuestOsSharePath::MigratePersistedPathsToMultiVM(profile_prefs);
#endif
// Added 1/2019.
......
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