summaryrefslogtreecommitdiffstats
path: root/chromeos
diff options
context:
space:
mode:
authorhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 02:25:35 +0000
committerhashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-11 02:25:35 +0000
commit4a404e5356b27578de71b9b41de686768d2ecd42 (patch)
treeb14264adfaaaf505677a2cf1ec7f5dafe636bae5 /chromeos
parent0834e1b153c28dec0ae9e90080ad7a106f1c8c84 (diff)
downloadchromium_src-4a404e5356b27578de71b9b41de686768d2ecd42.zip
chromium_src-4a404e5356b27578de71b9b41de686768d2ecd42.tar.gz
chromium_src-4a404e5356b27578de71b9b41de686768d2ecd42.tar.bz2
chromeos: Convert D-Bus client classes' callback arguments to const reference
BUG=chromium-os:28578 TEST=build success Review URL: https://chromiumcodereview.appspot.com/10024054 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@131697 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chromeos')
-rw-r--r--chromeos/dbus/bluetooth_property.h2
-rw-r--r--chromeos/dbus/cashew_client.cc4
-rw-r--r--chromeos/dbus/cashew_client.h3
-rw-r--r--chromeos/dbus/cros_disks_client.cc74
-rw-r--r--chromeos/dbus/cros_disks_client.h24
-rw-r--r--chromeos/dbus/cryptohome_client.cc49
-rw-r--r--chromeos/dbus/cryptohome_client.h19
-rw-r--r--chromeos/dbus/flimflam_client_unittest_base.cc8
-rw-r--r--chromeos/dbus/flimflam_client_unittest_base.h13
-rw-r--r--chromeos/dbus/image_burner_client.cc12
-rw-r--r--chromeos/dbus/image_burner_client.h6
-rw-r--r--chromeos/dbus/mock_cashew_client.h3
-rw-r--r--chromeos/dbus/mock_cros_disks_client.h31
-rw-r--r--chromeos/dbus/mock_cryptohome_client.h19
-rw-r--r--chromeos/dbus/mock_image_burner_client.h9
-rw-r--r--chromeos/dbus/mock_power_manager_client.h9
-rw-r--r--chromeos/dbus/mock_session_manager_client.h8
-rw-r--r--chromeos/dbus/mock_update_engine_client.h4
-rw-r--r--chromeos/dbus/power_manager_client.cc4
-rw-r--r--chromeos/dbus/power_manager_client.h2
-rw-r--r--chromeos/dbus/session_manager_client.cc28
-rw-r--r--chromeos/dbus/session_manager_client.h8
-rw-r--r--chromeos/dbus/update_engine_client.cc16
-rw-r--r--chromeos/dbus/update_engine_client.h4
24 files changed, 192 insertions, 167 deletions
diff --git a/chromeos/dbus/bluetooth_property.h b/chromeos/dbus/bluetooth_property.h
index ccfbff1..20050c9 100644
--- a/chromeos/dbus/bluetooth_property.h
+++ b/chromeos/dbus/bluetooth_property.h
@@ -23,7 +23,7 @@ class BluetoothPropertySet : public dbus::PropertySet {
public:
BluetoothPropertySet(dbus::ObjectProxy* object_proxy,
const std::string& interface,
- PropertyChangedCallback callback)
+ const PropertyChangedCallback& callback)
: dbus::PropertySet(object_proxy, interface, callback) {}
// dbus::PropertySet override.
diff --git a/chromeos/dbus/cashew_client.cc b/chromeos/dbus/cashew_client.cc
index 93d1f3d..eb801f4 100644
--- a/chromeos/dbus/cashew_client.cc
+++ b/chromeos/dbus/cashew_client.cc
@@ -41,7 +41,7 @@ class CashewClientImpl : public CashewClient {
// CashewClient override.
virtual void SetDataPlansUpdateHandler(
- DataPlansUpdateHandler handler) OVERRIDE {
+ const DataPlansUpdateHandler& handler) OVERRIDE {
data_plans_update_handler_ = handler;
}
@@ -101,7 +101,7 @@ class CashewClientStubImpl : public CashewClient {
// CashewClient override.
virtual void SetDataPlansUpdateHandler(
- DataPlansUpdateHandler handler) OVERRIDE {}
+ const DataPlansUpdateHandler& handler) OVERRIDE {}
// CashewClient override.
virtual void ResetDataPlansUpdateHandler() OVERRIDE {}
diff --git a/chromeos/dbus/cashew_client.h b/chromeos/dbus/cashew_client.h
index 2238e1b..195f256 100644
--- a/chromeos/dbus/cashew_client.h
+++ b/chromeos/dbus/cashew_client.h
@@ -44,7 +44,8 @@ class CHROMEOS_EXPORT CashewClient {
dbus::Bus* bus);
// Sets DataPlansUpdate signal handler.
- virtual void SetDataPlansUpdateHandler(DataPlansUpdateHandler handler) = 0;
+ virtual void SetDataPlansUpdateHandler(
+ const DataPlansUpdateHandler& handler) = 0;
// Resets DataPlansUpdate signal handler.
virtual void ResetDataPlansUpdateHandler() = 0;
diff --git a/chromeos/dbus/cros_disks_client.cc b/chromeos/dbus/cros_disks_client.cc
index 217382c..441b7fe 100644
--- a/chromeos/dbus/cros_disks_client.cc
+++ b/chromeos/dbus/cros_disks_client.cc
@@ -114,8 +114,8 @@ class CrosDisksClientImpl : public CrosDisksClient {
// CrosDisksClient override.
virtual void Mount(const std::string& source_path,
MountType type,
- MountCallback callback,
- ErrorCallback error_callback) OVERRIDE {
+ const MountCallback& callback,
+ const ErrorCallback& error_callback) OVERRIDE {
dbus::MethodCall method_call(cros_disks::kCrosDisksInterface,
cros_disks::kMount);
dbus::MessageWriter writer(&method_call);
@@ -134,8 +134,8 @@ class CrosDisksClientImpl : public CrosDisksClient {
// CrosDisksClient override.
virtual void Unmount(const std::string& device_path,
- UnmountCallback callback,
- ErrorCallback error_callback) OVERRIDE {
+ const UnmountCallback& callback,
+ const ErrorCallback& error_callback) OVERRIDE {
dbus::MethodCall method_call(cros_disks::kCrosDisksInterface,
cros_disks::kUnmount);
dbus::MessageWriter writer(&method_call);
@@ -154,8 +154,8 @@ class CrosDisksClientImpl : public CrosDisksClient {
// CrosDisksClient override.
virtual void EnumerateAutoMountableDevices(
- EnumerateAutoMountableDevicesCallback callback,
- ErrorCallback error_callback) OVERRIDE {
+ const EnumerateAutoMountableDevicesCallback& callback,
+ const ErrorCallback& error_callback) OVERRIDE {
dbus::MethodCall method_call(cros_disks::kCrosDisksInterface,
cros_disks::kEnumerateAutoMountableDevices);
proxy_->CallMethod(
@@ -169,8 +169,8 @@ class CrosDisksClientImpl : public CrosDisksClient {
// CrosDisksClient override.
virtual void FormatDevice(const std::string& device_path,
const std::string& filesystem,
- FormatDeviceCallback callback,
- ErrorCallback error_callback) OVERRIDE {
+ const FormatDeviceCallback& callback,
+ const ErrorCallback& error_callback) OVERRIDE {
dbus::MethodCall method_call(cros_disks::kCrosDisksInterface,
cros_disks::kFormatDevice);
dbus::MessageWriter writer(&method_call);
@@ -185,9 +185,10 @@ class CrosDisksClientImpl : public CrosDisksClient {
}
// CrosDisksClient override.
- virtual void GetDeviceProperties(const std::string& device_path,
- GetDevicePropertiesCallback callback,
- ErrorCallback error_callback) OVERRIDE {
+ virtual void GetDeviceProperties(
+ const std::string& device_path,
+ const GetDevicePropertiesCallback& callback,
+ const ErrorCallback& error_callback) OVERRIDE {
dbus::MethodCall method_call(cros_disks::kCrosDisksInterface,
cros_disks::kGetDeviceProperties);
dbus::MessageWriter writer(&method_call);
@@ -203,8 +204,8 @@ class CrosDisksClientImpl : public CrosDisksClient {
// CrosDisksClient override.
virtual void SetUpConnections(
- MountEventHandler mount_event_handler,
- MountCompletedHandler mount_completed_handler) OVERRIDE {
+ const MountEventHandler& mount_event_handler,
+ const MountCompletedHandler& mount_completed_handler) OVERRIDE {
static const SignalEventTuple kSignalEventTuples[] = {
{ cros_disks::kDeviceAdded, DEVICE_ADDED },
{ cros_disks::kDeviceScanned, DEVICE_SCANNED },
@@ -246,8 +247,8 @@ class CrosDisksClientImpl : public CrosDisksClient {
};
// Handles the result of Mount and calls |callback| or |error_callback|.
- void OnMount(MountCallback callback,
- ErrorCallback error_callback,
+ void OnMount(const MountCallback& callback,
+ const ErrorCallback& error_callback,
dbus::Response* response) {
if (!response) {
error_callback.Run();
@@ -258,8 +259,8 @@ class CrosDisksClientImpl : public CrosDisksClient {
// Handles the result of Unount and calls |callback| or |error_callback|.
void OnUnmount(const std::string& device_path,
- UnmountCallback callback,
- ErrorCallback error_callback,
+ const UnmountCallback& callback,
+ const ErrorCallback& error_callback,
dbus::Response* response) {
if (!response) {
error_callback.Run();
@@ -271,8 +272,8 @@ class CrosDisksClientImpl : public CrosDisksClient {
// Handles the result of EnumerateAutoMountableDevices and calls |callback| or
// |error_callback|.
void OnEnumerateAutoMountableDevices(
- EnumerateAutoMountableDevicesCallback callback,
- ErrorCallback error_callback,
+ const EnumerateAutoMountableDevicesCallback& callback,
+ const ErrorCallback& error_callback,
dbus::Response* response) {
if (!response) {
error_callback.Run();
@@ -291,8 +292,8 @@ class CrosDisksClientImpl : public CrosDisksClient {
// Handles the result of FormatDevice and calls |callback| or
// |error_callback|.
void OnFormatDevice(const std::string& device_path,
- FormatDeviceCallback callback,
- ErrorCallback error_callback,
+ const FormatDeviceCallback& callback,
+ const ErrorCallback& error_callback,
dbus::Response* response) {
if (!response) {
error_callback.Run();
@@ -311,8 +312,8 @@ class CrosDisksClientImpl : public CrosDisksClient {
// Handles the result of GetDeviceProperties and calls |callback| or
// |error_callback|.
void OnGetDeviceProperties(const std::string& device_path,
- GetDevicePropertiesCallback callback,
- ErrorCallback error_callback,
+ const GetDevicePropertiesCallback& callback,
+ const ErrorCallback& error_callback,
dbus::Response* response) {
if (!response) {
error_callback.Run();
@@ -375,24 +376,25 @@ class CrosDisksClientStubImpl : public CrosDisksClient {
virtual void Mount(const std::string& source_path,
MountType type,
- MountCallback callback,
- ErrorCallback error_callback) OVERRIDE {}
+ const MountCallback& callback,
+ const ErrorCallback& error_callback) OVERRIDE {}
virtual void Unmount(const std::string& device_path,
- UnmountCallback callback,
- ErrorCallback error_callback) OVERRIDE {}
+ const UnmountCallback& callback,
+ const ErrorCallback& error_callback) OVERRIDE {}
virtual void EnumerateAutoMountableDevices(
- EnumerateAutoMountableDevicesCallback callback,
- ErrorCallback error_callback) OVERRIDE {}
+ const EnumerateAutoMountableDevicesCallback& callback,
+ const ErrorCallback& error_callback) OVERRIDE {}
virtual void FormatDevice(const std::string& device_path,
const std::string& filesystem,
- FormatDeviceCallback callback,
- ErrorCallback error_callback) OVERRIDE {}
- virtual void GetDeviceProperties(const std::string& device_path,
- GetDevicePropertiesCallback callback,
- ErrorCallback error_callback) OVERRIDE {}
+ const FormatDeviceCallback& callback,
+ const ErrorCallback& error_callback) OVERRIDE {}
+ virtual void GetDeviceProperties(
+ const std::string& device_path,
+ const GetDevicePropertiesCallback& callback,
+ const ErrorCallback& error_callback) OVERRIDE {}
virtual void SetUpConnections(
- MountEventHandler mount_event_handler,
- MountCompletedHandler mount_completed_handler) OVERRIDE {}
+ const MountEventHandler& mount_event_handler,
+ const MountCompletedHandler& mount_completed_handler) OVERRIDE {}
private:
DISALLOW_COPY_AND_ASSIGN(CrosDisksClientStubImpl);
diff --git a/chromeos/dbus/cros_disks_client.h b/chromeos/dbus/cros_disks_client.h
index df7cf49..88e6aee 100644
--- a/chromeos/dbus/cros_disks_client.h
+++ b/chromeos/dbus/cros_disks_client.h
@@ -180,40 +180,40 @@ class CHROMEOS_EXPORT CrosDisksClient {
// otherwise, |error_callback| is called.
virtual void Mount(const std::string& source_path,
MountType type,
- MountCallback callback,
- ErrorCallback error_callback) = 0;
+ const MountCallback& callback,
+ const ErrorCallback& error_callback) = 0;
// Calls Unmount method. |callback| is called after the method call succeeds,
// otherwise, |error_callback| is called.
virtual void Unmount(const std::string& device_path,
- UnmountCallback callback,
- ErrorCallback error_callback) = 0;
+ const UnmountCallback& callback,
+ const ErrorCallback& error_callback) = 0;
// Calls EnumerateAutoMountableDevices method. |callback| is called after the
// method call succeeds, otherwise, |error_callback| is called.
virtual void EnumerateAutoMountableDevices(
- EnumerateAutoMountableDevicesCallback callback,
- ErrorCallback error_callback) = 0;
+ const EnumerateAutoMountableDevicesCallback& callback,
+ const ErrorCallback& error_callback) = 0;
// Calls FormatDevice method. |callback| is called after the method call
// succeeds, otherwise, |error_callback| is called.
virtual void FormatDevice(const std::string& device_path,
const std::string& filesystem,
- FormatDeviceCallback callback,
- ErrorCallback error_callback) = 0;
+ const FormatDeviceCallback& callback,
+ const ErrorCallback& error_callback) = 0;
// Calls GetDeviceProperties method. |callback| is called after the method
// call succeeds, otherwise, |error_callback| is called.
virtual void GetDeviceProperties(const std::string& device_path,
- GetDevicePropertiesCallback callback,
- ErrorCallback error_callback) = 0;
+ const GetDevicePropertiesCallback& callback,
+ const ErrorCallback& error_callback) = 0;
// Registers given callback for events.
// |mount_event_handler| is called when mount event signal is received.
// |mount_completed_handler| is called when MountCompleted signal is received.
virtual void SetUpConnections(
- MountEventHandler mount_event_handler,
- MountCompletedHandler mount_completed_handler) = 0;
+ const MountEventHandler& mount_event_handler,
+ const MountCompletedHandler& mount_completed_handler) = 0;
// Factory function, creates a new instance and returns ownership.
// For normal usage, access the singleton via DBusThreadManager::Get().
diff --git a/chromeos/dbus/cryptohome_client.cc b/chromeos/dbus/cryptohome_client.cc
index b4d9e3f..14fa92b1 100644
--- a/chromeos/dbus/cryptohome_client.cc
+++ b/chromeos/dbus/cryptohome_client.cc
@@ -42,7 +42,7 @@ class CryptohomeClientImpl : public CryptohomeClient {
}
// CryptohomeClient override.
- virtual void SetAsyncCallStatusHandler(AsyncCallStatusHandler handler)
+ virtual void SetAsyncCallStatusHandler(const AsyncCallStatusHandler& handler)
OVERRIDE {
async_call_status_handler_ = handler;
}
@@ -67,7 +67,7 @@ class CryptohomeClientImpl : public CryptohomeClient {
// CryptohomeClient override.
virtual void AsyncCheckKey(const std::string& username,
const std::string& key,
- AsyncMethodCallback callback) OVERRIDE {
+ const AsyncMethodCallback& callback) OVERRIDE {
INITIALIZE_METHOD_CALL(method_call, cryptohome::kCryptohomeAsyncCheckKey);
dbus::MessageWriter writer(&method_call);
writer.AppendString(username);
@@ -82,7 +82,7 @@ class CryptohomeClientImpl : public CryptohomeClient {
virtual void AsyncMigrateKey(const std::string& username,
const std::string& from_key,
const std::string& to_key,
- AsyncMethodCallback callback) OVERRIDE {
+ const AsyncMethodCallback& callback) OVERRIDE {
INITIALIZE_METHOD_CALL(method_call, cryptohome::kCryptohomeAsyncMigrateKey);
dbus::MessageWriter writer(&method_call);
writer.AppendString(username);
@@ -96,7 +96,7 @@ class CryptohomeClientImpl : public CryptohomeClient {
// CryptohomeClient override.
virtual void AsyncRemove(const std::string& username,
- AsyncMethodCallback callback) OVERRIDE {
+ const AsyncMethodCallback& callback) OVERRIDE {
INITIALIZE_METHOD_CALL(method_call, cryptohome::kCryptohomeAsyncRemove);
dbus::MessageWriter writer(&method_call);
writer.AppendString(username);
@@ -126,7 +126,7 @@ class CryptohomeClientImpl : public CryptohomeClient {
virtual void AsyncMount(const std::string& username,
const std::string& key,
const bool create_if_missing,
- AsyncMethodCallback callback) OVERRIDE {
+ const AsyncMethodCallback& callback) OVERRIDE {
INITIALIZE_METHOD_CALL(method_call, cryptohome::kCryptohomeAsyncMount);
dbus::MessageWriter writer(&method_call);
writer.AppendString(username);
@@ -142,7 +142,7 @@ class CryptohomeClientImpl : public CryptohomeClient {
}
// CryptohomeClient override.
- virtual void AsyncMountGuest(AsyncMethodCallback callback) OVERRIDE {
+ virtual void AsyncMountGuest(const AsyncMethodCallback& callback) OVERRIDE {
INITIALIZE_METHOD_CALL(method_call, cryptohome::kCryptohomeAsyncMountGuest);
proxy_->CallMethod(&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&CryptohomeClientImpl::OnAsyncMethodCall,
@@ -157,7 +157,7 @@ class CryptohomeClientImpl : public CryptohomeClient {
}
// CryptohomeClient override.
- virtual void TpmIsEnabled(BoolMethodCallback callback) OVERRIDE {
+ virtual void TpmIsEnabled(const BoolMethodCallback& callback) OVERRIDE {
INITIALIZE_METHOD_CALL(method_call, cryptohome::kCryptohomeTpmIsEnabled);
proxy_->CallMethod(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
@@ -219,7 +219,7 @@ class CryptohomeClientImpl : public CryptohomeClient {
}
// CryptohomeClient override.
- virtual void Pkcs11IsTpmTokenReady(BoolMethodCallback callback)
+ virtual void Pkcs11IsTpmTokenReady(const BoolMethodCallback& callback)
OVERRIDE {
INITIALIZE_METHOD_CALL(method_call,
cryptohome::kCryptohomePkcs11IsTpmTokenReady);
@@ -232,8 +232,8 @@ class CryptohomeClientImpl : public CryptohomeClient {
}
// CryptohomeClient override.
- virtual void Pkcs11GetTpmTokenInfo(Pkcs11GetTpmTokenInfoCallback callback)
- OVERRIDE {
+ virtual void Pkcs11GetTpmTokenInfo(
+ const Pkcs11GetTpmTokenInfoCallback& callback) OVERRIDE {
INITIALIZE_METHOD_CALL(method_call,
cryptohome::kCryptohomePkcs11GetTpmTokenInfo);
proxy_->CallMethod(
@@ -309,7 +309,7 @@ class CryptohomeClientImpl : public CryptohomeClient {
private:
// Handles the result of AsyncXXX methods.
- void OnAsyncMethodCall(AsyncMethodCallback callback,
+ void OnAsyncMethodCall(const AsyncMethodCallback& callback,
dbus::Response* response) {
if (!response)
return;
@@ -334,7 +334,7 @@ class CryptohomeClientImpl : public CryptohomeClient {
}
// Handles responses for methods with a bool value result.
- void OnBoolMethod(BoolMethodCallback callback,
+ void OnBoolMethod(const BoolMethodCallback& callback,
dbus::Response* response) {
if (!response) {
callback.Run(DBUS_METHOD_CALL_FAILURE, false);
@@ -350,7 +350,7 @@ class CryptohomeClientImpl : public CryptohomeClient {
}
// Handles responses for Pkcs11GetTpmtTokenInfo.
- void OnPkcs11GetTpmTokenInfo(Pkcs11GetTpmTokenInfoCallback callback,
+ void OnPkcs11GetTpmTokenInfo(const Pkcs11GetTpmTokenInfoCallback& callback,
dbus::Response* response) {
if (!response) {
callback.Run(DBUS_METHOD_CALL_FAILURE, std::string(), std::string());
@@ -411,7 +411,7 @@ class CryptohomeClientStubImpl : public CryptohomeClient {
virtual ~CryptohomeClientStubImpl() {}
// CryptohomeClient override.
- virtual void SetAsyncCallStatusHandler(AsyncCallStatusHandler handler)
+ virtual void SetAsyncCallStatusHandler(const AsyncCallStatusHandler& handler)
OVERRIDE {
async_call_status_handler_ = handler;
}
@@ -436,7 +436,7 @@ class CryptohomeClientStubImpl : public CryptohomeClient {
// CryptohomeClient override.
virtual void AsyncCheckKey(const std::string& username,
const std::string& key,
- AsyncMethodCallback callback) OVERRIDE {
+ const AsyncMethodCallback& callback) OVERRIDE {
ReturnAsyncMethodResult(callback);
}
@@ -444,13 +444,13 @@ class CryptohomeClientStubImpl : public CryptohomeClient {
virtual void AsyncMigrateKey(const std::string& username,
const std::string& from_key,
const std::string& to_key,
- AsyncMethodCallback callback) OVERRIDE {
+ const AsyncMethodCallback& callback) OVERRIDE {
ReturnAsyncMethodResult(callback);
}
// CryptohomeClient override.
virtual void AsyncRemove(const std::string& username,
- AsyncMethodCallback callback) OVERRIDE {
+ const AsyncMethodCallback& callback) OVERRIDE {
ReturnAsyncMethodResult(callback);
}
@@ -466,12 +466,12 @@ class CryptohomeClientStubImpl : public CryptohomeClient {
virtual void AsyncMount(const std::string& username,
const std::string& key,
const bool create_if_missing,
- AsyncMethodCallback callback) OVERRIDE {
+ const AsyncMethodCallback& callback) OVERRIDE {
ReturnAsyncMethodResult(callback);
}
// CryptohomeClient override.
- virtual void AsyncMountGuest(AsyncMethodCallback callback) OVERRIDE {
+ virtual void AsyncMountGuest(const AsyncMethodCallback& callback) OVERRIDE {
ReturnAsyncMethodResult(callback);
}
@@ -482,7 +482,7 @@ class CryptohomeClientStubImpl : public CryptohomeClient {
}
// CryptohomeClient override.
- virtual void TpmIsEnabled(BoolMethodCallback callback) OVERRIDE {
+ virtual void TpmIsEnabled(const BoolMethodCallback& callback) OVERRIDE {
MessageLoop::current()->PostTask(
FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
}
@@ -519,14 +519,15 @@ class CryptohomeClientStubImpl : public CryptohomeClient {
virtual bool TpmClearStoredPassword() OVERRIDE { return true; }
// CryptohomeClient override.
- virtual void Pkcs11IsTpmTokenReady(BoolMethodCallback callback) OVERRIDE {
+ virtual void Pkcs11IsTpmTokenReady(
+ const BoolMethodCallback& callback) OVERRIDE {
MessageLoop::current()->PostTask(
FROM_HERE, base::Bind(callback, DBUS_METHOD_CALL_SUCCESS, true));
}
// CryptohomeClient override.
virtual void Pkcs11GetTpmTokenInfo(
- Pkcs11GetTpmTokenInfoCallback callback) OVERRIDE {
+ const Pkcs11GetTpmTokenInfoCallback& callback) OVERRIDE {
const char kStubLabel[] = "Stub TPM Token";
const char kStubUserPin[] = "012345";
MessageLoop::current()->PostTask(
@@ -585,7 +586,7 @@ class CryptohomeClientStubImpl : public CryptohomeClient {
private:
// Posts tasks which return fake results to the UI thread.
- void ReturnAsyncMethodResult(AsyncMethodCallback callback) {
+ void ReturnAsyncMethodResult(const AsyncMethodCallback& callback) {
MessageLoop::current()->PostTask(
FROM_HERE,
base::Bind(&CryptohomeClientStubImpl::ReturnAsyncMethodResultInternal,
@@ -594,7 +595,7 @@ class CryptohomeClientStubImpl : public CryptohomeClient {
}
// This method is used to implement ReturnAsyncMethodResult.
- void ReturnAsyncMethodResultInternal(AsyncMethodCallback callback) {
+ void ReturnAsyncMethodResultInternal(const AsyncMethodCallback& callback) {
callback.Run(async_call_id_);
if (!async_call_status_handler_.is_null()) {
MessageLoop::current()->PostTask(
diff --git a/chromeos/dbus/cryptohome_client.h b/chromeos/dbus/cryptohome_client.h
index df93832..a152e44 100644
--- a/chromeos/dbus/cryptohome_client.h
+++ b/chromeos/dbus/cryptohome_client.h
@@ -51,7 +51,8 @@ class CHROMEOS_EXPORT CryptohomeClient {
// |handler| is called when results for AsyncXXX methods are returned.
// Cryptohome service will process the calls in a first-in-first-out manner
// when they are made in parallel.
- virtual void SetAsyncCallStatusHandler(AsyncCallStatusHandler handler) = 0;
+ virtual void SetAsyncCallStatusHandler(
+ const AsyncCallStatusHandler& handler) = 0;
// Resets AsyncCallStatus signal handler.
virtual void ResetAsyncCallStatusHandler() = 0;
@@ -68,19 +69,19 @@ class CHROMEOS_EXPORT CryptohomeClient {
// succeeds.
virtual void AsyncCheckKey(const std::string& username,
const std::string& key,
- AsyncMethodCallback callback) = 0;
+ const AsyncMethodCallback& callback) = 0;
// Calls AsyncMigrateKey method. |callback| is called after the method call
// succeeds.
virtual void AsyncMigrateKey(const std::string& username,
const std::string& from_key,
const std::string& to_key,
- AsyncMethodCallback callback) = 0;
+ const AsyncMethodCallback& callback) = 0;
// Calls AsyncRemove method. |callback| is called after the method call
// succeeds.
virtual void AsyncRemove(const std::string& username,
- AsyncMethodCallback callback) = 0;
+ const AsyncMethodCallback& callback) = 0;
// Calls GetSystemSalt method. This method blocks until the call returns.
// The original content of |salt| is lost.
@@ -91,18 +92,18 @@ class CHROMEOS_EXPORT CryptohomeClient {
virtual void AsyncMount(const std::string& username,
const std::string& key,
const bool create_if_missing,
- AsyncMethodCallback callback) = 0;
+ const AsyncMethodCallback& callback) = 0;
// Calls AsyncMountGuest method. |callback| is called after the method call
// succeeds.
- virtual void AsyncMountGuest(AsyncMethodCallback callback) = 0;
+ virtual void AsyncMountGuest(const AsyncMethodCallback& callback) = 0;
// Calls TpmIsReady method and returns true when the call succeeds.
// This method blocks until the call returns.
virtual bool TpmIsReady(bool* ready) = 0;
// Calls TpmIsEnabled method.
- virtual void TpmIsEnabled(BoolMethodCallback callback) = 0;
+ virtual void TpmIsEnabled(const BoolMethodCallback& callback) = 0;
// Calls TpmIsEnabled method and returns true when the call succeeds.
// This method blocks until the call returns.
@@ -131,11 +132,11 @@ class CHROMEOS_EXPORT CryptohomeClient {
virtual bool TpmClearStoredPassword() = 0;
// Calls Pkcs11IsTpmTokenReady method.
- virtual void Pkcs11IsTpmTokenReady(BoolMethodCallback callback) = 0;
+ virtual void Pkcs11IsTpmTokenReady(const BoolMethodCallback& callback) = 0;
// Calls Pkcs11GetTpmTokenInfo method.
virtual void Pkcs11GetTpmTokenInfo(
- Pkcs11GetTpmTokenInfoCallback callback) = 0;
+ const Pkcs11GetTpmTokenInfoCallback& callback) = 0;
// Calls InstallAttributesGet method and returns true when the call succeeds.
// This method blocks until the call returns.
diff --git a/chromeos/dbus/flimflam_client_unittest_base.cc b/chromeos/dbus/flimflam_client_unittest_base.cc
index d9591f8..62bdeab 100644
--- a/chromeos/dbus/flimflam_client_unittest_base.cc
+++ b/chromeos/dbus/flimflam_client_unittest_base.cc
@@ -67,7 +67,7 @@ void FlimflamClientUnittestBase::TearDown() {
void FlimflamClientUnittestBase::PrepareForMethodCall(
const std::string& method_name,
- ArgumentCheckCallback argument_checker,
+ const ArgumentCheckCallback& argument_checker,
dbus::Response* response) {
expected_method_name_ = method_name;
argument_checker_ = argument_checker;
@@ -147,8 +147,8 @@ void FlimflamClientUnittestBase::ExpectDictionaryValueResult(
void FlimflamClientUnittestBase::OnConnectToSignal(
const std::string& interface_name,
const std::string& signal_name,
- dbus::ObjectProxy::SignalCallback signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback) {
+ const dbus::ObjectProxy::SignalCallback& signal_callback,
+ const dbus::ObjectProxy::OnConnectedCallback& on_connected_callback) {
property_changed_handler_ = signal_callback;
const bool success = true;
message_loop_.PostTask(FROM_HERE,
@@ -161,7 +161,7 @@ void FlimflamClientUnittestBase::OnConnectToSignal(
void FlimflamClientUnittestBase::OnCallMethod(
dbus::MethodCall* method_call,
int timeout_ms,
- dbus::ObjectProxy::ResponseCallback response_callback) {
+ const dbus::ObjectProxy::ResponseCallback& response_callback) {
EXPECT_EQ(interface_name_, method_call->GetInterface());
EXPECT_EQ(expected_method_name_, method_call->GetMember());
dbus::MessageReader reader(method_call);
diff --git a/chromeos/dbus/flimflam_client_unittest_base.h b/chromeos/dbus/flimflam_client_unittest_base.h
index 9781fda..3c88b27 100644
--- a/chromeos/dbus/flimflam_client_unittest_base.h
+++ b/chromeos/dbus/flimflam_client_unittest_base.h
@@ -47,7 +47,7 @@ class FlimflamClientUnittestBase : public testing::Test {
// Sets expectations for called method name and arguments, and sets response.
void PrepareForMethodCall(const std::string& method_name,
- ArgumentCheckCallback argument_checker,
+ const ArgumentCheckCallback& argument_checker,
dbus::Response* response);
// Sends property changed signal to the tested client.
@@ -95,14 +95,15 @@ class FlimflamClientUnittestBase : public testing::Test {
void OnConnectToSignal(
const std::string& interface_name,
const std::string& signal_name,
- dbus::ObjectProxy::SignalCallback signal_callback,
- dbus::ObjectProxy::OnConnectedCallback on_connected_callback);
+ const dbus::ObjectProxy::SignalCallback& signal_callback,
+ const dbus::ObjectProxy::OnConnectedCallback& on_connected_callback);
// Checks the content of the method call and returns the response.
// Used to implement the mock proxy.
- void OnCallMethod(dbus::MethodCall* method_call,
- int timeout_ms,
- dbus::ObjectProxy::ResponseCallback response_callback);
+ void OnCallMethod(
+ dbus::MethodCall* method_call,
+ int timeout_ms,
+ const dbus::ObjectProxy::ResponseCallback& response_callback);
// The interface name.
const std::string interface_name_;
diff --git a/chromeos/dbus/image_burner_client.cc b/chromeos/dbus/image_burner_client.cc
index 343c02d..4119bf0 100644
--- a/chromeos/dbus/image_burner_client.cc
+++ b/chromeos/dbus/image_burner_client.cc
@@ -45,7 +45,7 @@ class ImageBurnerClientImpl : public ImageBurnerClient {
// ImageBurnerClient override.
virtual void BurnImage(const std::string& from_path,
const std::string& to_path,
- ErrorCallback error_callback) OVERRIDE {
+ const ErrorCallback& error_callback) OVERRIDE {
dbus::MethodCall method_call(imageburn::kImageBurnServiceInterface,
imageburn::kBurnImage);
dbus::MessageWriter writer(&method_call);
@@ -59,8 +59,8 @@ class ImageBurnerClientImpl : public ImageBurnerClient {
// ImageBurnerClient override.
virtual void SetEventHandlers(
- BurnFinishedHandler burn_finished_handler,
- BurnProgressUpdateHandler burn_progress_update_handler) OVERRIDE {
+ const BurnFinishedHandler& burn_finished_handler,
+ const BurnProgressUpdateHandler& burn_progress_update_handler) OVERRIDE {
burn_finished_handler_ = burn_finished_handler;
burn_progress_update_handler_ = burn_progress_update_handler;
}
@@ -136,10 +136,10 @@ class ImageBurnerClientStubImpl : public ImageBurnerClient {
virtual ~ImageBurnerClientStubImpl() {}
virtual void BurnImage(const std::string& from_path,
const std::string& to_path,
- ErrorCallback error_callback) OVERRIDE {}
+ const ErrorCallback& error_callback) OVERRIDE {}
virtual void SetEventHandlers(
- BurnFinishedHandler burn_finished_handler,
- BurnProgressUpdateHandler burn_progress_update_handler) OVERRIDE {}
+ const BurnFinishedHandler& burn_finished_handler,
+ const BurnProgressUpdateHandler& burn_progress_update_handler) OVERRIDE {}
virtual void ResetEventHandlers() OVERRIDE {}
private:
diff --git a/chromeos/dbus/image_burner_client.h b/chromeos/dbus/image_burner_client.h
index 513496d..5368eb0 100644
--- a/chromeos/dbus/image_burner_client.h
+++ b/chromeos/dbus/image_burner_client.h
@@ -42,15 +42,15 @@ class CHROMEOS_EXPORT ImageBurnerClient {
// Burns the image |from_path| to the disk |to_path|.
virtual void BurnImage(const std::string& from_path,
const std::string& to_path,
- ErrorCallback error_callback) = 0;
+ const ErrorCallback& error_callback) = 0;
// Sets callbacks as event handlers.
// |burn_finished_handler| is called when burn_finished signal is received.
// |burn_progress_update_handler| is called when burn_progress_update signal
// is received.
virtual void SetEventHandlers(
- BurnFinishedHandler burn_finished_handler,
- BurnProgressUpdateHandler burn_progress_update_handler) = 0;
+ const BurnFinishedHandler& burn_finished_handler,
+ const BurnProgressUpdateHandler& burn_progress_update_handler) = 0;
// Resets event handlers. After calling this method, nothing is done when
// signals are received.
diff --git a/chromeos/dbus/mock_cashew_client.h b/chromeos/dbus/mock_cashew_client.h
index c4167dc..fcff9a9 100644
--- a/chromeos/dbus/mock_cashew_client.h
+++ b/chromeos/dbus/mock_cashew_client.h
@@ -16,7 +16,8 @@ class MockCashewClient : public CashewClient {
MockCashewClient();
virtual ~MockCashewClient();
- MOCK_METHOD1(SetDataPlansUpdateHandler, void(DataPlansUpdateHandler handler));
+ MOCK_METHOD1(SetDataPlansUpdateHandler,
+ void(const DataPlansUpdateHandler& handler));
MOCK_METHOD0(ResetDataPlansUpdateHandler, void());
MOCK_METHOD0(RequestDataPlansUpdate, void());
};
diff --git a/chromeos/dbus/mock_cros_disks_client.h b/chromeos/dbus/mock_cros_disks_client.h
index 0b242f98..b258935 100644
--- a/chromeos/dbus/mock_cros_disks_client.h
+++ b/chromeos/dbus/mock_cros_disks_client.h
@@ -18,18 +18,25 @@ class MockCrosDisksClient : public CrosDisksClient {
MockCrosDisksClient();
virtual ~MockCrosDisksClient();
- MOCK_METHOD4(Mount, void(const std::string&, MountType, MountCallback,
- ErrorCallback));
- MOCK_METHOD3(Unmount, void(const std::string&, UnmountCallback,
- ErrorCallback));
- MOCK_METHOD2(EnumerateAutoMountableDevices, void(
- EnumerateAutoMountableDevicesCallback, ErrorCallback));
- MOCK_METHOD4(FormatDevice, void(const std::string&, const std::string&,
- FormatDeviceCallback, ErrorCallback));
- MOCK_METHOD3(GetDeviceProperties, void(
- const std::string&, GetDevicePropertiesCallback, ErrorCallback));
- MOCK_METHOD2(SetUpConnections, void(MountEventHandler,
- MountCompletedHandler));
+ MOCK_METHOD4(Mount, void(const std::string&,
+ MountType,
+ const MountCallback&,
+ const ErrorCallback&));
+ MOCK_METHOD3(Unmount, void(const std::string&,
+ const UnmountCallback&,
+ const ErrorCallback&));
+ MOCK_METHOD2(EnumerateAutoMountableDevices,
+ void(const EnumerateAutoMountableDevicesCallback&,
+ const ErrorCallback&));
+ MOCK_METHOD4(FormatDevice, void(const std::string&,
+ const std::string&,
+ const FormatDeviceCallback&,
+ const ErrorCallback&));
+ MOCK_METHOD3(GetDeviceProperties, void(const std::string&,
+ const GetDevicePropertiesCallback&,
+ const ErrorCallback&));
+ MOCK_METHOD2(SetUpConnections, void(const MountEventHandler&,
+ const MountCompletedHandler&));
};
} // namespace chromeos
diff --git a/chromeos/dbus/mock_cryptohome_client.h b/chromeos/dbus/mock_cryptohome_client.h
index ad6c327..ff5f0b1 100644
--- a/chromeos/dbus/mock_cryptohome_client.h
+++ b/chromeos/dbus/mock_cryptohome_client.h
@@ -18,39 +18,40 @@ class MockCryptohomeClient : public CryptohomeClient {
MockCryptohomeClient();
virtual ~MockCryptohomeClient();
- MOCK_METHOD1(SetAsyncCallStatusHandler, void(AsyncCallStatusHandler handler));
+ MOCK_METHOD1(SetAsyncCallStatusHandler,
+ void(const AsyncCallStatusHandler& handler));
MOCK_METHOD0(ResetAsyncCallStatusHandler, void());
MOCK_METHOD1(IsMounted, bool(bool* is_mounted));
MOCK_METHOD1(Unmount, bool(bool* success));
MOCK_METHOD3(AsyncCheckKey,
void(const std::string& username,
const std::string& key,
- base::Callback<void(int async_id)> callback));
+ const AsyncMethodCallback& callback));
MOCK_METHOD4(AsyncMigrateKey,
void(const std::string& username,
const std::string& from_key,
const std::string& to_key,
- base::Callback<void(int async_id)> callback));
+ const AsyncMethodCallback& callback));
MOCK_METHOD2(AsyncRemove, void(const std::string& username,
- base::Callback<void(int async_id)> callback));
+ const AsyncMethodCallback& callback));
MOCK_METHOD1(GetSystemSalt, bool(std::vector<uint8>* salt));
MOCK_METHOD4(AsyncMount, void(const std::string& username,
const std::string& key,
const bool create_if_missing,
- base::Callback<void(int async_id)> callback));
+ const AsyncMethodCallback& callback));
MOCK_METHOD1(AsyncMountGuest,
- void(base::Callback<void(int async_id)> callback));
+ void(const AsyncMethodCallback& callback));
MOCK_METHOD1(TpmIsReady, bool(bool* ready));
- MOCK_METHOD1(TpmIsEnabled, void(BoolMethodCallback callback));
+ MOCK_METHOD1(TpmIsEnabled, void(const BoolMethodCallback& callback));
MOCK_METHOD1(CallTpmIsEnabledAndBlock, bool(bool* enabled));
MOCK_METHOD1(TpmGetPassword, bool(std::string* password));
MOCK_METHOD1(TpmIsOwned, bool(bool* owned));
MOCK_METHOD1(TpmIsBeingOwned, bool(bool* owning));
MOCK_METHOD0(TpmCanAttemptOwnership, bool());
MOCK_METHOD0(TpmClearStoredPassword, bool());
- MOCK_METHOD1(Pkcs11IsTpmTokenReady, void(BoolMethodCallback callback));
+ MOCK_METHOD1(Pkcs11IsTpmTokenReady, void(const BoolMethodCallback& callback));
MOCK_METHOD1(Pkcs11GetTpmTokenInfo,
- void(Pkcs11GetTpmTokenInfoCallback callback));
+ void(const Pkcs11GetTpmTokenInfoCallback& callback));
MOCK_METHOD3(InstallAttributesGet,
bool(const std::string& name,
std::vector<uint8>* value,
diff --git a/chromeos/dbus/mock_image_burner_client.h b/chromeos/dbus/mock_image_burner_client.h
index 8db0a44..6cb31fe 100644
--- a/chromeos/dbus/mock_image_burner_client.h
+++ b/chromeos/dbus/mock_image_burner_client.h
@@ -18,10 +18,11 @@ class MockImageBurnerClient : public ImageBurnerClient {
MockImageBurnerClient();
virtual ~MockImageBurnerClient();
- MOCK_METHOD3(BurnImage,
- void(const std::string&, const std::string&, ErrorCallback));
- MOCK_METHOD2(SetEventHandlers,
- void(BurnFinishedHandler, BurnProgressUpdateHandler));
+ MOCK_METHOD3(BurnImage, void(const std::string&,
+ const std::string&,
+ const ErrorCallback&));
+ MOCK_METHOD2(SetEventHandlers, void(const BurnFinishedHandler&,
+ const BurnProgressUpdateHandler&));
MOCK_METHOD0(ResetEventHandlers, void());
};
diff --git a/chromeos/dbus/mock_power_manager_client.h b/chromeos/dbus/mock_power_manager_client.h
index e4eb030..81e8fdd 100644
--- a/chromeos/dbus/mock_power_manager_client.h
+++ b/chromeos/dbus/mock_power_manager_client.h
@@ -31,10 +31,11 @@ class MockPowerManagerClient : public PowerManagerClient {
MOCK_METHOD1(CalculateIdleTime, void(const CalculateIdleTimeCallback&));
MOCK_METHOD1(RequestIdleNotification, void(int64));
MOCK_METHOD0(RequestActiveNotification, void(void));
- MOCK_METHOD4(RequestPowerStateOverrides, void(uint32,
- uint32,
- int,
- PowerStateRequestIdCallback));
+ MOCK_METHOD4(RequestPowerStateOverrides,
+ void(uint32,
+ uint32,
+ int,
+ const PowerStateRequestIdCallback&));
MOCK_METHOD0(NotifyScreenLockRequested, void(void));
MOCK_METHOD0(NotifyScreenLockCompleted, void(void));
MOCK_METHOD0(NotifyScreenUnlockRequested, void(void));
diff --git a/chromeos/dbus/mock_session_manager_client.h b/chromeos/dbus/mock_session_manager_client.h
index 6ed73bb..b8632b54 100644
--- a/chromeos/dbus/mock_session_manager_client.h
+++ b/chromeos/dbus/mock_session_manager_client.h
@@ -25,12 +25,12 @@ class MockSessionManagerClient : public SessionManagerClient {
MOCK_METHOD2(RestartJob, void(int, const std::string&));
MOCK_METHOD1(StartSession, void(const std::string&));
MOCK_METHOD0(StopSession, void(void));
- MOCK_METHOD1(RetrieveDevicePolicy, void(RetrievePolicyCallback));
- MOCK_METHOD1(RetrieveUserPolicy, void(RetrievePolicyCallback));
+ MOCK_METHOD1(RetrieveDevicePolicy, void(const RetrievePolicyCallback&));
+ MOCK_METHOD1(RetrieveUserPolicy, void(const RetrievePolicyCallback&));
MOCK_METHOD2(StoreDevicePolicy, void(const std::string&,
- StorePolicyCallback));
+ const StorePolicyCallback&));
MOCK_METHOD2(StoreUserPolicy, void(const std::string&,
- StorePolicyCallback));
+ const StorePolicyCallback&));
};
} // namespace chromeos
diff --git a/chromeos/dbus/mock_update_engine_client.h b/chromeos/dbus/mock_update_engine_client.h
index 385a0c5..70cff66 100644
--- a/chromeos/dbus/mock_update_engine_client.h
+++ b/chromeos/dbus/mock_update_engine_client.h
@@ -20,10 +20,10 @@ class MockUpdateEngineClient : public UpdateEngineClient {
MOCK_METHOD1(AddObserver, void(Observer*));
MOCK_METHOD1(RemoveObserver, void(Observer*));
MOCK_METHOD1(HasObserver, bool(Observer*));
- MOCK_METHOD1(RequestUpdateCheck, void(UpdateCheckCallback));
+ MOCK_METHOD1(RequestUpdateCheck, void(const UpdateCheckCallback&));
MOCK_METHOD0(RebootAfterUpdate, void());
MOCK_METHOD1(SetReleaseTrack, void(const std::string&));
- MOCK_METHOD1(GetReleaseTrack, void(GetReleaseTrackCallback));
+ MOCK_METHOD1(GetReleaseTrack, void(const GetReleaseTrackCallback&));
MOCK_METHOD0(GetLastStatus, Status());
};
diff --git a/chromeos/dbus/power_manager_client.cc b/chromeos/dbus/power_manager_client.cc
index 43532aa..010b45c 100644
--- a/chromeos/dbus/power_manager_client.cc
+++ b/chromeos/dbus/power_manager_client.cc
@@ -224,7 +224,7 @@ class PowerManagerClientImpl : public PowerManagerClient {
uint32 request_id,
uint32 duration,
int overrides,
- PowerStateRequestIdCallback callback) OVERRIDE {
+ const PowerStateRequestIdCallback& callback) OVERRIDE {
dbus::MethodCall method_call(power_manager::kPowerManagerInterface,
power_manager::kStateOverrideRequest);
dbus::MessageWriter writer(&method_call);
@@ -544,7 +544,7 @@ class PowerManagerClientStubImpl : public PowerManagerClient {
uint32 request_id,
uint32 duration,
int overrides,
- PowerStateRequestIdCallback callback) OVERRIDE {}
+ const PowerStateRequestIdCallback& callback) OVERRIDE {}
virtual void NotifyScreenLockRequested() OVERRIDE {
FOR_EACH_OBSERVER(Observer, observers_, LockScreen());
diff --git a/chromeos/dbus/power_manager_client.h b/chromeos/dbus/power_manager_client.h
index 3100de8..eb19947 100644
--- a/chromeos/dbus/power_manager_client.h
+++ b/chromeos/dbus/power_manager_client.h
@@ -162,7 +162,7 @@ class CHROMEOS_EXPORT PowerManagerClient {
uint32 request_id,
uint32 duration,
int overrides,
- PowerStateRequestIdCallback callback) = 0;
+ const PowerStateRequestIdCallback& callback) = 0;
// Creates the instance.
static PowerManagerClient* Create(DBusClientImplementationType type,
diff --git a/chromeos/dbus/session_manager_client.cc b/chromeos/dbus/session_manager_client.cc
index b96d2ad..6c40353 100644
--- a/chromeos/dbus/session_manager_client.cc
+++ b/chromeos/dbus/session_manager_client.cc
@@ -134,27 +134,29 @@ class SessionManagerClientImpl : public SessionManagerClient {
}
// SessionManagerClient override.
- virtual void RetrieveDevicePolicy(RetrievePolicyCallback callback) OVERRIDE {
+ virtual void RetrieveDevicePolicy(
+ const RetrievePolicyCallback& callback) OVERRIDE {
CallRetrievePolicy(login_manager::kSessionManagerRetrievePolicy,
callback);
}
// SessionManagerClient override.
- virtual void RetrieveUserPolicy(RetrievePolicyCallback callback) OVERRIDE {
+ virtual void RetrieveUserPolicy(
+ const RetrievePolicyCallback& callback) OVERRIDE {
CallRetrievePolicy(login_manager::kSessionManagerRetrieveUserPolicy,
callback);
}
// SessionManagerClient override.
virtual void StoreDevicePolicy(const std::string& policy_blob,
- StorePolicyCallback callback) OVERRIDE {
+ const StorePolicyCallback& callback) OVERRIDE {
CallStorePolicy(login_manager::kSessionManagerStorePolicy,
policy_blob, callback);
}
// SessionManagerClient override.
virtual void StoreUserPolicy(const std::string& policy_blob,
- StorePolicyCallback callback) OVERRIDE {
+ const StorePolicyCallback& callback) OVERRIDE {
CallStorePolicy(login_manager::kSessionManagerStoreUserPolicy,
policy_blob, callback);
}
@@ -162,7 +164,7 @@ class SessionManagerClientImpl : public SessionManagerClient {
private:
// Helper for Retrieve{User,Device}Policy.
virtual void CallRetrievePolicy(const std::string& method_name,
- RetrievePolicyCallback callback) {
+ const RetrievePolicyCallback& callback) {
dbus::MethodCall method_call(login_manager::kSessionManagerInterface,
method_name);
session_manager_proxy_->CallMethod(
@@ -177,7 +179,7 @@ class SessionManagerClientImpl : public SessionManagerClient {
// Helper for Store{User,Device}Policy.
virtual void CallStorePolicy(const std::string& method_name,
const std::string& policy_blob,
- StorePolicyCallback callback) {
+ const StorePolicyCallback& callback) {
dbus::MethodCall method_call(login_manager::kSessionManagerInterface,
method_name);
dbus::MessageWriter writer(&method_call);
@@ -238,7 +240,7 @@ class SessionManagerClientImpl : public SessionManagerClient {
// Called when kSessionManagerRetrievePolicy or
// kSessionManagerRetrieveUserPolicy method is complete.
void OnRetrievePolicy(const std::string& method_name,
- RetrievePolicyCallback callback,
+ const RetrievePolicyCallback& callback,
dbus::Response* response) {
if (!response) {
LOG(ERROR) << "Failed to call " << method_name;
@@ -261,7 +263,7 @@ class SessionManagerClientImpl : public SessionManagerClient {
// Called when kSessionManagerStorePolicy or kSessionManagerStoreUserPolicy
// method is complete.
void OnStorePolicy(const std::string& method_name,
- StorePolicyCallback callback,
+ const StorePolicyCallback& callback,
dbus::Response* response) {
bool success = false;
if (!response) {
@@ -324,18 +326,20 @@ class SessionManagerClientStubImpl : public SessionManagerClient {
virtual void RestartEntd() OVERRIDE {}
virtual void StartSession(const std::string& user_email) OVERRIDE {}
virtual void StopSession() OVERRIDE {}
- virtual void RetrieveDevicePolicy(RetrievePolicyCallback callback) OVERRIDE {
+ virtual void RetrieveDevicePolicy(
+ const RetrievePolicyCallback& callback) OVERRIDE {
callback.Run("");
}
- virtual void RetrieveUserPolicy(RetrievePolicyCallback callback) OVERRIDE {
+ virtual void RetrieveUserPolicy(
+ const RetrievePolicyCallback& callback) OVERRIDE {
callback.Run("");
}
virtual void StoreDevicePolicy(const std::string& policy_blob,
- StorePolicyCallback callback) OVERRIDE {
+ const StorePolicyCallback& callback) OVERRIDE {
callback.Run(true);
}
virtual void StoreUserPolicy(const std::string& policy_blob,
- StorePolicyCallback callback) OVERRIDE {
+ const StorePolicyCallback& callback) OVERRIDE {
callback.Run(true);
}
};
diff --git a/chromeos/dbus/session_manager_client.h b/chromeos/dbus/session_manager_client.h
index c6903f9..82382e3 100644
--- a/chromeos/dbus/session_manager_client.h
+++ b/chromeos/dbus/session_manager_client.h
@@ -60,12 +60,12 @@ class CHROMEOS_EXPORT SessionManagerClient {
// Fetches the device policy blob stored by the session manager. Upon
// completion of the retrieve attempt, we will call the provided callback.
- virtual void RetrieveDevicePolicy(RetrievePolicyCallback callback) = 0;
+ virtual void RetrieveDevicePolicy(const RetrievePolicyCallback& callback) = 0;
// Fetches the user policy blob stored by the session manager for the
// currently signed-in user. Upon completion of the retrieve attempt, we will
// call the provided callback.
- virtual void RetrieveUserPolicy(RetrievePolicyCallback callback) = 0;
+ virtual void RetrieveUserPolicy(const RetrievePolicyCallback& callback) = 0;
// Used for StoreDevicePolicy and StoreUserPolicy. Takes a boolean indicating
// whether the operation was successful or not.
@@ -74,13 +74,13 @@ class CHROMEOS_EXPORT SessionManagerClient {
// Attempts to asynchronously store |policy_blob| as device policy. Upon
// completion of the store attempt, we will call callback.
virtual void StoreDevicePolicy(const std::string& policy_blob,
- StorePolicyCallback callback) = 0;
+ const StorePolicyCallback& callback) = 0;
// Attempts to asynchronously store |policy_blob| as user policy for the
// currently signed-in user. Upon completion of the store attempt, we will
// call callback.
virtual void StoreUserPolicy(const std::string& policy_blob,
- StorePolicyCallback callback) = 0;
+ const StorePolicyCallback& callback) = 0;
// Creates the instance.
static SessionManagerClient* Create(DBusClientImplementationType type,
diff --git a/chromeos/dbus/update_engine_client.cc b/chromeos/dbus/update_engine_client.cc
index 55f5c68..5e3e21a 100644
--- a/chromeos/dbus/update_engine_client.cc
+++ b/chromeos/dbus/update_engine_client.cc
@@ -87,7 +87,8 @@ class UpdateEngineClientImpl : public UpdateEngineClient {
}
// UpdateEngineClient override.
- virtual void RequestUpdateCheck(UpdateCheckCallback callback) OVERRIDE {
+ virtual void RequestUpdateCheck(
+ const UpdateCheckCallback& callback) OVERRIDE {
dbus::MethodCall method_call(
update_engine::kUpdateEngineInterface,
update_engine::kAttemptUpdate);
@@ -135,7 +136,8 @@ class UpdateEngineClientImpl : public UpdateEngineClient {
}
// UpdateEngineClient override.
- virtual void GetReleaseTrack(GetReleaseTrackCallback callback) OVERRIDE {
+ virtual void GetReleaseTrack(
+ const GetReleaseTrackCallback& callback) OVERRIDE {
dbus::MethodCall method_call(
update_engine::kUpdateEngineInterface,
update_engine::kGetTrack);
@@ -156,7 +158,7 @@ class UpdateEngineClientImpl : public UpdateEngineClient {
private:
// Called when a response for RequestUpdateCheck() is received.
- void OnRequestUpdateCheck(UpdateCheckCallback callback,
+ void OnRequestUpdateCheck(const UpdateCheckCallback& callback,
dbus::Response* response) {
if (!response) {
LOG(ERROR) << "Failed to request update check";
@@ -183,7 +185,7 @@ class UpdateEngineClientImpl : public UpdateEngineClient {
}
// Called when a response for GetReleaseTrack() is received.
- void OnGetReleaseTrack(GetReleaseTrackCallback callback,
+ void OnGetReleaseTrack(const GetReleaseTrackCallback& callback,
dbus::Response* response) {
if (!response) {
LOG(ERROR) << "Failed to request getting release track";
@@ -254,12 +256,14 @@ class UpdateEngineClientStubImpl : public UpdateEngineClient {
virtual void RemoveObserver(Observer* observer) OVERRIDE {}
virtual bool HasObserver(Observer* observer) OVERRIDE { return false; }
- virtual void RequestUpdateCheck(UpdateCheckCallback callback) OVERRIDE {
+ virtual void RequestUpdateCheck(
+ const UpdateCheckCallback& callback) OVERRIDE {
callback.Run(UPDATE_RESULT_NOTIMPLEMENTED);
}
virtual void RebootAfterUpdate() OVERRIDE {}
virtual void SetReleaseTrack(const std::string& track) OVERRIDE {}
- virtual void GetReleaseTrack(GetReleaseTrackCallback callback) OVERRIDE {
+ virtual void GetReleaseTrack(
+ const GetReleaseTrackCallback& callback) OVERRIDE {
callback.Run("beta-channel");
}
virtual Status GetLastStatus() OVERRIDE { return Status(); }
diff --git a/chromeos/dbus/update_engine_client.h b/chromeos/dbus/update_engine_client.h
index 7d1692d..914094e 100644
--- a/chromeos/dbus/update_engine_client.h
+++ b/chromeos/dbus/update_engine_client.h
@@ -82,7 +82,7 @@ class CHROMEOS_EXPORT UpdateEngineClient {
typedef base::Callback<void(UpdateCheckResult)> UpdateCheckCallback;
// Requests an update check and calls |callback| when completed.
- virtual void RequestUpdateCheck(UpdateCheckCallback callback) = 0;
+ virtual void RequestUpdateCheck(const UpdateCheckCallback& callback) = 0;
// Reboots if update has been performed.
virtual void RebootAfterUpdate() = 0;
@@ -98,7 +98,7 @@ class CHROMEOS_EXPORT UpdateEngineClient {
// Requests to get the release track and calls |callback| with the
// release track (channel). On error, calls |callback| with an empty
// string.
- virtual void GetReleaseTrack(GetReleaseTrackCallback callback) = 0;
+ virtual void GetReleaseTrack(const GetReleaseTrackCallback& callback) = 0;
// Returns the last status the object received from the update engine.
//