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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 std::unique_ptr<base::DictionaryValue> settings_info); | 241 std::unique_ptr<base::DictionaryValue> settings_info); |
242 | 242 |
243 // Send the list of printers to the Web UI. | 243 // Send the list of printers to the Web UI. |
244 void SetupPrinterList(const std::string& callback_id, | 244 void SetupPrinterList(const std::string& callback_id, |
245 const printing::PrinterList& printer_list); | 245 const printing::PrinterList& printer_list); |
246 | 246 |
247 // Send whether cloud print integration should be enabled. | 247 // Send whether cloud print integration should be enabled. |
248 void SendCloudPrintEnabled(); | 248 void SendCloudPrintEnabled(); |
249 | 249 |
250 // Send the PDF data to the cloud to print. | 250 // Send the PDF data to the cloud to print. |
251 void SendCloudPrintJob(const base::RefCountedBytes* data); | 251 void SendCloudPrintJob(const std::string& callback_id, |
| 252 const base::RefCountedBytes* data); |
252 | 253 |
253 // Gets the initiator for the print preview dialog. | 254 // Gets the initiator for the print preview dialog. |
254 content::WebContents* GetInitiator() const; | 255 content::WebContents* GetInitiator() const; |
255 | 256 |
256 // Closes the preview dialog. | 257 // Closes the preview dialog. |
257 void ClosePreviewDialog(); | 258 void ClosePreviewDialog(); |
258 | 259 |
259 // Adds all the recorded stats taken so far to histogram counts. | 260 // Adds all the recorded stats taken so far to histogram counts. |
260 void ReportStats(); | 261 void ReportStats(); |
261 | 262 |
(...skipping 23 matching lines...) Expand all Loading... |
285 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) | 286 #if BUILDFLAG(ENABLE_SERVICE_DISCOVERY) |
286 void StartPrivetLister(const scoped_refptr< | 287 void StartPrivetLister(const scoped_refptr< |
287 local_discovery::ServiceDiscoverySharedClient>& client); | 288 local_discovery::ServiceDiscoverySharedClient>& client); |
288 void StopPrivetLister(); | 289 void StopPrivetLister(); |
289 void OnPrivetCapabilities(const std::string& callback_id, | 290 void OnPrivetCapabilities(const std::string& callback_id, |
290 const base::DictionaryValue* capabilities); | 291 const base::DictionaryValue* capabilities); |
291 void PrivetCapabilitiesUpdateClient( | 292 void PrivetCapabilitiesUpdateClient( |
292 const std::string& callback_id, | 293 const std::string& callback_id, |
293 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); | 294 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); |
294 void PrivetLocalPrintUpdateClient( | 295 void PrivetLocalPrintUpdateClient( |
| 296 const std::string& callback_id, |
295 std::string print_ticket, | 297 std::string print_ticket, |
296 std::string capabilities, | 298 std::string capabilities, |
297 gfx::Size page_size, | 299 gfx::Size page_size, |
298 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); | 300 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); |
299 bool PrivetUpdateClient( | 301 bool PrivetUpdateClient( |
300 const std::string& callback_id, | 302 const std::string& callback_id, |
301 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); | 303 std::unique_ptr<cloud_print::PrivetHTTPClient> http_client); |
302 void StartPrivetLocalPrint(const std::string& print_ticket, | 304 void StartPrivetLocalPrint(const std::string& print_ticket, |
303 const std::string& capabilities, | 305 const std::string& capabilities, |
304 const gfx::Size& page_size); | 306 const gfx::Size& page_size); |
305 void SendPrivetCapabilitiesError(const std::string& id); | 307 void SendPrivetCapabilitiesError(const std::string& id); |
306 void PrintToPrivetPrinter(const std::string& printer_name, | 308 void PrintToPrivetPrinter(const std::string& callback_id, |
| 309 const std::string& printer_name, |
307 const std::string& print_ticket, | 310 const std::string& print_ticket, |
308 const std::string& capabilities, | 311 const std::string& capabilities, |
309 const gfx::Size& page_size); | 312 const gfx::Size& page_size); |
310 bool CreatePrivetHTTP( | 313 bool CreatePrivetHTTP( |
311 const std::string& name, | 314 const std::string& name, |
312 const cloud_print::PrivetHTTPAsynchronousFactory::ResultCallback& | 315 const cloud_print::PrivetHTTPAsynchronousFactory::ResultCallback& |
313 callback); | 316 callback); |
314 void FillPrinterDescription( | 317 void FillPrinterDescription( |
315 const std::string& name, | 318 const std::string& name, |
316 const cloud_print::DeviceDescription& description, | 319 const cloud_print::DeviceDescription& description, |
(...skipping 24 matching lines...) Expand all Loading... |
341 | 344 |
342 // Called when an extension reports the set of print capabilites for a | 345 // Called when an extension reports the set of print capabilites for a |
343 // printer. | 346 // printer. |
344 // |callback_id|: The Javascript callback to reject or resolve | 347 // |callback_id|: The Javascript callback to reject or resolve |
345 // |capabilities|: The printer capabilities. | 348 // |capabilities|: The printer capabilities. |
346 void OnGotExtensionPrinterCapabilities( | 349 void OnGotExtensionPrinterCapabilities( |
347 const std::string& callback_id, | 350 const std::string& callback_id, |
348 const base::DictionaryValue& capabilities); | 351 const base::DictionaryValue& capabilities); |
349 | 352 |
350 // Called when an extension print job is completed. | 353 // Called when an extension print job is completed. |
| 354 // |callback_id|: The javascript callback to run. |
351 // |success|: Whether the job succeeded. | 355 // |success|: Whether the job succeeded. |
352 // |status|: The returned print job status. Useful for reporting a specific | 356 // |status|: The returned print job status. Useful for reporting a specific |
353 // error. | 357 // error. |
354 void OnExtensionPrintResult(bool success, const std::string& status); | 358 void OnExtensionPrintResult(const std::string& callback_id, |
| 359 bool success, |
| 360 const std::string& status); |
355 | 361 |
356 // Register/unregister from notifications of changes done to the GAIA | 362 // Register/unregister from notifications of changes done to the GAIA |
357 // cookie. | 363 // cookie. |
358 void RegisterForGaiaCookieChanges(); | 364 void RegisterForGaiaCookieChanges(); |
359 void UnregisterForGaiaCookieChanges(); | 365 void UnregisterForGaiaCookieChanges(); |
360 | 366 |
361 // A count of how many requests received to regenerate preview data. | 367 // A count of how many requests received to regenerate preview data. |
362 // Initialized to 0 then incremented and emitted to a histogram. | 368 // Initialized to 0 then incremented and emitted to a histogram. |
363 int regenerate_preview_request_count_; | 369 int regenerate_preview_request_count_; |
364 | 370 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 406 |
401 // Handles requests for extension printers. Created lazily by calling | 407 // Handles requests for extension printers. Created lazily by calling |
402 // |EnsureExtensionPrinterHandlerSet|. | 408 // |EnsureExtensionPrinterHandlerSet|. |
403 std::unique_ptr<PrinterHandler> extension_printer_handler_; | 409 std::unique_ptr<PrinterHandler> extension_printer_handler_; |
404 | 410 |
405 // Notifies tests that want to know if the PDF has been saved. This doesn't | 411 // Notifies tests that want to know if the PDF has been saved. This doesn't |
406 // notify the test if it was a successful save, only that it was attempted. | 412 // notify the test if it was a successful save, only that it was attempted. |
407 base::Closure pdf_file_saved_closure_; | 413 base::Closure pdf_file_saved_closure_; |
408 | 414 |
409 // Callback ID to be used to notify UI that privet search is finished. | 415 // Callback ID to be used to notify UI that privet search is finished. |
410 std::string privet_callback_id_ = ""; | 416 std::string privet_search_callback_id_ = ""; |
| 417 |
| 418 std::string privet_print_callback_id_ = ""; |
| 419 |
| 420 std::string pdf_callback_id_ = ""; |
411 | 421 |
412 // Proxy for calls to the print backend. Lazily initialized since web_ui() is | 422 // Proxy for calls to the print backend. Lazily initialized since web_ui() is |
413 // not available at construction time. | 423 // not available at construction time. |
414 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_; | 424 std::unique_ptr<printing::PrinterBackendProxy> printer_backend_proxy_; |
415 | 425 |
416 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; | 426 base::WeakPtrFactory<PrintPreviewHandler> weak_factory_; |
417 | 427 |
418 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); | 428 DISALLOW_COPY_AND_ASSIGN(PrintPreviewHandler); |
419 }; | 429 }; |
420 | 430 |
421 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ | 431 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINT_PREVIEW_HANDLER_H_ |
OLD | NEW |