Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ | 5 #ifndef CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ |
| 6 #define CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ | 6 #define CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <sys/types.h> | 9 #include <sys/types.h> |
| 10 | 10 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 | 203 |
| 204 // Set OOM score oom_score_adj for some process. | 204 // Set OOM score oom_score_adj for some process. |
| 205 // Note that the corresponding DBus configuration of the debugd method | 205 // Note that the corresponding DBus configuration of the debugd method |
| 206 // "SetOomScoreAdj" only permits setting OOM score for processes running by | 206 // "SetOomScoreAdj" only permits setting OOM score for processes running by |
| 207 // user chronos or Android apps. | 207 // user chronos or Android apps. |
| 208 virtual void SetOomScoreAdj( | 208 virtual void SetOomScoreAdj( |
| 209 const std::map<pid_t, int32_t>& pid_to_oom_score_adj, | 209 const std::map<pid_t, int32_t>& pid_to_oom_score_adj, |
| 210 const SetOomScoreAdjCallback& callback) = 0; | 210 const SetOomScoreAdjCallback& callback) = 0; |
| 211 | 211 |
| 212 // A callback to handle the result of CupsAddPrinter. | 212 // A callback to handle the result of CupsAddPrinter. |
| 213 using CupsAddPrinterCallback = base::Callback<void(bool success)>; | 213 using LegacyCupsAddPrinterCallback = base::Callback<void(bool status)>; |
| 214 | |
| 215 // A callback to handle the result of CupsAdd[Auto|Manually]ConfiguredPrinter. | |
| 216 // A zero status means success, non-zero statuses are used to convey different | |
| 217 // errors. | |
| 218 using CupsAddPrinterCallback = base::Callback<void(int32_t status)>; | |
|
skau
2017/01/25 00:16:40
Are you going to use u or i in the dbus specificat
Carlson
2017/01/25 00:32:35
Was planning to use int32_t; is there a reason you
| |
| 214 | 219 |
| 215 // Calls CupsAddPrinter. |name| is the printer name. |uri| is the device | 220 // Calls CupsAddPrinter. |name| is the printer name. |uri| is the device |
| 216 // uri. |ppd_path| is the absolute path to the PPD file. |ipp_everywhere| | 221 // uri. |ppd_path| is the absolute path to the PPD file. |ipp_everywhere| |
| 217 // is true for autoconf of IPP Everywhere printers. |callback| is called with | 222 // is true for autoconf of IPP Everywhere printers. |callback| is called with |
| 218 // true if adding the printer to CUPS was successful and false if there was an | 223 // true if adding the printer to CUPS was successful and false if there was an |
| 219 // error. |error_callback| will be called if there was an error in | 224 // error. |error_callback| will be called if there was an error in |
| 220 // communicating with debugd. | 225 // communicating with debugd. |
| 226 // | |
| 227 // Obsoleted by CupsAddAutoConfiguredPrinter and | |
| 228 // CupsAddManuallyConfiguredPrinter. | |
| 221 virtual void CupsAddPrinter(const std::string& name, | 229 virtual void CupsAddPrinter(const std::string& name, |
| 222 const std::string& uri, | 230 const std::string& uri, |
| 223 const std::string& ppd_path, | 231 const std::string& ppd_path, |
| 224 bool ipp_everywhere, | 232 bool ipp_everywhere, |
| 225 const CupsAddPrinterCallback& callback, | 233 const LegacyCupsAddPrinterCallback& callback, |
| 226 const base::Closure& error_callback) = 0; | 234 const base::Closure& error_callback) = 0; |
| 227 | 235 |
| 236 // Calls CupsAddManuallyConfiguredPrinter. |name| is the printer | |
| 237 // name. |uri| is the device. |ppd_contents| is the contents of the | |
| 238 // PPD file used to drive the device. |callback| is called with | |
| 239 // true if adding the printer to CUPS was successful and false if | |
| 240 // there was an error. |error_callback| will be called if there was | |
| 241 // an error in communicating with debugd. | |
| 242 virtual void CupsAddManuallyConfiguredPrinter( | |
| 243 const std::string& name, | |
| 244 const std::string& uri, | |
| 245 const std::string& ppd_contents, | |
| 246 const CupsAddPrinterCallback& callback, | |
| 247 const base::Closure& error_callback) = 0; | |
| 248 | |
| 249 // Calls CupsAddAutoConfiguredPrinter. |name| is the printer | |
| 250 // name. |uri| is the device. |callback| is called with true if | |
| 251 // adding the printer to CUPS was successful and false if there was | |
| 252 // an error. |error_callback| will be called if there was an error | |
| 253 // in communicating with debugd. | |
| 254 virtual void CupsAddAutoConfiguredPrinter( | |
| 255 const std::string& name, | |
| 256 const std::string& uri, | |
| 257 const CupsAddPrinterCallback& callback, | |
| 258 const base::Closure& error_callback) = 0; | |
| 259 | |
| 228 // A callback to handle the result of CupsRemovePrinter. | 260 // A callback to handle the result of CupsRemovePrinter. |
| 229 using CupsRemovePrinterCallback = base::Callback<void(bool success)>; | 261 using CupsRemovePrinterCallback = base::Callback<void(bool success)>; |
| 230 | 262 |
| 231 // Calls CupsRemovePrinter. |name| is the printer name as registered in | 263 // Calls CupsRemovePrinter. |name| is the printer name as registered in |
| 232 // CUPS. |callback| is called with true if removing the printer from CUPS was | 264 // CUPS. |callback| is called with true if removing the printer from CUPS was |
| 233 // successful and false if there was an error. |error_callback| will be | 265 // successful and false if there was an error. |error_callback| will be |
| 234 // called if there was an error in communicating with debugd. | 266 // called if there was an error in communicating with debugd. |
| 235 virtual void CupsRemovePrinter(const std::string& name, | 267 virtual void CupsRemovePrinter(const std::string& name, |
| 236 const CupsRemovePrinterCallback& callback, | 268 const CupsRemovePrinterCallback& callback, |
| 237 const base::Closure& error_callback) = 0; | 269 const base::Closure& error_callback) = 0; |
| 238 | 270 |
| 239 // Factory function, creates a new instance and returns ownership. | 271 // Factory function, creates a new instance and returns ownership. |
| 240 // For normal usage, access the singleton via DBusThreadManager::Get(). | 272 // For normal usage, access the singleton via DBusThreadManager::Get(). |
| 241 static DebugDaemonClient* Create(); | 273 static DebugDaemonClient* Create(); |
| 242 | 274 |
| 243 protected: | 275 protected: |
| 244 // Create() should be used instead. | 276 // Create() should be used instead. |
| 245 DebugDaemonClient(); | 277 DebugDaemonClient(); |
| 246 | 278 |
| 247 private: | 279 private: |
| 248 DISALLOW_COPY_AND_ASSIGN(DebugDaemonClient); | 280 DISALLOW_COPY_AND_ASSIGN(DebugDaemonClient); |
| 249 }; | 281 }; |
| 250 | 282 |
| 251 } // namespace chromeos | 283 } // namespace chromeos |
| 252 | 284 |
| 253 #endif // CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ | 285 #endif // CHROMEOS_DBUS_DEBUG_DAEMON_CLIENT_H_ |
| OLD | NEW |