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

Side by Side Diff: chrome/browser/ui/webui/print_preview/printer_handler.h

Issue 919213002: Handle an extension printer supporting only PWG raster data (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 10 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 CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_HANDLER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
11 #include "base/memory/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
13 13
14 namespace base { 14 namespace base {
15 class DictionaryValue; 15 class DictionaryValue;
16 class ListValue; 16 class ListValue;
17 class RefCountedMemory; 17 class RefCountedMemory;
18 } 18 }
19 19
20 namespace content { 20 namespace content {
21 class BrowserContext; 21 class BrowserContext;
22 } 22 }
23 23
24 namespace gfx {
25 class Size;
26 }
27
24 // Wrapper around PrinterProviderAPI to be used by print preview. 28 // Wrapper around PrinterProviderAPI to be used by print preview.
25 // It makes request lifetime management easier, and hides details of more 29 // It makes request lifetime management easier, and hides details of more
26 // complex operations like printing from the print preview handler. 30 // complex operations like printing from the print preview handler.
27 // TODO(tbarzic): Use the same interface for other printer types. 31 // TODO(tbarzic): Use the same interface for other printer types.
28 class PrinterHandler { 32 class PrinterHandler {
29 public: 33 public:
30 using GetPrintersCallback = 34 using GetPrintersCallback =
31 base::Callback<void(const base::ListValue& printers, bool done)>; 35 base::Callback<void(const base::ListValue& printers, bool done)>;
32 using GetCapabilityCallback = 36 using GetCapabilityCallback =
33 base::Callback<void(const std::string& printer_id, 37 base::Callback<void(const std::string& printer_id,
(...skipping 17 matching lines...) Expand all
51 // Starts getting printing capability of the printer with the provided 55 // Starts getting printing capability of the printer with the provided
52 // destination ID. 56 // destination ID.
53 // |callback| should be called in the response to the request. 57 // |callback| should be called in the response to the request.
54 virtual void StartGetCapability(const std::string& destination_id, 58 virtual void StartGetCapability(const std::string& destination_id,
55 const GetCapabilityCallback& callback) = 0; 59 const GetCapabilityCallback& callback) = 0;
56 60
57 // Starts a print request. 61 // Starts a print request.
58 // |destination_id|: The printer to which print job should be sent. 62 // |destination_id|: The printer to which print job should be sent.
59 // |capability|: Capability reported by the printer. 63 // |capability|: Capability reported by the printer.
60 // |ticket_json|: The print job ticket as JSON string. 64 // |ticket_json|: The print job ticket as JSON string.
65 // |page_size|: The document page size.
61 // |print_data|: The document bytes to print. 66 // |print_data|: The document bytes to print.
62 // |callback| should be called in the response to the request. 67 // |callback| should be called in the response to the request.
68 // TODO(tbarzic): Page size should be extracted from print data.
63 virtual void StartPrint( 69 virtual void StartPrint(
64 const std::string& destination_id, 70 const std::string& destination_id,
65 const std::string& capability, 71 const std::string& capability,
66 const std::string& ticket_json, 72 const std::string& ticket_json,
73 const gfx::Size& page_size,
67 const scoped_refptr<base::RefCountedMemory>& print_data, 74 const scoped_refptr<base::RefCountedMemory>& print_data,
68 const PrintCallback& callback) = 0; 75 const PrintCallback& callback) = 0;
69 }; 76 };
70 77
71 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_HANDLER_H_ 78 #endif // CHROME_BROWSER_UI_WEBUI_PRINT_PREVIEW_PRINTER_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698