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

Unified Diff: trunk/src/chrome/browser/resources/pdf/pdf.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 | « no previous file | trunk/src/chrome/browser/resources/pdf/viewport.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/pdf.js
===================================================================
--- trunk/src/chrome/browser/resources/pdf/pdf.js (revision 283268)
+++ trunk/src/chrome/browser/resources/pdf/pdf.js (working copy)
@@ -134,20 +134,6 @@
// Setup the keyboard event listener.
document.onkeydown = this.handleKeyEvent_.bind(this);
-
- // Set up the zoom API.
- chrome.tabs.setZoomSettings({mode: 'manual', scope: 'per-tab'},
- this.afterZoom_.bind(this));
- chrome.tabs.onZoomChange.addListener(function(zoomChangeInfo) {
- // If the zoom level is close enough to the current zoom level, don't change
- // it. This avoids us getting into an infinite loop of zoom changes to to
- // floating point error.
- var MIN_ZOOM_DELTA = 0.01;
- var zoomDelta = Math.abs(this.viewport_.zoom -
- zoomChangeInfo.newZoomFactor);
- if (zoomDelta > MIN_ZOOM_DELTA)
- this.viewport_.setZoom(zoomChangeInfo.newZoomFactor);
- }.bind(this));
}
PDFViewer.prototype = {
@@ -219,6 +205,22 @@
this.viewport.position = position;
}
return;
+ case 187: // +/= key.
+ case 107: // Numpad + key.
+ if (e.ctrlKey || e.metaKey) {
+ this.viewport_.zoomIn();
+ // Since we do the zooming of the page.
+ e.preventDefault();
+ }
+ return;
+ case 189: // -/_ key.
+ case 109: // Numpad - key.
+ if (e.ctrlKey || e.metaKey) {
+ this.viewport_.zoomOut();
+ // Since we do the zooming of the page.
+ e.preventDefault();
+ }
+ return;
case 83: // s key.
if (e.ctrlKey || e.metaKey) {
// Simulate a click on the button so that the <a download ...>
@@ -379,10 +381,6 @@
afterZoom_: function() {
var position = this.viewport_.position;
var zoom = this.viewport_.zoom;
- if (!this.setZoomInProgress_) {
- this.setZoomInProgress_ = true;
- chrome.tabs.setZoom(zoom, this.setZoomComplete_.bind(this, zoom));
- }
this.plugin_.postMessage({
type: 'viewport',
zoom: zoom,
@@ -393,22 +391,6 @@
/**
* @private
- * A callback that's called after chrome.tabs.setZoom is complete. This will
- * call chrome.tabs.setZoom again if the zoom level has changed since it was
- * last called.
- * @param {number} lastZoom the zoom level that chrome.tabs.setZoom was called
- * with.
- */
- setZoomComplete_: function(lastZoom) {
- var zoom = this.viewport_.zoom;
- if (zoom != lastZoom)
- chrome.tabs.setZoom(zoom, this.setZoomComplete_.bind(this, zoom));
- else
- this.setZoomInProgress_ = false;
- },
-
- /**
- * @private
* A callback that's called after the viewport changes.
*/
viewportChanged_: function() {
« no previous file with comments | « no previous file | trunk/src/chrome/browser/resources/pdf/viewport.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698