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

Side by Side Diff: chromeos/dbus/fake_debug_daemon_client.cc

Issue 2232203003: Implement a dbus client for CupsTool. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: finish addressing comments 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
« no previous file with comments | « chromeos/dbus/fake_debug_daemon_client.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chromeos/dbus/fake_debug_daemon_client.h" 5 #include "chromeos/dbus/fake_debug_daemon_client.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 12
13 #include "base/bind.h" 13 #include "base/bind.h"
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/location.h" 16 #include "base/location.h"
17 #include "base/single_thread_task_runner.h" 17 #include "base/single_thread_task_runner.h"
18 #include "base/stl_util.h"
18 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
19 #include "chromeos/chromeos_switches.h" 20 #include "chromeos/chromeos_switches.h"
20 21
21 namespace { 22 namespace {
22 23
23 const char kCrOSTracingAgentName[] = "cros"; 24 const char kCrOSTracingAgentName[] = "cros";
24 const char kCrOSTraceLabel[] = "systemTraceEvents"; 25 const char kCrOSTraceLabel[] = "systemTraceEvents";
25 26
26 } // namespace 27 } // namespace
27 28
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 service_is_available_ = is_available; 211 service_is_available_ = is_available;
211 if (!is_available) 212 if (!is_available)
212 return; 213 return;
213 214
214 std::vector<WaitForServiceToBeAvailableCallback> callbacks; 215 std::vector<WaitForServiceToBeAvailableCallback> callbacks;
215 callbacks.swap(pending_wait_for_service_to_be_available_callbacks_); 216 callbacks.swap(pending_wait_for_service_to_be_available_callbacks_);
216 for (size_t i = 0; i < callbacks.size(); ++i) 217 for (size_t i = 0; i < callbacks.size(); ++i)
217 callbacks[i].Run(is_available); 218 callbacks[i].Run(is_available);
218 } 219 }
219 220
221 void FakeDebugDaemonClient::CupsAddPrinter(
222 const std::string& name,
223 const std::string& uri,
224 const std::string& ppd_path,
225 bool ipp_everywhere,
226 const DebugDaemonClient::CupsAddPrinterCallback& callback,
227 const base::Closure& error_callback) {
228 printers_.insert(name);
229 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
230 base::Bind(callback, true));
231 }
232
233 void FakeDebugDaemonClient::CupsRemovePrinter(
234 const std::string& name,
235 const DebugDaemonClient::CupsRemovePrinterCallback& callback,
236 const base::Closure& error_callback) {
237 const bool has_printer = base::ContainsKey(printers_, name);
238 if (has_printer)
239 printers_.erase(name);
240
241 base::ThreadTaskRunnerHandle::Get()->PostTask(
242 FROM_HERE, base::Bind(callback, has_printer));
243 }
244
220 } // namespace chromeos 245 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/fake_debug_daemon_client.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698