Commit f7507615 authored by Bo Majewski's avatar Bo Majewski Committed by Commit Bot

Files App: Cleanup CL for PDF thumbnail generation

- Remove unnecessary explicit construction.
- Replace DISALLOW_COPY_AND_ASSIGN deprecated macro with explicit
  deletions
- Replace constructed optional value with a constant

Bug: 903742
Change-Id: I486f5976c32dd4af312b9d9efa5941c7bd18ce09
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2389481
Commit-Queue: Bo Majewski <majewski@chromium.org>
Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#806535}
parent 2ab7a04e
......@@ -211,8 +211,8 @@ std::string MakeThumbnailDataUrlOnThreadPool(
return base::StrCat({"data:image/png;base64,", base::Base64Encode(png_data)});
}
// The maximum size of the PDF size for which thumbnails are generated.
constexpr static uint32_t kMaxPdfSize = 1024u * 1024u;
// The maximum size of the input PDF file for which thumbnails are generated.
constexpr uint32_t kMaxPdfSize = 1024u * 1024u;
// A function that performs IO operations to read and render PDF thumbnail
// Must be run by a blocking task runner.
......@@ -1150,7 +1150,7 @@ FileManagerPrivateDetectCharacterEncodingFunction::Run() {
}
FileManagerPrivateInternalGetThumbnailFunction::
FileManagerPrivateInternalGetThumbnailFunction() {}
FileManagerPrivateInternalGetThumbnailFunction() = default;
FileManagerPrivateInternalGetThumbnailFunction::
~FileManagerPrivateInternalGetThumbnailFunction() = default;
......@@ -1290,7 +1290,7 @@ FileManagerPrivateInternalGetThumbnailFunction::GetDrivefsThumbnail(
base::BindOnce(&FileManagerPrivateInternalGetThumbnailFunction::
GotDriveThumbnail,
this),
base::Optional<std::vector<uint8_t>>()));
base::nullopt));
return RespondLater();
}
......@@ -1301,11 +1301,7 @@ void FileManagerPrivateInternalGetThumbnailFunction::GotDriveThumbnail(
return;
}
base::ThreadPool::PostTaskAndReplyWithResult(
FROM_HERE,
base::BindOnce(
&MakeThumbnailDataUrlOnThreadPool,
base::make_span(reinterpret_cast<const uint8_t*>(data->data()),
data->size())),
FROM_HERE, base::BindOnce(&MakeThumbnailDataUrlOnThreadPool, *data),
base::BindOnce(
&FileManagerPrivateInternalGetThumbnailFunction::SendEncodedThumbnail,
this));
......
......@@ -13,7 +13,6 @@
#include <vector>
#include "base/files/file.h"
#include "base/macros.h"
#include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h"
#include "chrome/browser/chromeos/file_system_provider/provided_file_system_interface.h"
#include "chrome/browser/extensions/chrome_extension_function_details.h"
......@@ -206,13 +205,18 @@ class FileManagerPrivateGetProvidersFunction : public ExtensionFunction {
FileManagerPrivateGetProvidersFunction();
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getProviders",
FILEMANAGERPRIVATE_GETPROVIDERS)
FileManagerPrivateGetProvidersFunction(
const FileManagerPrivateGetProvidersFunction&) = delete;
FileManagerPrivateGetProvidersFunction& operator=(
const FileManagerPrivateGetProvidersFunction&) = delete;
protected:
~FileManagerPrivateGetProvidersFunction() override = default;
private:
ResponseAction Run() override;
const ChromeExtensionFunctionDetails chrome_details_;
DISALLOW_COPY_AND_ASSIGN(FileManagerPrivateGetProvidersFunction);
};
// Implements the chrome.fileManagerPrivate.addProvidedFileSystem method.
......@@ -222,13 +226,18 @@ class FileManagerPrivateAddProvidedFileSystemFunction
FileManagerPrivateAddProvidedFileSystemFunction();
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.addProvidedFileSystem",
FILEMANAGERPRIVATE_ADDPROVIDEDFILESYSTEM)
FileManagerPrivateAddProvidedFileSystemFunction(
const FileManagerPrivateAddProvidedFileSystemFunction&) = delete;
FileManagerPrivateAddProvidedFileSystemFunction& operator=(
const FileManagerPrivateAddProvidedFileSystemFunction&) = delete;
protected:
~FileManagerPrivateAddProvidedFileSystemFunction() override = default;
private:
ResponseAction Run() override;
const ChromeExtensionFunctionDetails chrome_details_;
DISALLOW_COPY_AND_ASSIGN(FileManagerPrivateAddProvidedFileSystemFunction);
};
// Implements the chrome.fileManagerPrivate.configureVolume method.
......@@ -238,6 +247,12 @@ class FileManagerPrivateConfigureVolumeFunction
FileManagerPrivateConfigureVolumeFunction();
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.configureVolume",
FILEMANAGERPRIVATE_CONFIGUREVOLUME)
FileManagerPrivateConfigureVolumeFunction(
const FileManagerPrivateConfigureVolumeFunction&) = delete;
FileManagerPrivateConfigureVolumeFunction& operator=(
const FileManagerPrivateConfigureVolumeFunction&) = delete;
protected:
~FileManagerPrivateConfigureVolumeFunction() override = default;
......@@ -246,7 +261,6 @@ class FileManagerPrivateConfigureVolumeFunction
void OnCompleted(base::File::Error result);
const ChromeExtensionFunctionDetails chrome_details_;
DISALLOW_COPY_AND_ASSIGN(FileManagerPrivateConfigureVolumeFunction);
};
// Implements the chrome.fileManagerPrivate.mountCrostini method.
......@@ -257,6 +271,11 @@ class FileManagerPrivateMountCrostiniFunction : public LoggedExtensionFunction {
FILEMANAGERPRIVATE_MOUNTCROSTINI)
FileManagerPrivateMountCrostiniFunction();
FileManagerPrivateMountCrostiniFunction(
const FileManagerPrivateMountCrostiniFunction&) = delete;
FileManagerPrivateMountCrostiniFunction& operator=(
const FileManagerPrivateMountCrostiniFunction&) = delete;
protected:
~FileManagerPrivateMountCrostiniFunction() override;
......@@ -266,7 +285,6 @@ class FileManagerPrivateMountCrostiniFunction : public LoggedExtensionFunction {
private:
std::string source_path_;
std::string mount_label_;
DISALLOW_COPY_AND_ASSIGN(FileManagerPrivateMountCrostiniFunction);
};
// Implements the chrome.fileManagerPrivate.importCrostiniImage method.
......@@ -278,6 +296,11 @@ class FileManagerPrivateInternalImportCrostiniImageFunction
FILEMANAGERPRIVATEINTERNAL_IMPORTCROSTINIIMAGE)
FileManagerPrivateInternalImportCrostiniImageFunction();
FileManagerPrivateInternalImportCrostiniImageFunction(
const FileManagerPrivateInternalImportCrostiniImageFunction&) = delete;
FileManagerPrivateInternalImportCrostiniImageFunction& operator=(
const FileManagerPrivateInternalImportCrostiniImageFunction&) = delete;
protected:
~FileManagerPrivateInternalImportCrostiniImageFunction() override;
......@@ -285,8 +308,6 @@ class FileManagerPrivateInternalImportCrostiniImageFunction
ResponseAction Run() override;
std::string image_path_;
DISALLOW_COPY_AND_ASSIGN(
FileManagerPrivateInternalImportCrostiniImageFunction);
};
// Implements the chrome.fileManagerPrivate.sharePathsWithCrostini
......@@ -299,6 +320,11 @@ class FileManagerPrivateInternalSharePathsWithCrostiniFunction
FILEMANAGERPRIVATEINTERNAL_SHAREPATHSWITHCROSTINI)
FileManagerPrivateInternalSharePathsWithCrostiniFunction() = default;
FileManagerPrivateInternalSharePathsWithCrostiniFunction(
const FileManagerPrivateInternalSharePathsWithCrostiniFunction&) = delete;
FileManagerPrivateInternalSharePathsWithCrostiniFunction& operator=(
const FileManagerPrivateInternalSharePathsWithCrostiniFunction&) = delete;
protected:
~FileManagerPrivateInternalSharePathsWithCrostiniFunction() override =
default;
......@@ -306,8 +332,6 @@ class FileManagerPrivateInternalSharePathsWithCrostiniFunction
private:
ResponseAction Run() override;
void SharePathsCallback(bool success, const std::string& failure_reason);
DISALLOW_COPY_AND_ASSIGN(
FileManagerPrivateInternalSharePathsWithCrostiniFunction);
};
// Implements the chrome.fileManagerPrivate.unsharePathWithCrostini
......@@ -320,6 +344,13 @@ class FileManagerPrivateInternalUnsharePathWithCrostiniFunction
FILEMANAGERPRIVATEINTERNAL_UNSHAREPATHWITHCROSTINI)
FileManagerPrivateInternalUnsharePathWithCrostiniFunction() = default;
FileManagerPrivateInternalUnsharePathWithCrostiniFunction(
const FileManagerPrivateInternalUnsharePathWithCrostiniFunction&) =
delete;
FileManagerPrivateInternalUnsharePathWithCrostiniFunction& operator=(
const FileManagerPrivateInternalUnsharePathWithCrostiniFunction&) =
delete;
protected:
~FileManagerPrivateInternalUnsharePathWithCrostiniFunction() override =
default;
......@@ -327,8 +358,6 @@ class FileManagerPrivateInternalUnsharePathWithCrostiniFunction
private:
ResponseAction Run() override;
void UnsharePathCallback(bool success, const std::string& failure_reason);
DISALLOW_COPY_AND_ASSIGN(
FileManagerPrivateInternalUnsharePathWithCrostiniFunction);
};
// Implements the chrome.fileManagerPrivate.getCrostiniSharedPaths
......@@ -341,14 +370,17 @@ class FileManagerPrivateInternalGetCrostiniSharedPathsFunction
FILEMANAGERPRIVATEINTERNAL_GETCROSTINISHAREDPATHS)
FileManagerPrivateInternalGetCrostiniSharedPathsFunction() = default;
FileManagerPrivateInternalGetCrostiniSharedPathsFunction(
const FileManagerPrivateInternalGetCrostiniSharedPathsFunction&) = delete;
FileManagerPrivateInternalGetCrostiniSharedPathsFunction operator=(
const FileManagerPrivateInternalGetCrostiniSharedPathsFunction&) = delete;
protected:
~FileManagerPrivateInternalGetCrostiniSharedPathsFunction() override =
default;
private:
ResponseAction Run() override;
DISALLOW_COPY_AND_ASSIGN(
FileManagerPrivateInternalGetCrostiniSharedPathsFunction);
};
// Implements the chrome.fileManagerPrivate.getLinuxPackageInfo method.
......@@ -360,6 +392,11 @@ class FileManagerPrivateInternalGetLinuxPackageInfoFunction
FILEMANAGERPRIVATEINTERNAL_GETLINUXPACKAGEINFO)
FileManagerPrivateInternalGetLinuxPackageInfoFunction() = default;
FileManagerPrivateInternalGetLinuxPackageInfoFunction(
const FileManagerPrivateInternalGetLinuxPackageInfoFunction&) = delete;
FileManagerPrivateInternalGetLinuxPackageInfoFunction operator=(
const FileManagerPrivateInternalGetLinuxPackageInfoFunction&) = delete;
protected:
~FileManagerPrivateInternalGetLinuxPackageInfoFunction() override = default;
......@@ -367,8 +404,6 @@ class FileManagerPrivateInternalGetLinuxPackageInfoFunction
ResponseAction Run() override;
void OnGetLinuxPackageInfo(
const crostini::LinuxPackageInfo& linux_package_info);
DISALLOW_COPY_AND_ASSIGN(
FileManagerPrivateInternalGetLinuxPackageInfoFunction);
};
// Implements the chrome.fileManagerPrivate.installLinuxPackage method.
......@@ -380,14 +415,17 @@ class FileManagerPrivateInternalInstallLinuxPackageFunction
FILEMANAGERPRIVATEINTERNAL_INSTALLLINUXPACKAGE)
FileManagerPrivateInternalInstallLinuxPackageFunction() = default;
FileManagerPrivateInternalInstallLinuxPackageFunction(
const FileManagerPrivateInternalInstallLinuxPackageFunction&) = delete;
FileManagerPrivateInternalInstallLinuxPackageFunction operator=(
const FileManagerPrivateInternalInstallLinuxPackageFunction&) = delete;
protected:
~FileManagerPrivateInternalInstallLinuxPackageFunction() override = default;
private:
ResponseAction Run() override;
void OnInstallLinuxPackage(crostini::CrostiniResult result);
DISALLOW_COPY_AND_ASSIGN(
FileManagerPrivateInternalInstallLinuxPackageFunction);
};
// Implements the chrome.fileManagerPrivate.getCustomActions method.
......@@ -397,6 +435,12 @@ class FileManagerPrivateInternalGetCustomActionsFunction
FileManagerPrivateInternalGetCustomActionsFunction();
DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getCustomActions",
FILEMANAGERPRIVATEINTERNAL_GETCUSTOMACTIONS)
FileManagerPrivateInternalGetCustomActionsFunction(
const FileManagerPrivateInternalGetCustomActionsFunction&) = delete;
FileManagerPrivateInternalGetCustomActionsFunction operator=(
const FileManagerPrivateInternalGetCustomActionsFunction&) = delete;
protected:
~FileManagerPrivateInternalGetCustomActionsFunction() override = default;
......@@ -406,7 +450,6 @@ class FileManagerPrivateInternalGetCustomActionsFunction
base::File::Error result);
const ChromeExtensionFunctionDetails chrome_details_;
DISALLOW_COPY_AND_ASSIGN(FileManagerPrivateInternalGetCustomActionsFunction);
};
// Implements the chrome.fileManagerPrivate.executeCustomAction method.
......@@ -416,6 +459,12 @@ class FileManagerPrivateInternalExecuteCustomActionFunction
FileManagerPrivateInternalExecuteCustomActionFunction();
DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.executeCustomAction",
FILEMANAGERPRIVATEINTERNAL_EXECUTECUSTOMACTION)
FileManagerPrivateInternalExecuteCustomActionFunction(
const FileManagerPrivateInternalExecuteCustomActionFunction&) = delete;
FileManagerPrivateInternalExecuteCustomActionFunction operator=(
const FileManagerPrivateInternalExecuteCustomActionFunction&) = delete;
protected:
~FileManagerPrivateInternalExecuteCustomActionFunction() override = default;
......@@ -424,8 +473,6 @@ class FileManagerPrivateInternalExecuteCustomActionFunction
void OnCompleted(base::File::Error result);
const ChromeExtensionFunctionDetails chrome_details_;
DISALLOW_COPY_AND_ASSIGN(
FileManagerPrivateInternalExecuteCustomActionFunction);
};
// Implements the chrome.fileManagerPrivateInternal.getRecentFiles method.
......@@ -435,6 +482,12 @@ class FileManagerPrivateInternalGetRecentFilesFunction
FileManagerPrivateInternalGetRecentFilesFunction();
DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getRecentFiles",
FILEMANAGERPRIVATE_GETRECENTFILES)
FileManagerPrivateInternalGetRecentFilesFunction(
const FileManagerPrivateInternalGetRecentFilesFunction&) = delete;
FileManagerPrivateInternalGetRecentFilesFunction& operator=(
FileManagerPrivateInternalGetRecentFilesFunction&) = delete;
protected:
~FileManagerPrivateInternalGetRecentFilesFunction() override = default;
......@@ -448,7 +501,6 @@ class FileManagerPrivateInternalGetRecentFilesFunction
entry_definition_list);
const ChromeExtensionFunctionDetails chrome_details_;
DISALLOW_COPY_AND_ASSIGN(FileManagerPrivateInternalGetRecentFilesFunction);
};
// Implements the chrome.fileManagerPrivate.detectCharacterEncoding method.
......
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