Commit d01c6b03 authored by Austin Tankiang's avatar Austin Tankiang Committed by Commit Bot

Remove unused drive code in file manager private

Bug: 1003238
Change-Id: I4f8f81a25258e9b4d23206f3fd476872026bc1c8
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1868529Reviewed-by: default avatarSergei Datsenko <dats@chromium.org>
Commit-Queue: Austin Tankiang <austinct@chromium.org>
Cr-Commit-Position: refs/heads/master@{#708531}
parent bff29607
......@@ -308,11 +308,6 @@ FileManagerPrivateInternalZipSelectionFunction::Run() {
if (params->dest_name.empty())
return RespondNow(Error("Empty output file name."));
// Check if the dir path is under Drive mount point.
// TODO(hshi): support create zip file on Drive (crbug.com/158690).
if (drive::util::IsUnderDriveMountPoint(src_dir))
return RespondNow(Error("Unable to zip Drive files."));
base::FilePath dest_file = src_dir.Append(params->dest_name);
std::vector<base::FilePath> src_relative_paths;
for (size_t i = 0; i != files.size(); ++i) {
......
......@@ -28,7 +28,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/extensions/api/file_manager_private.h"
#include "chromeos/components/drivefs/drivefs_util.h"
#include "components/drive/chromeos/file_system_interface.h"
#include "components/drive/drive.pb.h"
#include "components/drive/drive_api_util.h"
#include "components/drive/file_errors.h"
......@@ -55,35 +54,10 @@ struct GetSelectedFileInfoParams {
// the resolved local path when successful, and receives empty path for failure.
typedef base::OnceCallback<void(const base::FilePath&)> LocalPathCallback;
// Converts a callback from Drive file system to LocalPathCallback.
void OnDriveGetFile(const base::FilePath& path,
LocalPathCallback callback,
drive::FileError error,
const base::FilePath& local_file_path,
std::unique_ptr<drive::ResourceEntry> entry) {
if (error != drive::FILE_ERROR_OK)
DLOG(ERROR) << "Failed to get " << path.value() << " with: " << error;
std::move(callback).Run(local_file_path);
}
// Gets a resolved local file path of a non native |path| for file opening.
void GetFileNativeLocalPathForOpening(Profile* profile,
const base::FilePath& path,
LocalPathCallback callback) {
if (drive::util::IsUnderDriveMountPoint(path)) {
drive::FileSystemInterface* file_system =
drive::util::GetFileSystemByProfile(profile);
if (!file_system) {
DLOG(ERROR) << "Drive file selected while disabled: " << path.value();
std::move(callback).Run(base::FilePath());
return;
}
file_system->GetFile(
drive::util::ExtractDrivePath(path),
base::BindOnce(&OnDriveGetFile, path, std::move(callback)));
return;
}
VolumeManager::Get(profile)->snapshot_manager()->CreateManagedSnapshot(
path, std::move(callback));
}
......@@ -92,21 +66,7 @@ void GetFileNativeLocalPathForOpening(Profile* profile,
void GetFileNativeLocalPathForSaving(Profile* profile,
const base::FilePath& path,
LocalPathCallback callback) {
if (drive::util::IsUnderDriveMountPoint(path)) {
drive::FileSystemInterface* file_system =
drive::util::GetFileSystemByProfile(profile);
if (!file_system) {
DLOG(ERROR) << "Drive file selected while disabled: " << path.value();
std::move(callback).Run(base::FilePath());
return;
}
file_system->GetFileForSaving(
drive::util::ExtractDrivePath(path),
base::BindOnce(&OnDriveGetFile, path, std::move(callback)));
return;
}
// TODO(kinaba): For now, the only writable non-local volume is Drive.
// TODO(kinaba): For now, there are no writable non-local volumes.
NOTREACHED();
std::move(callback).Run(base::FilePath());
}
......@@ -446,18 +406,6 @@ void GetSelectedFileInfo(content::RenderFrameHost* render_frame_host,
base::BindOnce(&GetSelectedFileInfoInternal, profile, std::move(params)));
}
void SetupProfileFileAccessPermissions(int render_view_process_id,
Profile* profile) {
const base::FilePath paths[] = {
drive::util::GetDriveMountPointPath(profile),
util::GetDownloadsFolderForProfile(profile),
};
for (size_t i = 0; i < base::size(paths); ++i) {
content::ChildProcessSecurityPolicy::GetInstance(
)->GrantCreateReadWriteFile(render_view_process_id, paths[i]);
}
}
drive::EventLogger* GetLogger(Profile* profile) {
drive::DriveIntegrationService* service =
drive::DriveIntegrationServiceFactory::FindForProfile(profile);
......
......@@ -94,11 +94,6 @@ void GetSelectedFileInfo(content::RenderFrameHost* render_frame_host,
GetSelectedFileInfoLocalPathOption local_path_option,
GetSelectedFileInfoCallback callback);
// Grants permission to access per-profile folder (Downloads, Drive) of
// |profile| for the process |render_view_process_id|.
void SetupProfileFileAccessPermissions(int render_view_process_id,
Profile* profile);
// Get event logger to chrome://drive-internals page for the |profile|.
drive::EventLogger* GetLogger(Profile* profile);
......
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