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 d9d1d297417735e2d2199818507e4794c7299282..e30927cbb6d23825790dff79afde59174528b046 100644 |
| --- a/chromeos/dbus/debug_daemon_client.cc |
| +++ b/chromeos/dbus/debug_daemon_client.cc |
| @@ -468,6 +468,41 @@ class DebugDaemonClientImpl : public DebugDaemonClient { |
| weak_ptr_factory_.GetWeakPtr(), callback)); |
| } |
| + void CupsAddPrinter(const std::string& name, |
| + const std::string& uri, |
| + const std::string& ppd_path, |
| + bool ipp_everywhere, |
| + const DebugDaemonClient::AddPrinterCallback& callback, |
| + const base::Closure& error_callback) override { |
| + dbus::MethodCall method_call(debugd::kDebugdInterface, |
| + debugd::kCupsAddPrinter); |
| + dbus::MessageWriter writer(&method_call); |
| + writer.AppendString(name); |
| + writer.AppendString(uri); |
| + writer.AppendString(ppd_path); |
| + writer.AppendBool(ipp_everywhere); |
| + |
| + debugdaemon_proxy_->CallMethod( |
| + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| + base::Bind(&DebugDaemonClientImpl::OnPrinterAdded, |
| + weak_ptr_factory_.GetWeakPtr(), callback, error_callback)); |
| + } |
| + |
| + void CupsRemovePrinter( |
| + const std::string& name, |
| + const DebugDaemonClient::RemovePrinterCallback& callback, |
| + const base::Closure& error_callback) override { |
| + dbus::MethodCall method_call(debugd::kDebugdInterface, |
| + debugd::kCupsRemovePrinter); |
| + dbus::MessageWriter writer(&method_call); |
| + writer.AppendString(name); |
| + |
| + debugdaemon_proxy_->CallMethod( |
| + &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT, |
| + base::Bind(&DebugDaemonClientImpl::OnPrinterRemoved, |
| + weak_ptr_factory_.GetWeakPtr(), callback, error_callback)); |
| + } |
| + |
| protected: |
| void Init(dbus::Bus* bus) override { |
| debugdaemon_proxy_ = |
| @@ -680,6 +715,30 @@ class DebugDaemonClientImpl : public DebugDaemonClient { |
| callback.Run(false, ""); |
| } |
| + void OnPrinterAdded(const AddPrinterCallback& callback, |
| + const base::Closure& error_callback, |
| + dbus::Response* response) { |
| + bool result; |
|
hashimoto
2016/09/12 05:20:36
nit: bool result = false;
Please don't leave this
skau
2016/09/12 17:53:56
Done.
|
| + dbus::MessageReader reader(response); |
| + if (response && reader.PopBool(&result)) { |
| + callback.Run(result); |
| + } else { |
| + error_callback.Run(); |
| + } |
| + } |
| + |
| + void OnPrinterRemoved(const RemovePrinterCallback& callback, |
| + const base::Closure& error_callback, |
| + dbus::Response* response) { |
| + bool result; |
|
hashimoto
2016/09/12 05:20:36
ditto.
skau
2016/09/12 17:53:56
Done.
|
| + dbus::MessageReader reader(response); |
| + if (response && reader.PopBool(&result)) { |
| + callback.Run(result); |
| + } else { |
| + error_callback.Run(); |
| + } |
| + } |
| + |
| dbus::ObjectProxy* debugdaemon_proxy_; |
| std::unique_ptr<PipeReaderForString> pipe_reader_; |
| StopAgentTracingCallback callback_; |