Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_PRINTER_PROVIDER_API_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_PRINTER_PROVIDER_API_H_ |
| 6 #define EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_PRINTER_PROVIDER_API_H_ | 6 #define EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_PRINTER_PROVIDER_API_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 28 | 28 |
| 29 // Implements chrome.printerProvider API events. | 29 // Implements chrome.printerProvider API events. |
| 30 class PrinterProviderAPI : public KeyedService { | 30 class PrinterProviderAPI : public KeyedService { |
| 31 public: | 31 public: |
| 32 using GetPrintersCallback = | 32 using GetPrintersCallback = |
| 33 base::Callback<void(const base::ListValue& printers, bool done)>; | 33 base::Callback<void(const base::ListValue& printers, bool done)>; |
| 34 using GetCapabilityCallback = | 34 using GetCapabilityCallback = |
| 35 base::Callback<void(const base::DictionaryValue& capability)>; | 35 base::Callback<void(const base::DictionaryValue& capability)>; |
| 36 using PrintCallback = | 36 using PrintCallback = |
| 37 base::Callback<void(bool success, const std::string& error)>; | 37 base::Callback<void(bool success, const std::string& error)>; |
| 38 using UsbAccessGrantedCallback = | |
| 39 base::Callback<void(const base::DictionaryValue& printer_info)>; | |
| 38 | 40 |
| 39 static PrinterProviderAPI* Create(content::BrowserContext* context); | 41 static PrinterProviderAPI* Create(content::BrowserContext* context); |
| 40 | 42 |
| 41 // Returns generic error string for print request. | 43 // Returns generic error string for print request. |
| 42 static std::string GetDefaultPrintError(); | 44 static std::string GetDefaultPrintError(); |
| 43 | 45 |
| 44 ~PrinterProviderAPI() override {} | 46 ~PrinterProviderAPI() override {} |
| 45 | 47 |
| 46 // Requests list of supported printers from extensions implementing | 48 // Requests list of supported printers from extensions implementing |
| 47 // chrome.printerProvider API. It dispatches | 49 // chrome.printerProvider API. It dispatches |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 75 // |callback| is passed the print status returned by the extension, and it | 77 // |callback| is passed the print status returned by the extension, and it |
| 76 // must not be null. | 78 // must not be null. |
| 77 virtual void DispatchPrintRequested(const PrinterProviderPrintJob& job, | 79 virtual void DispatchPrintRequested(const PrinterProviderPrintJob& job, |
| 78 const PrintCallback& callback) = 0; | 80 const PrintCallback& callback) = 0; |
| 79 | 81 |
| 80 // Returns print job associated with the print request with id |request_id| | 82 // Returns print job associated with the print request with id |request_id| |
| 81 // for extension |extension|. | 83 // for extension |extension|. |
| 82 // It should return NULL if the job for the request does not exist. | 84 // It should return NULL if the job for the request does not exist. |
| 83 virtual const PrinterProviderPrintJob* GetPrintJob(const Extension* extension, | 85 virtual const PrinterProviderPrintJob* GetPrintJob(const Extension* extension, |
| 84 int request_id) const = 0; | 86 int request_id) const = 0; |
| 87 | |
| 88 // Notifies the given extension that it has been granted access to the given | |
|
tbarzic
2015/05/27 00:11:03
Comment is unfinished
Reilly Grant (use Gerrit)
2015/05/28 21:04:10
Done.
| |
| 89 virtual void DispatchGrantUsbPrinterAccess( | |
| 90 const std::string& extension_id, | |
| 91 int device_id, | |
| 92 const PrinterProviderAPI::UsbAccessGrantedCallback& callback) = 0; | |
| 85 }; | 93 }; |
| 86 | 94 |
| 87 } // namespace extensions | 95 } // namespace extensions |
| 88 | 96 |
| 89 #endif // EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_PRINTER_PROVIDER_API_H_ | 97 #endif // EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_PRINTER_PROVIDER_API_H_ |
| OLD | NEW |