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 CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 static bool PrivetPrintingEnabled(); | 117 static bool PrivetPrintingEnabled(); |
118 | 118 |
119 content::WebContents* preview_web_contents() const; | 119 content::WebContents* preview_web_contents() const; |
120 | 120 |
121 // Gets the list of printers. |args| is unused. | 121 // Gets the list of printers. |args| is unused. |
122 void HandleGetPrinters(const base::ListValue* args); | 122 void HandleGetPrinters(const base::ListValue* args); |
123 | 123 |
124 // Starts getting all local privet printers. |arg| is unused. | 124 // Starts getting all local privet printers. |arg| is unused. |
125 void HandleGetPrivetPrinters(const base::ListValue* args); | 125 void HandleGetPrivetPrinters(const base::ListValue* args); |
126 | 126 |
| 127 // Starts getting all local extension managed printers. |arg| is unused. |
| 128 void HandleGetExtensionPrinters(const base::ListValue* args); |
| 129 |
127 // Stops getting all local privet printers. |arg| is unused. | 130 // Stops getting all local privet printers. |arg| is unused. |
128 void HandleStopGetPrivetPrinters(const base::ListValue* args); | 131 void HandleStopGetPrivetPrinters(const base::ListValue* args); |
129 | 132 |
130 // Asks the initiator renderer to generate a preview. First element of |args| | 133 // Asks the initiator renderer to generate a preview. First element of |args| |
131 // is a job settings JSON string. | 134 // is a job settings JSON string. |
132 void HandleGetPreview(const base::ListValue* args); | 135 void HandleGetPreview(const base::ListValue* args); |
133 | 136 |
134 // Gets the job settings from Web UI and initiate printing. First element of | 137 // Gets the job settings from Web UI and initiate printing. First element of |
135 // |args| is a job settings JSON string. | 138 // |args| is a job settings JSON string. |
136 void HandlePrint(const base::ListValue* args); | 139 void HandlePrint(const base::ListValue* args); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 // URL to set the new tab to. | 192 // URL to set the new tab to. |
190 // | 193 // |
191 // NOTE: This is needed to open FedEx confirmation window as a new tab. | 194 // NOTE: This is needed to open FedEx confirmation window as a new tab. |
192 // Javascript's "window.open" opens a new window popup (since initiated from | 195 // Javascript's "window.open" opens a new window popup (since initiated from |
193 // async HTTP request) and worse yet, on Windows and Chrome OS, the opened | 196 // async HTTP request) and worse yet, on Windows and Chrome OS, the opened |
194 // window opens behind the initiator window. | 197 // window opens behind the initiator window. |
195 void HandleForceOpenNewTab(const base::ListValue* args); | 198 void HandleForceOpenNewTab(const base::ListValue* args); |
196 | 199 |
197 void HandleGetPrivetPrinterCapabilities(const base::ListValue* arg); | 200 void HandleGetPrivetPrinterCapabilities(const base::ListValue* arg); |
198 | 201 |
| 202 // Requests an extension managed printer's capabilities. |
| 203 // |arg| contains the ID of the printer whose capabilities are requested. |
| 204 void HandleGetExtensionPrinterCapabilities(const base::ListValue* args); |
| 205 |
199 void SendInitialSettings(const std::string& default_printer); | 206 void SendInitialSettings(const std::string& default_printer); |
200 | 207 |
201 // Send OAuth2 access token. | 208 // Send OAuth2 access token. |
202 void SendAccessToken(const std::string& type, | 209 void SendAccessToken(const std::string& type, |
203 const std::string& access_token); | 210 const std::string& access_token); |
204 | 211 |
205 // Sends the printer capabilities to the Web UI. |settings_info| contains | 212 // Sends the printer capabilities to the Web UI. |settings_info| contains |
206 // printer capabilities information. | 213 // printer capabilities information. |
207 void SendPrinterCapabilities(const base::DictionaryValue* settings_info); | 214 void SendPrinterCapabilities(const base::DictionaryValue* settings_info); |
208 | 215 |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 const std::string& name, | 282 const std::string& name, |
276 const local_discovery::PrivetHTTPAsynchronousFactory::ResultCallback& | 283 const local_discovery::PrivetHTTPAsynchronousFactory::ResultCallback& |
277 callback); | 284 callback); |
278 void FillPrinterDescription( | 285 void FillPrinterDescription( |
279 const std::string& name, | 286 const std::string& name, |
280 const local_discovery::DeviceDescription& description, | 287 const local_discovery::DeviceDescription& description, |
281 bool has_local_printing, | 288 bool has_local_printing, |
282 base::DictionaryValue* printer_value); | 289 base::DictionaryValue* printer_value); |
283 #endif | 290 #endif |
284 | 291 |
| 292 // Called when a list of printers is reported by an extension. |
| 293 // |printers|: The list of printers managed by the extension. |
| 294 // |done|: Whether all the extensions have reported the list of printers |
| 295 // they manage. |
| 296 void OnGotPrintersForExtension(const base::ListValue& printers, bool done); |
| 297 |
| 298 // Called when an extension reports the set of print capabilites for a |
| 299 // printer. |
| 300 // |printer_id|: The id of the printer whose capabilities are reported. |
| 301 // |capabilities|: The printer capabilities. |
| 302 void OnGotExtensionPrinterCapabilities( |
| 303 const std::string& printer_id, |
| 304 const base::DictionaryValue& capabilities); |
| 305 |
285 // Register/unregister from notifications of changes done to the GAIA | 306 // Register/unregister from notifications of changes done to the GAIA |
286 // cookie. | 307 // cookie. |
287 void RegisterForMergeSession(); | 308 void RegisterForMergeSession(); |
288 void UnregisterForMergeSession(); | 309 void UnregisterForMergeSession(); |
289 | 310 |
290 // The underlying dialog object. | 311 // The underlying dialog object. |
291 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; | 312 scoped_refptr<ui::SelectFileDialog> select_file_dialog_; |
292 | 313 |
293 // A count of how many requests received to regenerate preview data. | 314 // A count of how many requests received to regenerate preview data. |
294 // Initialized to 0 then incremented and emitted to a histogram. | 315 // Initialized to 0 then incremented and emitted to a histogram. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
333 // Notifies tests that want to know if the PDF has been saved. This doesn't | 354 // Notifies tests that want to know if the PDF has been saved. This doesn't |
334 // notify the test if it was a successful save, only that it was attempted. | 355 // notify the test if it was a successful save, only that it was attempted. |
335 base::Closure pdf_file_saved_closure_; | 356 base::Closure pdf_file_saved_closure_; |
336 | 357 |
337 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; | 358 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; |
338 | 359 |
339 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 360 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
340 }; | 361 }; |
341 | 362 |
342 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 363 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
OLD | NEW |