Chromium Code Reviews| Index: chromeos/dbus/debug_daemon_client.cc |
| diff --git a/chromeos/dbus/debug_daemon_client.cc b/chromeos/dbus/debug_daemon_client.cc |
| index efd96a009cb8a8e90ef6fd153db79cc400212a2b..7fbf43a24b4050aaa211aaa657d60d699d95be01 100644 |
| --- a/chromeos/dbus/debug_daemon_client.cc |
| +++ b/chromeos/dbus/debug_daemon_client.cc |
| @@ -35,6 +35,13 @@ void EmptyStopSystemTracingCallbackBody( |
| } // namespace |
| +namespace debugd { |
| + |
| +const char kEnableDebuggingFeatures[] = "EnableChromeDevFeatures"; |
| +const char kRemoveRootfsVerification[] = "RemoveRootfsVerification"; |
| + |
| +} |
|
xiyuan
2014/10/30 03:52:09
nit: } // namespace debugd
zel
2014/10/31 01:22:26
Done.
|
| + |
| namespace chromeos { |
| // The DebugDaemonClient implementation used in production. |
| @@ -302,6 +309,35 @@ class DebugDaemonClientImpl : public DebugDaemonClient { |
| weak_ptr_factory_.GetWeakPtr())); |
| } |
| + virtual void EnableDebuggingFeatures( |
| + const std::string& password, |
| + const EnableDebuggingCallback& callback) override { |
| + dbus::MethodCall method_call(debugd::kDebugdInterface, |
| + debugd::kEnableDebuggingFeatures); |
| + dbus::MessageWriter writer(&method_call); |
| + writer.AppendString(password); |
| + debugdaemon_proxy_->CallMethod( |
| + &method_call, |
| + dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| + base::Bind(&DebugDaemonClientImpl::OnEnableDebuggingFeatures, |
| + weak_ptr_factory_.GetWeakPtr(), |
| + callback)); |
| + } |
| + |
| + |
| + virtual void RemoveRootfsVerification( |
|
xiyuan
2014/10/30 03:52:09
nit: move this before EnableDebuggingFeatures to m
zel
2014/10/31 01:22:26
Done.
|
| + const EnableDebuggingCallback& callback) override { |
| + dbus::MethodCall method_call(debugd::kDebugdInterface, |
| + debugd::kRemoveRootfsVerification); |
| + dbus::MessageWriter writer(&method_call); |
| + debugdaemon_proxy_->CallMethod( |
| + &method_call, |
| + dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| + base::Bind(&DebugDaemonClientImpl::OnRemoveRootfsVerification, |
| + weak_ptr_factory_.GetWeakPtr(), |
| + callback)); |
| + } |
| + |
| protected: |
| virtual void Init(dbus::Bus* bus) override { |
| debugdaemon_proxy_ = |
| @@ -459,6 +495,30 @@ class DebugDaemonClientImpl : public DebugDaemonClient { |
| } |
| } |
| + void OnEnableDebuggingFeatures( |
| + const EnableDebuggingCallback& callback, |
| + dbus::Response* response) { |
| + if (callback.is_null()) |
| + return; |
| + |
| + callback.Run(response != NULL); |
| + } |
| + |
| + void OnRemoveRootfsVerification( |
| + const EnableDebuggingCallback& callback, |
| + dbus::Response* response) { |
| + if (callback.is_null()) |
| + return; |
| + |
| + bool success = false; |
| + if (!response || !dbus::MessageReader(response).PopBool(&success)) { |
| + callback.Run(false); |
| + return; |
| + } |
| + |
| + callback.Run(success); |
| + } |
| + |
| // Creates dbus::FileDescriptor from base::File. |
| static scoped_ptr<dbus::FileDescriptor> |
| CreateFileDescriptorToStopSystemTracing(base::File pipe_write_end) { |