Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Unified Diff: chromeos/dbus/debug_daemon_client.cc

Issue 2618683003: Update debugd client. (Closed)
Patch Set: Change result code from bool to int32 at skaus request Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chromeos/dbus/debug_daemon_client.cc
diff --git a/chromeos/dbus/debug_daemon_client.cc b/chromeos/dbus/debug_daemon_client.cc
index 868a60f290c134064a7dc099ffcb6913f6c50590..c007e2f10c6c380635be766ecfdb806c6b78ef23 100644
--- a/chromeos/dbus/debug_daemon_client.cc
+++ b/chromeos/dbus/debug_daemon_client.cc
@@ -466,12 +466,13 @@ 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::CupsAddPrinterCallback& callback,
- const base::Closure& error_callback) override {
+ void CupsAddPrinter(
+ const std::string& name,
+ const std::string& uri,
+ const std::string& ppd_path,
+ bool ipp_everywhere,
+ const DebugDaemonClient::LegacyCupsAddPrinterCallback& callback,
+ const base::Closure& error_callback) override {
dbus::MethodCall method_call(debugd::kDebugdInterface,
debugd::kCupsAddPrinter);
dbus::MessageWriter writer(&method_call);
@@ -482,6 +483,42 @@ class DebugDaemonClientImpl : public DebugDaemonClient {
debugdaemon_proxy_->CallMethod(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&DebugDaemonClientImpl::LegacyOnPrinterAdded,
+ weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
+ }
+
+ void CupsAddManuallyConfiguredPrinter(
+ const std::string& name,
+ const std::string& uri,
+ const std::string& ppd_contents,
+ const DebugDaemonClient::CupsAddPrinterCallback& callback,
+ const base::Closure& error_callback) override {
+ dbus::MethodCall method_call(debugd::kDebugdInterface,
+ debugd::kCupsAddManuallyConfiguredPrinter);
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendString(name);
+ writer.AppendString(uri);
+ writer.AppendString(ppd_contents);
+
+ debugdaemon_proxy_->CallMethod(
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
+ base::Bind(&DebugDaemonClientImpl::OnPrinterAdded,
+ weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
+ }
+
+ void CupsAddAutoConfiguredPrinter(
+ const std::string& name,
+ const std::string& uri,
+ const DebugDaemonClient::CupsAddPrinterCallback& callback,
+ const base::Closure& error_callback) override {
+ dbus::MethodCall method_call(debugd::kDebugdInterface,
+ debugd::kCupsAddAutoConfiguredPrinter);
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendString(name);
+ writer.AppendString(uri);
+
+ debugdaemon_proxy_->CallMethod(
+ &method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT,
base::Bind(&DebugDaemonClientImpl::OnPrinterAdded,
weak_ptr_factory_.GetWeakPtr(), callback, error_callback));
}
@@ -713,12 +750,24 @@ class DebugDaemonClientImpl : public DebugDaemonClient {
callback.Run(false, "");
}
+ void LegacyOnPrinterAdded(const LegacyCupsAddPrinterCallback& callback,
+ const base::Closure& error_callback,
+ dbus::Response* response) {
+ bool result = false;
+ dbus::MessageReader reader(response);
+ if (response && reader.PopBool(&result)) {
+ callback.Run(result);
+ } else {
+ error_callback.Run();
+ }
+ }
+
void OnPrinterAdded(const CupsAddPrinterCallback& callback,
const base::Closure& error_callback,
dbus::Response* response) {
- bool result = false;
+ int32_t result;
dbus::MessageReader reader(response);
- if (response && reader.PopBool(&result)) {
+ if (response && reader.PopInt32(&result)) {
callback.Run(result);
} else {
error_callback.Run();

Powered by Google App Engine
This is Rietveld 408576698