Index: chrome/browser/resources/pdf/pdf.js |
diff --git a/chrome/browser/resources/pdf/pdf.js b/chrome/browser/resources/pdf/pdf.js |
index c7b172078d7778472af64c4fe851a35bca15b73e..a048c8e0cf282371e0488f970421004d63fe93b2 100644 |
--- a/chrome/browser/resources/pdf/pdf.js |
+++ b/chrome/browser/resources/pdf/pdf.js |
@@ -396,6 +396,16 @@ PDFViewer.prototype = { |
if (e.ctrlKey) |
this.rotateCounterClockwise_(); |
return; |
+ case 220: // Backslash key. |
+ if (e.ctrlKey) { |
+ if (this.viewport_.fittingType == Viewport.FittingType.FIT_TO_PAGE) { |
+ this.fitToWidth_(); |
+ } else { |
+ this.fitToPage_(); |
+ } |
+ this.zoomToolbar_.toggleFitButtonUIState(); |
raymes
2016/09/05 03:21:40
Could we just call fitToggle on the zoom toolbar?
Lei Zhang
2016/09/07 00:39:09
Done.
|
+ } |
+ return; |
case 221: // right bracket. |
if (e.ctrlKey) |
this.rotateClockwise_(); |
@@ -442,6 +452,10 @@ PDFViewer.prototype = { |
}); |
}, |
+ /** |
+ * @private |
+ * Set zoom to "fit to page". |
+ */ |
fitToPage_: function() { |
this.viewport_.fitToPage(); |
this.toolbarManager_.forceHideTopToolbar(); |
@@ -449,6 +463,15 @@ PDFViewer.prototype = { |
/** |
* @private |
+ * Set zoom to "fit to width". |
+ */ |
+ fitToWidth_: function() { |
+ this.viewport_.fitToWidth(); |
+ this.toolbarManager_.forceHideTopToolbar(); |
+ }, |
+ |
+ /** |
+ * @private |
* Notify the plugin to print. |
*/ |
print_: function() { |