Commit a1dbcf23 authored by Reilly Grant's avatar Reilly Grant Committed by Chromium LUCI CQ

Convert callbacks in //chrome/browser/chromeos/drive

This change converts callbacks from base::Bind and base::Callback to
Once/Repeating in //chrome/browser/chromeos/drive.

Bug: 1148570
Change-Id: I3c3e2730a1f9b8ba655c818ee7991cbbba62d7f4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2645030
Auto-Submit: Reilly Grant <reillyg@chromium.org>
Commit-Queue: Kazuhiro Inaba <kinaba@chromium.org>
Reviewed-by: default avatarKazuhiro Inaba <kinaba@chromium.org>
Cr-Commit-Position: refs/heads/master@{#846449}
parent b7f08dd0
...@@ -765,7 +765,7 @@ drivefs::mojom::DriveFs* DriveIntegrationService::GetDriveFsInterface() const { ...@@ -765,7 +765,7 @@ drivefs::mojom::DriveFs* DriveIntegrationService::GetDriveFsInterface() const {
} }
void DriveIntegrationService::AddBackDriveMountPoint( void DriveIntegrationService::AddBackDriveMountPoint(
const base::Callback<void(bool)>& callback, base::OnceCallback<void(bool)> callback,
FileError error) { FileError error) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(callback); DCHECK(callback);
...@@ -774,12 +774,12 @@ void DriveIntegrationService::AddBackDriveMountPoint( ...@@ -774,12 +774,12 @@ void DriveIntegrationService::AddBackDriveMountPoint(
if (error != FILE_ERROR_OK || !enabled_) { if (error != FILE_ERROR_OK || !enabled_) {
// Failed to reset, or Drive was disabled during the reset. // Failed to reset, or Drive was disabled during the reset.
callback.Run(false); std::move(callback).Run(false);
return; return;
} }
AddDriveMountPoint(); AddDriveMountPoint();
callback.Run(true); std::move(callback).Run(true);
} }
void DriveIntegrationService::AddDriveMountPoint() { void DriveIntegrationService::AddDriveMountPoint() {
......
...@@ -245,7 +245,7 @@ class DriveIntegrationService : public KeyedService, ...@@ -245,7 +245,7 @@ class DriveIntegrationService : public KeyedService,
// Adds back the drive mount point. // Adds back the drive mount point.
// Used to implement ClearCacheAndRemountFileSystem(). // Used to implement ClearCacheAndRemountFileSystem().
void AddBackDriveMountPoint(const base::Callback<void(bool)>& callback, void AddBackDriveMountPoint(base::OnceCallback<void(bool)> callback,
FileError error); FileError error);
// Unregisters drive mount point, and if |remount_delay| is specified // Unregisters drive mount point, and if |remount_delay| is specified
...@@ -336,8 +336,8 @@ class DriveIntegrationServiceFactory ...@@ -336,8 +336,8 @@ class DriveIntegrationServiceFactory
: public BrowserContextKeyedServiceFactory { : public BrowserContextKeyedServiceFactory {
public: public:
// Factory function used by tests. // Factory function used by tests.
typedef base::Callback<DriveIntegrationService*(Profile* profile)> using FactoryCallback =
FactoryCallback; base::RepeatingCallback<DriveIntegrationService*(Profile* profile)>;
// Sets and resets a factory function for tests. See below for why we can't // Sets and resets a factory function for tests. See below for why we can't
// use BrowserContextKeyedServiceFactory::SetTestingFactory(). // use BrowserContextKeyedServiceFactory::SetTestingFactory().
......
...@@ -27,7 +27,7 @@ class DriveIntegrationServiceBrowserTest : public InProcessBrowserTest { ...@@ -27,7 +27,7 @@ class DriveIntegrationServiceBrowserTest : public InProcessBrowserTest {
} }
void SetUpInProcessBrowserTestFixture() override { void SetUpInProcessBrowserTestFixture() override {
create_drive_integration_service_ = base::Bind( create_drive_integration_service_ = base::BindRepeating(
&DriveIntegrationServiceBrowserTest::CreateDriveIntegrationService, &DriveIntegrationServiceBrowserTest::CreateDriveIntegrationService,
base::Unretained(this)); base::Unretained(this));
service_factory_for_test_ = std::make_unique< service_factory_for_test_ = std::make_unique<
......
...@@ -100,7 +100,7 @@ class DriveFsNativeMessageHost : public extensions::NativeMessageHost, ...@@ -100,7 +100,7 @@ class DriveFsNativeMessageHost : public extensions::NativeMessageHost,
std::move(extension_port)); std::move(extension_port));
} }
receiver_.Bind(std::move(std::move(pending_receiver_))); receiver_.Bind(std::move(std::move(pending_receiver_)));
receiver_.set_disconnect_with_reason_handler(base::Bind( receiver_.set_disconnect_with_reason_handler(base::BindOnce(
&DriveFsNativeMessageHost::OnDisconnect, base::Unretained(this))); &DriveFsNativeMessageHost::OnDisconnect, base::Unretained(this)));
} }
......
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