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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chromeos/dbus/fake_cups_client.h"
6
7 #include "base/bind.h"
8 #include "base/logging.h"
9 #include "base/stl_util.h"
10 #include "base/threading/thread_task_runner_handle.h"
11
12 namespace chromeos {
13
14 FakeCupsClient::FakeCupsClient() {}
15
16 FakeCupsClient::~FakeCupsClient() {}
17
18 void FakeCupsClient::AddPrinter(const std::string& name,
19 const std::string& uri,
20 const std::string& ppd_path,
21 bool ipp_everywhere,
22 const AddPrinterCallback& callback,
23 const base::Closure& error_callback) {
24 printers_.insert(name);
25 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
26 base::Bind(callback, true));
27 }
28
29 void FakeCupsClient::RemovePrinter(const std::string& name,
30 const RemovePrinterCallback& callback,
31 const base::Closure& error_callback) {
32 const bool has_printer = base::ContainsKey(printers_, name);
33 if (has_printer)
34 printers_.erase(name);
35
36 base::ThreadTaskRunnerHandle::Get()->PostTask(
37 FROM_HERE, base::Bind(callback, has_printer));
38 }
39
40 void FakeCupsClient::Init(dbus::Bus* bus) {
41 VLOG(1) << "FakeCupsClient initialized";
42 }
43
44 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698