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

Unified Diff: chromeos/dbus/fake_cups_client.cc

Issue 2232203003: Implement a dbus client for CupsTool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 3 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/fake_cups_client.cc
diff --git a/chromeos/dbus/fake_cups_client.cc b/chromeos/dbus/fake_cups_client.cc
new file mode 100644
index 0000000000000000000000000000000000000000..657d1f22f7262144a84e41228bfceab0dd0de1b2
--- /dev/null
+++ b/chromeos/dbus/fake_cups_client.cc
@@ -0,0 +1,44 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chromeos/dbus/fake_cups_client.h"
+
+#include "base/bind.h"
+#include "base/logging.h"
+#include "base/stl_util.h"
+#include "base/threading/thread_task_runner_handle.h"
+
+namespace chromeos {
+
+FakeCupsClient::FakeCupsClient() {}
+
+FakeCupsClient::~FakeCupsClient() {}
+
+void FakeCupsClient::AddPrinter(const std::string& name,
+ const std::string& uri,
+ const std::string& ppd_path,
+ bool ipp_everywhere,
+ const AddPrinterCallback& callback,
+ const base::Closure& error_callback) {
+ printers_.insert(name);
+ base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
+ base::Bind(callback, true));
+}
+
+void FakeCupsClient::RemovePrinter(const std::string& name,
+ const RemovePrinterCallback& callback,
+ const base::Closure& error_callback) {
+ const bool has_printer = base::ContainsKey(printers_, name);
+ if (has_printer)
+ printers_.erase(name);
+
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(callback, has_printer));
+}
+
+void FakeCupsClient::Init(dbus::Bus* bus) {
+ VLOG(1) << "FakeCupsClient initialized";
+}
+
+} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698