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

Side by Side Diff: chrome/browser/resources/print_preview/margin_settings.js

Issue 8343017: Print Preview: Hiding margins UI if an error occurs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/preview_area.js » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 cr.define('print_preview', function() { 5 cr.define('print_preview', function() {
6 'use strict'; 6 'use strict';
7 7
8 /** 8 /**
9 * Creates a Margins object that holds four margin values. The units in which 9 * Creates a Margins object that holds four margin values. The units in which
10 * the values are expressed can be any numeric value. 10 * the values are expressed can be any numeric value.
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
284 this.marginsUI.show(); 284 this.marginsUI.show();
285 }, 285 },
286 286
287 /** 287 /**
288 * Adds listeners to all margin related controls. 288 * Adds listeners to all margin related controls.
289 * @private 289 * @private
290 */ 290 */
291 addEventListeners_: function() { 291 addEventListeners_: function() {
292 this.marginList_.onchange = this.onMarginsChanged_.bind(this); 292 this.marginList_.onchange = this.onMarginsChanged_.bind(this);
293 document.addEventListener('PDFLoaded', this.onPDFLoaded_.bind(this)); 293 document.addEventListener('PDFLoaded', this.onPDFLoaded_.bind(this));
294 document.addEventListener('PDFGenerationError',
295 this.onPDFGenerationError_.bind(this));
294 }, 296 },
295 297
296 /** 298 /**
299 * Executes when an 'PDFGenerationError' event occurs.
300 * @private
301 */
302 onPDFGenerationError_: function() {
303 if (this.isCustomMarginsSelected()) {
304 this.removeCustomMarginEventListeners_();
305 this.marginsUI.hide();
306 }
307 },
308
309 /**
297 * Executes whenever a "DragEvent" occurs. 310 * Executes whenever a "DragEvent" occurs.
298 * @param {cr.Event} e The event that triggered this listener. 311 * @param {cr.Event} e The event that triggered this listener.
299 */ 312 */
300 onDragEvent_: function(e) { 313 onDragEvent_: function(e) {
301 var dragDeltaInPoints = this.convertDragDeltaToPoints_(e.dragDelta); 314 var dragDeltaInPoints = this.convertDragDeltaToPoints_(e.dragDelta);
302 this.marginsUI.lastClickedMarginsUIPair.updateWhileDragging( 315 this.marginsUI.lastClickedMarginsUIPair.updateWhileDragging(
303 dragDeltaInPoints, e.destinationPoint); 316 dragDeltaInPoints, e.destinationPoint);
304 }, 317 },
305 318
306 /** 319 /**
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 if (!previewModifiable) 604 if (!previewModifiable)
592 fadeOutElement(this.marginsOption_); 605 fadeOutElement(this.marginsOption_);
593 } 606 }
594 }; 607 };
595 608
596 return { 609 return {
597 MarginSettings: MarginSettings, 610 MarginSettings: MarginSettings,
598 PageLayout: PageLayout, 611 PageLayout: PageLayout,
599 }; 612 };
600 }); 613 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/print_preview/preview_area.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698