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

Unified Diff: trunk/src/chrome/browser/resources/pdf/viewport.js

Issue 398643002: Revert 283225 "Hookup the PDF extension to the chrome extensions..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « trunk/src/chrome/browser/resources/pdf/pdf.js ('k') | trunk/src/chrome/test/data/pdf/basic_plugin_test.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: trunk/src/chrome/browser/resources/pdf/viewport.js
===================================================================
--- trunk/src/chrome/browser/resources/pdf/viewport.js (revision 283268)
+++ trunk/src/chrome/browser/resources/pdf/viewport.js (working copy)
@@ -206,11 +206,9 @@
* Sets the zoom of the viewport.
* @param {number} newZoom the zoom level to zoom to.
*/
- setZoomInternal_: function(newZoom) {
- if (!this.allowedToChangeZoom_) {
- throw 'Called Viewport.setZoomInternal_ without calling ' +
- 'Viewport.mightZoom_.';
- }
+ setZoom_: function(newZoom) {
+ if (!this.allowedToChangeZoom_)
+ throw 'Called Viewport.setZoom_ without calling Viewport.mightZoom_.';
var oldZoom = this.zoom_;
this.zoom_ = newZoom;
// Record the scroll position (relative to the middle of the window).
@@ -226,13 +224,12 @@
},
/**
- * Sets the zoom to the given zoom level.
- * @param {number} newZoom the zoom level to zoom to.
+ * @private
+ * Sets the zoom for testing purposes.
*/
- setZoom: function(newZoom) {
+ setZoomForTest_: function(newZoom) {
this.mightZoom_(function() {
- this.setZoomInternal_(newZoom);
- this.updateViewport_();
+ this.setZoom_(newZoom);
}.bind(this));
},
@@ -384,8 +381,7 @@
var oldY = this.window_.pageYOffset / this.zoom_;
// When computing fit-to-width, the maximum width of a page in the
// document is used, which is equal to the size of the document width.
- this.setZoomInternal_(this.computeFittingZoom_(this.documentDimensions_,
- true));
+ this.setZoom_(this.computeFittingZoom_(this.documentDimensions_, true));
var page = this.getMostVisiblePage();
this.window_.scrollTo(0, oldY * this.zoom_);
this.updateViewport_();
@@ -402,7 +398,7 @@
if (!this.documentDimensions_)
return;
var page = this.getMostVisiblePage();
- this.setZoomInternal_(this.computeFittingZoom_(
+ this.setZoom_(this.computeFittingZoom_(
this.pageDimensions_[page], false));
// Center the document in the page by scrolling by the amount of empty
// space to the left of the document.
@@ -426,7 +422,7 @@
if (Viewport.ZOOM_FACTORS[i] < this.zoom_)
nextZoom = Viewport.ZOOM_FACTORS[i];
}
- this.setZoomInternal_(nextZoom);
+ this.setZoom_(nextZoom);
this.updateViewport_();
}.bind(this));
},
@@ -442,7 +438,7 @@
if (Viewport.ZOOM_FACTORS[i] > this.zoom_)
nextZoom = Viewport.ZOOM_FACTORS[i];
}
- this.setZoomInternal_(nextZoom);
+ this.setZoom_(nextZoom);
this.updateViewport_();
}.bind(this));
},
@@ -476,10 +472,9 @@
this.documentDimensions_ = documentDimensions;
this.pageDimensions_ = this.documentDimensions_.pageDimensions;
if (initialDimensions) {
- this.setZoomInternal_(this.computeFittingZoom_(this.documentDimensions_,
- true));
+ this.setZoom_(this.computeFittingZoom_(this.documentDimensions_, true));
if (this.zoom_ > 1)
- this.setZoomInternal_(1);
+ this.setZoom_(1);
this.window_.scrollTo(0, 0);
}
this.contentSizeChanged_();
« no previous file with comments | « trunk/src/chrome/browser/resources/pdf/pdf.js ('k') | trunk/src/chrome/test/data/pdf/basic_plugin_test.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698