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

Side by Side Diff: chrome/browser/resources/print_preview/previewarea/preview_area.js

Issue 2524143003: Print Preview: Add option to rasterize PDFs and add JPEG compression. (Closed)
Patch Set: Created 4 years 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 (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 /** 5 /**
6 * @typedef {{accessibility: Function, 6 * @typedef {{accessibility: Function,
7 * documentLoadComplete: Function, 7 * documentLoadComplete: Function,
8 * getHeight: Function, 8 * getHeight: Function,
9 * getHorizontalScrollbarThickness: Function, 9 * getHorizontalScrollbarThickness: Function,
10 * getPageLocationNormalized: Function, 10 * getPageLocationNormalized: Function,
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 print_preview.ticket_items.TicketItem.EventType.CHANGE, 366 print_preview.ticket_items.TicketItem.EventType.CHANGE,
367 this.onTicketChange_.bind(this)); 367 this.onTicketChange_.bind(this));
368 this.tracker.add( 368 this.tracker.add(
369 this.printTicketStore_.selectionOnly, 369 this.printTicketStore_.selectionOnly,
370 print_preview.ticket_items.TicketItem.EventType.CHANGE, 370 print_preview.ticket_items.TicketItem.EventType.CHANGE,
371 this.onTicketChange_.bind(this)); 371 this.onTicketChange_.bind(this));
372 this.tracker.add( 372 this.tracker.add(
373 this.printTicketStore_.scaling, 373 this.printTicketStore_.scaling,
374 print_preview.ticket_items.TicketItem.EventType.CHANGE, 374 print_preview.ticket_items.TicketItem.EventType.CHANGE,
375 this.onTicketChange_.bind(this)); 375 this.onTicketChange_.bind(this));
376 this.tracker.add(
377 this.printTicketStore_.rasterize,
378 print_preview.ticket_items.TicketItem.EventType.CHANGE,
379 this.onTicketChange_.bind(this));
380
376 381
377 if (this.checkPluginCompatibility_()) { 382 if (this.checkPluginCompatibility_()) {
378 this.previewGenerator_ = new print_preview.PreviewGenerator( 383 this.previewGenerator_ = new print_preview.PreviewGenerator(
379 this.destinationStore_, 384 this.destinationStore_,
380 this.printTicketStore_, 385 this.printTicketStore_,
381 this.nativeLayer_, 386 this.nativeLayer_,
382 this.documentInfo_); 387 this.documentInfo_);
383 this.tracker.add( 388 this.tracker.add(
384 this.previewGenerator_, 389 this.previewGenerator_,
385 print_preview.PreviewGenerator.EventType.PREVIEW_START, 390 print_preview.PreviewGenerator.EventType.PREVIEW_START,
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 /** 513 /**
509 * Creates a preview plugin and adds it to the DOM. 514 * Creates a preview plugin and adds it to the DOM.
510 * @param {string} srcUrl Initial URL of the plugin. 515 * @param {string} srcUrl Initial URL of the plugin.
511 * @private 516 * @private
512 */ 517 */
513 createPlugin_: function(srcUrl) { 518 createPlugin_: function(srcUrl) {
514 if (this.plugin_) { 519 if (this.plugin_) {
515 console.warn('Pdf preview plugin already created'); 520 console.warn('Pdf preview plugin already created');
516 return; 521 return;
517 } 522 }
518
519 this.plugin_ = /** @type {print_preview.PDFPlugin} */( 523 this.plugin_ = /** @type {print_preview.PDFPlugin} */(
520 PDFCreateOutOfProcessPlugin(srcUrl)); 524 PDFCreateOutOfProcessPlugin(srcUrl));
521 this.plugin_.setKeyEventCallback(this.keyEventCallback_); 525 this.plugin_.setKeyEventCallback(this.keyEventCallback_);
522 526
523 this.plugin_.setAttribute('class', 'preview-area-plugin'); 527 this.plugin_.setAttribute('class', 'preview-area-plugin');
524 this.plugin_.setAttribute('aria-live', 'polite'); 528 this.plugin_.setAttribute('aria-live', 'polite');
525 this.plugin_.setAttribute('aria-atomic', 'true'); 529 this.plugin_.setAttribute('aria-atomic', 'true');
526 // NOTE: The plugin's 'id' field must be set to 'pdf-viewer' since 530 // NOTE: The plugin's 'id' field must be set to 'pdf-viewer' since
527 // chrome/renderer/printing/print_web_view_helper.cc actually references 531 // chrome/renderer/printing/print_web_view_helper.cc actually references
528 // it. 532 // it.
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 // being draggable. 697 // being draggable.
694 this.plugin_.style.pointerEvents = isDragging ? 'none' : 'auto'; 698 this.plugin_.style.pointerEvents = isDragging ? 'none' : 'auto';
695 } 699 }
696 }; 700 };
697 701
698 // Export 702 // Export
699 return { 703 return {
700 PreviewArea: PreviewArea 704 PreviewArea: PreviewArea
701 }; 705 };
702 }); 706 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698