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

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: Adding documentation 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
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('errorOccurred',
295 this.onErrorOccurred.bind(this));
294 }, 296 },
295 297
296 /** 298 /**
299 * Executes when an 'errorOccurred' event occurs.
300 */
301 onErrorOccurred: function() {
Evan Stade 2011/10/19 22:34:11 private
dpapad 2011/10/19 22:56:21 Done.
302 if (this.isCustomMarginsSelected()) {
303 this.removeCustomMarginEventListeners_();
304 this.marginsUI.hide();
305 }
306 },
307
308 /**
297 * Executes whenever a "DragEvent" occurs. 309 * Executes whenever a "DragEvent" occurs.
298 * @param {cr.Event} e The event that triggered this listener. 310 * @param {cr.Event} e The event that triggered this listener.
299 */ 311 */
300 onDragEvent_: function(e) { 312 onDragEvent_: function(e) {
301 var dragDeltaInPoints = this.convertDragDeltaToPoints_(e.dragDelta); 313 var dragDeltaInPoints = this.convertDragDeltaToPoints_(e.dragDelta);
302 this.marginsUI.lastClickedMarginsUIPair.updateWhileDragging( 314 this.marginsUI.lastClickedMarginsUIPair.updateWhileDragging(
303 dragDeltaInPoints, e.destinationPoint); 315 dragDeltaInPoints, e.destinationPoint);
304 }, 316 },
305 317
306 /** 318 /**
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 if (!previewModifiable) 603 if (!previewModifiable)
592 fadeOutElement(this.marginsOption_); 604 fadeOutElement(this.marginsOption_);
593 } 605 }
594 }; 606 };
595 607
596 return { 608 return {
597 MarginSettings: MarginSettings, 609 MarginSettings: MarginSettings,
598 PageLayout: PageLayout, 610 PageLayout: PageLayout,
599 }; 611 };
600 }); 612 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698