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

Side by Side Diff: pdf/pdf_engine.h

Issue 974183003: Print Preview: Support the duplex preset in PDFs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: tsepez comments Created 5 years, 9 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
« no previous file with comments | « pdf/out_of_process_instance.cc ('k') | pdf/pdfium/pdfium_assert_matching_enums.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 PDF_PDF_ENGINE_H_ 5 #ifndef PDF_PDF_ENGINE_H_
6 #define PDF_PDF_ENGINE_H_ 6 #define PDF_PDF_ENGINE_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 9
10 #if defined(OS_WIN) 10 #if defined(OS_WIN)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #endif // OS_MACOSX 42 #endif // OS_MACOSX
43 43
44 // Do one time initialization of the SDK. 44 // Do one time initialization of the SDK.
45 bool InitializeSDK(); 45 bool InitializeSDK();
46 // Tells the SDK that we're shutting down. 46 // Tells the SDK that we're shutting down.
47 void ShutdownSDK(); 47 void ShutdownSDK();
48 48
49 // This class encapsulates a PDF rendering engine. 49 // This class encapsulates a PDF rendering engine.
50 class PDFEngine { 50 class PDFEngine {
51 public: 51 public:
52
53 enum DocumentPermission { 52 enum DocumentPermission {
54 PERMISSION_COPY, 53 PERMISSION_COPY,
55 PERMISSION_COPY_ACCESSIBLE, 54 PERMISSION_COPY_ACCESSIBLE,
56 PERMISSION_PRINT_LOW_QUALITY, 55 PERMISSION_PRINT_LOW_QUALITY,
57 PERMISSION_PRINT_HIGH_QUALITY, 56 PERMISSION_PRINT_HIGH_QUALITY,
58 }; 57 };
59 58
60 // The interface that's provided to the rendering engine. 59 // The interface that's provided to the rendering engine.
61 class Client { 60 class Client {
62 public: 61 public:
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 // Notifies the client about focus changes for form text fields. 170 // Notifies the client about focus changes for form text fields.
172 virtual void FormTextFieldFocusChange(bool in_focus) = 0; 171 virtual void FormTextFieldFocusChange(bool in_focus) = 0;
173 172
174 // Returns true if the plugin has been opened within print preview. 173 // Returns true if the plugin has been opened within print preview.
175 virtual bool IsPrintPreview() = 0; 174 virtual bool IsPrintPreview() = 0;
176 175
177 // Get the background color of the PDF. 176 // Get the background color of the PDF.
178 virtual uint32 GetBackgroundColor() = 0; 177 virtual uint32 GetBackgroundColor() = 0;
179 178
180 // Sets selection status. 179 // Sets selection status.
181 virtual void IsSelectingChanged(bool is_selecting){}; 180 virtual void IsSelectingChanged(bool is_selecting) {}
182 }; 181 };
183 182
184 // Factory method to create an instance of the PDF Engine. 183 // Factory method to create an instance of the PDF Engine.
185 static PDFEngine* Create(Client* client); 184 static PDFEngine* Create(Client* client);
186 185
187 virtual ~PDFEngine() {} 186 virtual ~PDFEngine() {}
188 // Most of these functions are similar to the Pepper functions of the same 187 // Most of these functions are similar to the Pepper functions of the same
189 // name, so not repeating the description here unless it's different. 188 // name, so not repeating the description here unless it's different.
190 virtual bool New(const char* url) = 0; 189 virtual bool New(const char* url) = 0;
191 virtual bool New(const char* url, 190 virtual bool New(const char* url,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 virtual void SetGrayscale(bool grayscale) = 0; 243 virtual void SetGrayscale(bool grayscale) = 0;
245 // Callback for timer that's set with ScheduleCallback(). 244 // Callback for timer that's set with ScheduleCallback().
246 virtual void OnCallback(int id) = 0; 245 virtual void OnCallback(int id) = 0;
247 // Gets the JSON representation of the PDF file 246 // Gets the JSON representation of the PDF file
248 virtual std::string GetPageAsJSON(int index) = 0; 247 virtual std::string GetPageAsJSON(int index) = 0;
249 // Gets the PDF document's print scaling preference. True if the document can 248 // Gets the PDF document's print scaling preference. True if the document can
250 // be scaled to fit. 249 // be scaled to fit.
251 virtual bool GetPrintScaling() = 0; 250 virtual bool GetPrintScaling() = 0;
252 // Returns number of copies to be printed. 251 // Returns number of copies to be printed.
253 virtual int GetCopiesToPrint() = 0; 252 virtual int GetCopiesToPrint() = 0;
253 // Returns the duplex setting.
254 virtual int GetDuplexType() = 0;
254 255
255 // Returns a VarArray of Bookmarks, each a VarDictionary containing the 256 // Returns a VarArray of Bookmarks, each a VarDictionary containing the
256 // following key/values: 257 // following key/values:
257 // - "title" - a string Var. 258 // - "title" - a string Var.
258 // - "page" - an int Var. 259 // - "page" - an int Var.
259 // - "children" - a VarArray(), with each entry containing a VarDictionary of 260 // - "children" - a VarArray(), with each entry containing a VarDictionary of
260 // the same structure. 261 // the same structure.
261 virtual pp::VarArray GetBookmarks() = 0; 262 virtual pp::VarArray GetBookmarks() = 0;
262 263
263 // Append blank pages to make a 1-page document to a |num_pages| document. 264 // Append blank pages to make a 1-page document to a |num_pages| document.
264 // Always retain the first page data. 265 // Always retain the first page data.
265 virtual void AppendBlankPages(int num_pages) = 0; 266 virtual void AppendBlankPages(int num_pages) = 0;
266 // Append the first page of the document loaded with the |engine| to this 267 // Append the first page of the document loaded with the |engine| to this
267 // document at page |index|. 268 // document at page |index|.
268 virtual void AppendPage(PDFEngine* engine, int index) = 0; 269 virtual void AppendPage(PDFEngine* engine, int index) = 0;
269 270
270 // Allow client to query and reset scroll positions in document coordinates. 271 // Allow client to query and reset scroll positions in document coordinates.
271 // Note that this is meant for cases where the device scale factor changes, 272 // Note that this is meant for cases where the device scale factor changes,
272 // and not for general scrolling - the engine will not repaint due to this. 273 // and not for general scrolling - the engine will not repaint due to this.
273 virtual pp::Point GetScrollPosition() = 0; 274 virtual pp::Point GetScrollPosition() = 0;
274 virtual void SetScrollPosition(const pp::Point& position) = 0; 275 virtual void SetScrollPosition(const pp::Point& position) = 0;
275 276
276 virtual bool IsProgressiveLoad() = 0; 277 virtual bool IsProgressiveLoad() = 0;
277 }; 278 };
278 279
279 // Interface for exports that wrap the PDF engine. 280 // Interface for exports that wrap the PDF engine.
280 class PDFEngineExports { 281 class PDFEngineExports {
281 public: 282 public:
282 struct RenderingSettings { 283 struct RenderingSettings {
283 RenderingSettings(int dpi_x, 284 RenderingSettings(int dpi_x,
284 int dpi_y, 285 int dpi_y,
285 const pp::Rect& bounds, 286 const pp::Rect& bounds,
286 bool fit_to_bounds, 287 bool fit_to_bounds,
287 bool stretch_to_bounds, 288 bool stretch_to_bounds,
288 bool keep_aspect_ratio, 289 bool keep_aspect_ratio,
289 bool center_in_bounds, 290 bool center_in_bounds,
290 bool autorotate) 291 bool autorotate)
291 : dpi_x(dpi_x), dpi_y(dpi_y), bounds(bounds), 292 : dpi_x(dpi_x), dpi_y(dpi_y), bounds(bounds),
292 fit_to_bounds(fit_to_bounds), stretch_to_bounds(stretch_to_bounds), 293 fit_to_bounds(fit_to_bounds), stretch_to_bounds(stretch_to_bounds),
293 keep_aspect_ratio(keep_aspect_ratio), 294 keep_aspect_ratio(keep_aspect_ratio),
294 center_in_bounds(center_in_bounds), autorotate(autorotate) { 295 center_in_bounds(center_in_bounds), autorotate(autorotate) {
295 } 296 }
296 int dpi_x; 297 int dpi_x;
297 int dpi_y; 298 int dpi_y;
298 pp::Rect bounds; 299 pp::Rect bounds;
299 bool fit_to_bounds; 300 bool fit_to_bounds;
300 bool stretch_to_bounds; 301 bool stretch_to_bounds;
301 bool keep_aspect_ratio; 302 bool keep_aspect_ratio;
(...skipping 26 matching lines...) Expand all
328 329
329 // See the definition of GetPDFPageSizeByIndex in pdf.cc for details. 330 // See the definition of GetPDFPageSizeByIndex in pdf.cc for details.
330 virtual bool GetPDFPageSizeByIndex(const void* pdf_buffer, 331 virtual bool GetPDFPageSizeByIndex(const void* pdf_buffer,
331 int pdf_buffer_size, int page_number, 332 int pdf_buffer_size, int page_number,
332 double* width, double* height) = 0; 333 double* width, double* height) = 0;
333 }; 334 };
334 335
335 } // namespace chrome_pdf 336 } // namespace chrome_pdf
336 337
337 #endif // PDF_PDF_ENGINE_H_ 338 #endif // PDF_PDF_ENGINE_H_
OLDNEW
« no previous file with comments | « pdf/out_of_process_instance.cc ('k') | pdf/pdfium/pdfium_assert_matching_enums.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698