| OLD | NEW |
| 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> |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 callbacks.swap(pending_wait_for_service_to_be_available_callbacks_); | 216 callbacks.swap(pending_wait_for_service_to_be_available_callbacks_); |
| 217 for (size_t i = 0; i < callbacks.size(); ++i) | 217 for (size_t i = 0; i < callbacks.size(); ++i) |
| 218 callbacks[i].Run(is_available); | 218 callbacks[i].Run(is_available); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void FakeDebugDaemonClient::CupsAddPrinter( | 221 void FakeDebugDaemonClient::CupsAddPrinter( |
| 222 const std::string& name, | 222 const std::string& name, |
| 223 const std::string& uri, | 223 const std::string& uri, |
| 224 const std::string& ppd_path, | 224 const std::string& ppd_path, |
| 225 bool ipp_everywhere, | 225 bool ipp_everywhere, |
| 226 const DebugDaemonClient::CupsAddPrinterCallback& callback, | 226 const DebugDaemonClient::LegacyCupsAddPrinterCallback& callback, |
| 227 const base::Closure& error_callback) { | 227 const base::Closure& error_callback) { |
| 228 printers_.insert(name); | 228 printers_.insert(name); |
| 229 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 229 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 230 base::Bind(callback, true)); | 230 base::Bind(callback, true)); |
| 231 } | 231 } |
| 232 | 232 |
| 233 void FakeDebugDaemonClient::CupsAddManuallyConfiguredPrinter( |
| 234 const std::string& name, |
| 235 const std::string& uri, |
| 236 const std::string& ppd_contents, |
| 237 const DebugDaemonClient::CupsAddPrinterCallback& callback, |
| 238 const base::Closure& error_callback) { |
| 239 printers_.insert(name); |
| 240 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 241 base::Bind(callback, 0)); |
| 242 } |
| 243 |
| 244 void FakeDebugDaemonClient::CupsAddAutoConfiguredPrinter( |
| 245 const std::string& name, |
| 246 const std::string& uri, |
| 247 const DebugDaemonClient::CupsAddPrinterCallback& callback, |
| 248 const base::Closure& error_callback) { |
| 249 printers_.insert(name); |
| 250 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 251 base::Bind(callback, 0)); |
| 252 } |
| 253 |
| 233 void FakeDebugDaemonClient::CupsRemovePrinter( | 254 void FakeDebugDaemonClient::CupsRemovePrinter( |
| 234 const std::string& name, | 255 const std::string& name, |
| 235 const DebugDaemonClient::CupsRemovePrinterCallback& callback, | 256 const DebugDaemonClient::CupsRemovePrinterCallback& callback, |
| 236 const base::Closure& error_callback) { | 257 const base::Closure& error_callback) { |
| 237 const bool has_printer = base::ContainsKey(printers_, name); | 258 const bool has_printer = base::ContainsKey(printers_, name); |
| 238 if (has_printer) | 259 if (has_printer) |
| 239 printers_.erase(name); | 260 printers_.erase(name); |
| 240 | 261 |
| 241 base::ThreadTaskRunnerHandle::Get()->PostTask( | 262 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 242 FROM_HERE, base::Bind(callback, has_printer)); | 263 FROM_HERE, base::Bind(callback, has_printer)); |
| 243 } | 264 } |
| 244 | 265 |
| 245 } // namespace chromeos | 266 } // namespace chromeos |
| OLD | NEW |