Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(726)

Side by Side Diff: extensions/browser/api/printer_provider_internal/printer_provider_internal_api.h

Issue 1148383002: Add onGetUsbPrinterInfoRequested event to printerProvider API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_INTERNAL_PRINTER_PROVIDER_INTERN AL_API_H_ 5 #ifndef EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_INTERNAL_PRINTER_PROVIDER_INTERN AL_API_H_
6 #define EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_INTERNAL_PRINTER_PROVIDER_INTERN AL_API_H_ 6 #define EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_INTERNAL_PRINTER_PROVIDER_INTERN AL_API_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 30 matching lines...) Expand all
41 ~PrinterProviderInternalAPI() override; 41 ~PrinterProviderInternalAPI() override;
42 42
43 void AddObserver(PrinterProviderInternalAPIObserver* observer); 43 void AddObserver(PrinterProviderInternalAPIObserver* observer);
44 void RemoveObserver(PrinterProviderInternalAPIObserver* observer); 44 void RemoveObserver(PrinterProviderInternalAPIObserver* observer);
45 45
46 private: 46 private:
47 friend class BrowserContextKeyedAPIFactory<PrinterProviderInternalAPI>; 47 friend class BrowserContextKeyedAPIFactory<PrinterProviderInternalAPI>;
48 friend class PrinterProviderInternalReportPrintersFunction; 48 friend class PrinterProviderInternalReportPrintersFunction;
49 friend class PrinterProviderInternalReportPrinterCapabilityFunction; 49 friend class PrinterProviderInternalReportPrinterCapabilityFunction;
50 friend class PrinterProviderInternalReportPrintResultFunction; 50 friend class PrinterProviderInternalReportPrintResultFunction;
51 friend class PrinterProviderInternalReportUsbPrinterInfoFunction;
51 52
52 // BrowserContextKeyedAPI implementation. 53 // BrowserContextKeyedAPI implementation.
53 static const bool kServiceRedirectedInIncognito = true; 54 static const bool kServiceRedirectedInIncognito = true;
54 static const char* service_name() { return "PrinterProviderInternal"; } 55 static const char* service_name() { return "PrinterProviderInternal"; }
55 56
56 // Notifies observers that a printerProvider.onGetPrintersRequested callback 57 // Notifies observers that a printerProvider.onGetPrintersRequested callback
57 // has been called. Called from 58 // has been called. Called from
58 // |PrinterProviderInternalReportPrintersFunction|. 59 // |PrinterProviderInternalReportPrintersFunction|.
59 void NotifyGetPrintersResult( 60 void NotifyGetPrintersResult(
60 const Extension* extension, 61 const Extension* extension,
61 int request_id, 62 int request_id,
62 const PrinterProviderInternalAPIObserver::PrinterInfoVector& printers); 63 const PrinterProviderInternalAPIObserver::PrinterInfoVector& printers);
63 64
64 // Notifies observers that a printerProvider.onGetCapabilityRequested callback 65 // Notifies observers that a printerProvider.onGetCapabilityRequested callback
65 // has been called. Called from 66 // has been called. Called from
66 // |PrinterProviderInternalReportPrinterCapabilityFunction|. 67 // |PrinterProviderInternalReportPrinterCapabilityFunction|.
67 void NotifyGetCapabilityResult(const Extension* extension, 68 void NotifyGetCapabilityResult(const Extension* extension,
68 int request_id, 69 int request_id,
69 const base::DictionaryValue& capability); 70 const base::DictionaryValue& capability);
70 71
71 // Notifies observers that a printerProvider.onPrintRequested callback has 72 // Notifies observers that a printerProvider.onPrintRequested callback has
72 // been called. Called from 73 // been called. Called from
73 // |PrinterProviderInternalReportPrintResultFunction|. 74 // |PrinterProviderInternalReportPrintResultFunction|.
74 void NotifyPrintResult(const Extension* extension, 75 void NotifyPrintResult(const Extension* extension,
75 int request_id, 76 int request_id,
76 core_api::printer_provider_internal::PrintError error); 77 core_api::printer_provider_internal::PrintError error);
77 78
79 // Notifies observers that a printerProvider.onGetUsbPrinterInfoRequested
80 // callback has been called. Called from
81 // |PrinterProviderInternalReportUsbPrinterInfoFunction|.
82 void NotifyGetUsbPrinterInfoResult(
83 const Extension* extension,
84 int request_id,
85 const core_api::printer_provider::PrinterInfo* printer_info);
86
78 ObserverList<PrinterProviderInternalAPIObserver> observers_; 87 ObserverList<PrinterProviderInternalAPIObserver> observers_;
79 88
80 DISALLOW_COPY_AND_ASSIGN(PrinterProviderInternalAPI); 89 DISALLOW_COPY_AND_ASSIGN(PrinterProviderInternalAPI);
81 }; 90 };
82 91
83 class PrinterProviderInternalReportPrintResultFunction 92 class PrinterProviderInternalReportPrintResultFunction
84 : public UIThreadExtensionFunction { 93 : public UIThreadExtensionFunction {
85 public: 94 public:
86 PrinterProviderInternalReportPrintResultFunction(); 95 PrinterProviderInternalReportPrintResultFunction();
87 96
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 void OnBlob(const std::string& type, 153 void OnBlob(const std::string& type,
145 int size, 154 int size,
146 const scoped_refptr<base::RefCountedMemory>& data, 155 const scoped_refptr<base::RefCountedMemory>& data,
147 scoped_ptr<content::BlobHandle> blob); 156 scoped_ptr<content::BlobHandle> blob);
148 DECLARE_EXTENSION_FUNCTION("printerProviderInternal.getPrintData", 157 DECLARE_EXTENSION_FUNCTION("printerProviderInternal.getPrintData",
149 PRINTERPROVIDERINTERNAL_GETPRINTDATA) 158 PRINTERPROVIDERINTERNAL_GETPRINTDATA)
150 159
151 DISALLOW_COPY_AND_ASSIGN(PrinterProviderInternalGetPrintDataFunction); 160 DISALLOW_COPY_AND_ASSIGN(PrinterProviderInternalGetPrintDataFunction);
152 }; 161 };
153 162
163 class PrinterProviderInternalReportUsbPrinterInfoFunction
164 : public UIThreadExtensionFunction {
165 public:
166 PrinterProviderInternalReportUsbPrinterInfoFunction();
167
168 protected:
169 ~PrinterProviderInternalReportUsbPrinterInfoFunction() override;
170 ExtensionFunction::ResponseAction Run() override;
171
172 private:
173 DECLARE_EXTENSION_FUNCTION("printerProviderInternal.reportUsbPrinterInfo",
174 PRINTERPROVIDERINTERNAL_REPORTUSBPRINTERINFO)
175
176 DISALLOW_COPY_AND_ASSIGN(PrinterProviderInternalReportUsbPrinterInfoFunction);
177 };
178
154 } // namespace extensions 179 } // namespace extensions
155 180
156 #endif // EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_INTERNAL_PRINTER_PROVIDER_INT ERNAL_API_H_ 181 #endif // EXTENSIONS_BROWSER_API_PRINTER_PROVIDER_INTERNAL_PRINTER_PROVIDER_INT ERNAL_API_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698