Commit 8487fa49 authored by Christos Froussios's avatar Christos Froussios Committed by Commit Bot

Revert "Migrate file_system file manager APIs to UIThreadExtensionFunction."

This reverts commit 76efdcf8.

Reason for revert: Suspected of breaking
FileSystemProviderApiTest.RemoveWatcher
FileSystemProviderApiTest.AddWatcher
in browser_tests on linux-chromeos-rel

Example failure
https://ci.chromium.org/p/chromium/builders/luci.chromium.ci/linux-chromeos-rel/20439

Original change's description:
> Migrate file_system file manager APIs to UIThreadExtensionFunction.
> 
> BUG=934541
> 
> Change-Id: Ibd06bda730bd10c270d187d83f68315159fa6a43
> Reviewed-on: https://chromium-review.googlesource.com/c/1482172
> Reviewed-by: Sam McNally <sammc@chromium.org>
> Commit-Queue: Anand Mistry <amistry@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#634562}

TBR=sammc@chromium.org,amistry@chromium.org

Change-Id: I56ca79cb7a1d358539d31d3c1156859232e08ce3
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 934541
Reviewed-on: https://chromium-review.googlesource.com/c/1482970Reviewed-by: default avatarChristos Froussios <cfroussios@chromium.org>
Commit-Queue: Christos Froussios <cfroussios@chromium.org>
Cr-Commit-Position: refs/heads/master@{#634593}
parent 8306f020
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "base/macros.h" #include "base/macros.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h" #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h"
#include "chrome/browser/extensions/chrome_extension_function.h"
#include "chrome/browser/extensions/chrome_extension_function_details.h" #include "chrome/browser/extensions/chrome_extension_function_details.h"
#include "components/drive/file_errors.h" #include "components/drive/file_errors.h"
#include "extensions/browser/extension_function.h" #include "extensions/browser/extension_function.h"
...@@ -86,12 +87,12 @@ class FileManagerPrivateGrantAccessFunction : public UIThreadExtensionFunction { ...@@ -86,12 +87,12 @@ class FileManagerPrivateGrantAccessFunction : public UIThreadExtensionFunction {
// "FileWatch", // "FileWatch",
// the class and its sub classes are used only for watching changes in // the class and its sub classes are used only for watching changes in
// directories. // directories.
class FileWatchFunctionBase : public LoggedUIThreadExtensionFunction { class FileWatchFunctionBase : public LoggedAsyncExtensionFunction {
public: public:
using ResponseCallback = base::Callback<void(bool success)>; using ResponseCallback = base::Callback<void(bool success)>;
// Calls Respond() with |success| converted to base::Value. // Calls SendResponse() with |success| converted to base::Value.
void RespondWith(bool success); void Respond(bool success);
protected: protected:
~FileWatchFunctionBase() override = default; ~FileWatchFunctionBase() override = default;
...@@ -111,8 +112,8 @@ class FileWatchFunctionBase : public LoggedUIThreadExtensionFunction { ...@@ -111,8 +112,8 @@ class FileWatchFunctionBase : public LoggedUIThreadExtensionFunction {
const storage::FileSystemURL& file_system_url, const storage::FileSystemURL& file_system_url,
base::WeakPtr<file_manager::EventRouter> event_router) = 0; base::WeakPtr<file_manager::EventRouter> event_router) = 0;
// ExtensionFunction overrides. // ChromeAsyncExtensionFunction overrides.
ResponseAction Run() override; bool RunAsync() override;
private: private:
void RunAsyncOnIOThread( void RunAsyncOnIOThread(
...@@ -168,7 +169,7 @@ class FileManagerPrivateInternalRemoveFileWatchFunction ...@@ -168,7 +169,7 @@ class FileManagerPrivateInternalRemoveFileWatchFunction
// Implements the chrome.fileManagerPrivate.getSizeStats method. // Implements the chrome.fileManagerPrivate.getSizeStats method.
class FileManagerPrivateGetSizeStatsFunction class FileManagerPrivateGetSizeStatsFunction
: public LoggedUIThreadExtensionFunction { : public LoggedAsyncExtensionFunction {
public: public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getSizeStats", DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getSizeStats",
FILEMANAGERPRIVATE_GETSIZESTATS) FILEMANAGERPRIVATE_GETSIZESTATS)
...@@ -176,8 +177,8 @@ class FileManagerPrivateGetSizeStatsFunction ...@@ -176,8 +177,8 @@ class FileManagerPrivateGetSizeStatsFunction
protected: protected:
~FileManagerPrivateGetSizeStatsFunction() override = default; ~FileManagerPrivateGetSizeStatsFunction() override = default;
// ExtensionFunction overrides. // ChromeAsyncExtensionFunction overrides.
ResponseAction Run() override; bool RunAsync() override;
private: private:
void OnGetDriveAvailableSpace(drive::FileError error, void OnGetDriveAvailableSpace(drive::FileError error,
...@@ -193,7 +194,7 @@ class FileManagerPrivateGetSizeStatsFunction ...@@ -193,7 +194,7 @@ class FileManagerPrivateGetSizeStatsFunction
// Implements the chrome.fileManagerPrivate.validatePathNameLength method. // Implements the chrome.fileManagerPrivate.validatePathNameLength method.
class FileManagerPrivateInternalValidatePathNameLengthFunction class FileManagerPrivateInternalValidatePathNameLengthFunction
: public LoggedUIThreadExtensionFunction { : public LoggedAsyncExtensionFunction {
public: public:
DECLARE_EXTENSION_FUNCTION( DECLARE_EXTENSION_FUNCTION(
"fileManagerPrivateInternal.validatePathNameLength", "fileManagerPrivateInternal.validatePathNameLength",
...@@ -205,14 +206,14 @@ class FileManagerPrivateInternalValidatePathNameLengthFunction ...@@ -205,14 +206,14 @@ class FileManagerPrivateInternalValidatePathNameLengthFunction
void OnFilePathLimitRetrieved(size_t current_length, size_t max_length); void OnFilePathLimitRetrieved(size_t current_length, size_t max_length);
// ExtensionFunction overrides. // ChromeAsyncExtensionFunction overrides.
ResponseAction Run() override; bool RunAsync() override;
}; };
// Implements the chrome.fileManagerPrivate.formatVolume method. // Implements the chrome.fileManagerPrivate.formatVolume method.
// Formats Volume given its mount path. // Formats Volume given its mount path.
class FileManagerPrivateFormatVolumeFunction class FileManagerPrivateFormatVolumeFunction
: public LoggedUIThreadExtensionFunction { : public LoggedAsyncExtensionFunction {
public: public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.formatVolume", DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.formatVolume",
FILEMANAGERPRIVATE_FORMATVOLUME) FILEMANAGERPRIVATE_FORMATVOLUME)
...@@ -220,14 +221,14 @@ class FileManagerPrivateFormatVolumeFunction ...@@ -220,14 +221,14 @@ class FileManagerPrivateFormatVolumeFunction
protected: protected:
~FileManagerPrivateFormatVolumeFunction() override = default; ~FileManagerPrivateFormatVolumeFunction() override = default;
// ExtensionFunction overrides. // ChromeAsyncExtensionFunction overrides.
ResponseAction Run() override; bool RunAsync() override;
}; };
// Implements the chrome.fileManagerPrivate.renameVolume method. // Implements the chrome.fileManagerPrivate.renameVolume method.
// Renames Volume given its mount path and new Volume name. // Renames Volume given its mount path and new Volume name.
class FileManagerPrivateRenameVolumeFunction class FileManagerPrivateRenameVolumeFunction
: public LoggedUIThreadExtensionFunction { : public LoggedAsyncExtensionFunction {
public: public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.renameVolume", DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.renameVolume",
FILEMANAGERPRIVATE_RENAMEVOLUME) FILEMANAGERPRIVATE_RENAMEVOLUME)
...@@ -235,24 +236,22 @@ class FileManagerPrivateRenameVolumeFunction ...@@ -235,24 +236,22 @@ class FileManagerPrivateRenameVolumeFunction
protected: protected:
~FileManagerPrivateRenameVolumeFunction() override = default; ~FileManagerPrivateRenameVolumeFunction() override = default;
// ExtensionFunction overrides. // ChromeAsyncExtensionFunction overrides.
ResponseAction Run() override; bool RunAsync() override;
}; };
// Implements the chrome.fileManagerPrivate.startCopy method. // Implements the chrome.fileManagerPrivate.startCopy method.
class FileManagerPrivateInternalStartCopyFunction class FileManagerPrivateInternalStartCopyFunction
: public LoggedUIThreadExtensionFunction { : public LoggedAsyncExtensionFunction {
public: public:
FileManagerPrivateInternalStartCopyFunction();
DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.startCopy", DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.startCopy",
FILEMANAGERPRIVATEINTERNAL_STARTCOPY) FILEMANAGERPRIVATEINTERNAL_STARTCOPY)
protected: protected:
~FileManagerPrivateInternalStartCopyFunction() override = default; ~FileManagerPrivateInternalStartCopyFunction() override = default;
// ExtensionFunction overrides. // ChromeAsyncExtensionFunction overrides.
ResponseAction Run() override; bool RunAsync() override;
private: private:
void RunAfterGetFileMetadata(base::File::Error result, void RunAfterGetFileMetadata(base::File::Error result,
...@@ -271,12 +270,11 @@ class FileManagerPrivateInternalStartCopyFunction ...@@ -271,12 +270,11 @@ class FileManagerPrivateInternalStartCopyFunction
storage::FileSystemURL source_url_; storage::FileSystemURL source_url_;
storage::FileSystemURL destination_url_; storage::FileSystemURL destination_url_;
const ChromeExtensionFunctionDetails chrome_details_;
}; };
// Implements the chrome.fileManagerPrivate.cancelCopy method. // Implements the chrome.fileManagerPrivate.cancelCopy method.
class FileManagerPrivateCancelCopyFunction class FileManagerPrivateCancelCopyFunction
: public LoggedUIThreadExtensionFunction { : public LoggedAsyncExtensionFunction {
public: public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.cancelCopy", DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.cancelCopy",
FILEMANAGERPRIVATE_CANCELCOPY) FILEMANAGERPRIVATE_CANCELCOPY)
...@@ -284,8 +282,8 @@ class FileManagerPrivateCancelCopyFunction ...@@ -284,8 +282,8 @@ class FileManagerPrivateCancelCopyFunction
protected: protected:
~FileManagerPrivateCancelCopyFunction() override = default; ~FileManagerPrivateCancelCopyFunction() override = default;
// ExtensionFunction overrides. // ChromeAsyncExtensionFunction overrides.
ResponseAction Run() override; bool RunAsync() override;
}; };
// Implements the chrome.fileManagerPrivateInternal.resolveIsolatedEntries // Implements the chrome.fileManagerPrivateInternal.resolveIsolatedEntries
...@@ -311,7 +309,7 @@ class FileManagerPrivateInternalResolveIsolatedEntriesFunction ...@@ -311,7 +309,7 @@ class FileManagerPrivateInternalResolveIsolatedEntriesFunction
}; };
class FileManagerPrivateInternalComputeChecksumFunction class FileManagerPrivateInternalComputeChecksumFunction
: public LoggedUIThreadExtensionFunction { : public LoggedAsyncExtensionFunction {
public: public:
FileManagerPrivateInternalComputeChecksumFunction(); FileManagerPrivateInternalComputeChecksumFunction();
...@@ -321,22 +319,20 @@ class FileManagerPrivateInternalComputeChecksumFunction ...@@ -321,22 +319,20 @@ class FileManagerPrivateInternalComputeChecksumFunction
protected: protected:
~FileManagerPrivateInternalComputeChecksumFunction() override; ~FileManagerPrivateInternalComputeChecksumFunction() override;
// ExtensionFunction overrides. // ChromeAsyncExtensionFunction overrides.
ResponseAction Run() override; bool RunAsync() override;
private: private:
std::unique_ptr<drive::util::FileStreamMd5Digester> digester_; std::unique_ptr<drive::util::FileStreamMd5Digester> digester_;
void RespondWith(const std::string& hash); void Respond(const std::string& hash);
}; };
// Implements the chrome.fileManagerPrivate.searchFilesByHashes method. // Implements the chrome.fileManagerPrivate.searchFilesByHashes method.
// TODO(b/883628): Write some tests maybe? // TODO(b/883628): Write some tests maybe?
class FileManagerPrivateSearchFilesByHashesFunction class FileManagerPrivateSearchFilesByHashesFunction
: public LoggedUIThreadExtensionFunction { : public LoggedAsyncExtensionFunction {
public: public:
FileManagerPrivateSearchFilesByHashesFunction();
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.searchFilesByHashes", DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.searchFilesByHashes",
FILEMANAGERPRIVATE_SEARCHFILESBYHASHES) FILEMANAGERPRIVATE_SEARCHFILESBYHASHES)
...@@ -344,8 +340,8 @@ class FileManagerPrivateSearchFilesByHashesFunction ...@@ -344,8 +340,8 @@ class FileManagerPrivateSearchFilesByHashesFunction
~FileManagerPrivateSearchFilesByHashesFunction() override = default; ~FileManagerPrivateSearchFilesByHashesFunction() override = default;
private: private:
// ExtensionFunction overrides. // ChromeAsyncExtensionFunction overrides.
ResponseAction Run() override; bool RunAsync() override;
// Fallback to walking the filesystem and checking file attributes. // Fallback to walking the filesystem and checking file attributes.
std::vector<drive::HashAndFilePath> SearchByAttribute( std::vector<drive::HashAndFilePath> SearchByAttribute(
...@@ -359,8 +355,6 @@ class FileManagerPrivateSearchFilesByHashesFunction ...@@ -359,8 +355,6 @@ class FileManagerPrivateSearchFilesByHashesFunction
void OnSearchByHashes(const std::set<std::string>& hashes, void OnSearchByHashes(const std::set<std::string>& hashes,
drive::FileError error, drive::FileError error,
const std::vector<drive::HashAndFilePath>& results); const std::vector<drive::HashAndFilePath>& results);
const ChromeExtensionFunctionDetails chrome_details_;
}; };
// Implements the chrome.fileManagerPrivate.isUMAEnabled method. // Implements the chrome.fileManagerPrivate.isUMAEnabled method.
...@@ -400,7 +394,7 @@ class FileManagerPrivateInternalSetEntryTagFunction ...@@ -400,7 +394,7 @@ class FileManagerPrivateInternalSetEntryTagFunction
// Implements the chrome.fileManagerPrivate.getDirectorySize method. // Implements the chrome.fileManagerPrivate.getDirectorySize method.
class FileManagerPrivateInternalGetDirectorySizeFunction class FileManagerPrivateInternalGetDirectorySizeFunction
: public LoggedUIThreadExtensionFunction { : public LoggedAsyncExtensionFunction {
public: public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getDirectorySize", DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getDirectorySize",
FILEMANAGERPRIVATEINTERNAL_GETDIRECTORYSIZE) FILEMANAGERPRIVATEINTERNAL_GETDIRECTORYSIZE)
...@@ -410,8 +404,8 @@ class FileManagerPrivateInternalGetDirectorySizeFunction ...@@ -410,8 +404,8 @@ class FileManagerPrivateInternalGetDirectorySizeFunction
void OnDirectorySizeRetrieved(int64_t size); void OnDirectorySizeRetrieved(int64_t size);
// ExtensionFunction overrides // ChromeAsyncExtensionFunction overrides
ResponseAction Run() override; bool RunAsync() override;
}; };
} // namespace extensions } // namespace extensions
......
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