Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 #ifndef CHROMEOS_DBUS_CUPS_CLIENT_H_ | |
| 6 #define CHROMEOS_DBUS_CUPS_CLIENT_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 | |
| 10 #include "base/callback_forward.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "chromeos/chromeos_export.h" | |
| 13 #include "chromeos/dbus/dbus_client.h" | |
| 14 #include "chromeos/dbus/dbus_client_implementation_type.h" | |
| 15 | |
| 16 namespace chromeos { | |
| 17 | |
| 18 class CHROMEOS_EXPORT CupsClient : public DBusClient { | |
| 19 public: | |
| 20 // A callback to handle the result of AddPrinter. | |
| 21 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.
| |
| 22 | |
| 23 // A callback to handle the result of RemovePrinter. | |
| 24 typedef base::Callback<void(bool success)> RemovePrinterCallback; | |
|
hashimoto
2016/09/07 05:53:17
ditto.
skau
2016/09/09 15:25:32
Done.
| |
| 25 | |
| 26 ~CupsClient() override; | |
| 27 | |
| 28 // Calls CupsAddPrinter. |name| is the printer name. |uri| is the device | |
| 29 // uri. |ppd_path| is the absolute path to the PPD file. |ipp_everywhere| | |
| 30 // is true for autoconf of IPP Everywhere printers. |callback| is called | |
| 31 // after method success, |error_callback| otherwise. | |
| 32 virtual void AddPrinter(const std::string& name, | |
| 33 const std::string& uri, | |
| 34 const std::string& ppd_path, | |
| 35 bool ipp_everywhere, | |
| 36 const AddPrinterCallback& callback, | |
| 37 const base::Closure& error_callback) = 0; | |
| 38 | |
| 39 // Calls CupsRemovePrinter. |name| is the printer name as registered in | |
| 40 // CUPS. |callback| is called on success, |error_callback| otherwise. | |
| 41 virtual void RemovePrinter(const std::string& name, | |
| 42 const RemovePrinterCallback& callback, | |
| 43 const base::Closure& error_callback) = 0; | |
| 44 | |
| 45 // Factory function, creates a new instance and returns ownership. | |
| 46 // For normal usage, access the singleton via DBusThreadManager::Get(). | |
| 47 static CupsClient* Create(); | |
| 48 | |
| 49 protected: | |
| 50 friend class CupsClientTest; | |
| 51 | |
| 52 // Create() shoudl be used instead | |
|
hashimoto
2016/09/07 05:53:17
nit: should
skau
2016/09/09 15:25:32
Acknowledged.
| |
| 53 CupsClient(); | |
| 54 | |
| 55 private: | |
| 56 DISALLOW_COPY_AND_ASSIGN(CupsClient); | |
| 57 }; | |
|
hashimoto
2016/09/07 05:53:17
nit: Please add a blank line.
skau
2016/09/09 15:25:32
Acknowledged.
| |
| 58 } // namespace chromeos | |
| 59 | |
| 60 #endif // CHROMEOS_DBUS_CUPS_CLIENT_H_ | |
| OLD | NEW |