Chromium Code Reviews| Index: chromeos/dbus/cups_client.h |
| diff --git a/chromeos/dbus/cups_client.h b/chromeos/dbus/cups_client.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..87e38ffef2a441917dab48950b63b86188cf4217 |
| --- /dev/null |
| +++ b/chromeos/dbus/cups_client.h |
| @@ -0,0 +1,60 @@ |
| +// 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. |
| + |
| +#ifndef CHROMEOS_DBUS_CUPS_CLIENT_H_ |
| +#define CHROMEOS_DBUS_CUPS_CLIENT_H_ |
| + |
| +#include <string> |
| + |
| +#include "base/callback_forward.h" |
| +#include "base/macros.h" |
| +#include "chromeos/chromeos_export.h" |
| +#include "chromeos/dbus/dbus_client.h" |
| +#include "chromeos/dbus/dbus_client_implementation_type.h" |
| + |
| +namespace chromeos { |
| + |
| +class CHROMEOS_EXPORT CupsClient : public DBusClient { |
| + public: |
| + // A callback to handle the result of AddPrinter. |
| + typedef base::Callback<void(bool success)> AddPrinterCallback; |
|
hashimoto
2016/09/07 05:53:17
Please use using instead of typedef for new code.
skau
2016/09/09 15:25:32
Done.
|
| + |
| + // A callback to handle the result of RemovePrinter. |
| + typedef base::Callback<void(bool success)> RemovePrinterCallback; |
|
hashimoto
2016/09/07 05:53:17
ditto.
skau
2016/09/09 15:25:32
Done.
|
| + |
| + ~CupsClient() override; |
| + |
| + // Calls CupsAddPrinter. |name| is the printer name. |uri| is the device |
| + // uri. |ppd_path| is the absolute path to the PPD file. |ipp_everywhere| |
| + // is true for autoconf of IPP Everywhere printers. |callback| is called |
| + // after method success, |error_callback| otherwise. |
| + virtual void 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) = 0; |
| + |
| + // Calls CupsRemovePrinter. |name| is the printer name as registered in |
| + // CUPS. |callback| is called on success, |error_callback| otherwise. |
| + virtual void RemovePrinter(const std::string& name, |
| + const RemovePrinterCallback& callback, |
| + const base::Closure& error_callback) = 0; |
| + |
| + // Factory function, creates a new instance and returns ownership. |
| + // For normal usage, access the singleton via DBusThreadManager::Get(). |
| + static CupsClient* Create(); |
| + |
| + protected: |
| + friend class CupsClientTest; |
| + |
| + // Create() shoudl be used instead |
|
hashimoto
2016/09/07 05:53:17
nit: should
skau
2016/09/09 15:25:32
Acknowledged.
|
| + CupsClient(); |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(CupsClient); |
| +}; |
|
hashimoto
2016/09/07 05:53:17
nit: Please add a blank line.
skau
2016/09/09 15:25:32
Acknowledged.
|
| +} // namespace chromeos |
| + |
| +#endif // CHROMEOS_DBUS_CUPS_CLIENT_H_ |