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

Unified Diff: chrome/browser/resources/pdf/toolbar_manager.js

Issue 1332273003: Change the print preview UI to use the material design style buttons for zoom (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « chrome/browser/resources/pdf/pdf_scripting_api.js ('k') | pdf/out_of_process_instance.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/pdf/toolbar_manager.js
diff --git a/chrome/browser/resources/pdf/toolbar_manager.js b/chrome/browser/resources/pdf/toolbar_manager.js
index 31fd0bdf9c189fceb15f4de20c309bba078d1465..d452af79314b5eb28b3109a6314096b2dfa9fb94 100644
--- a/chrome/browser/resources/pdf/toolbar_manager.js
+++ b/chrome/browser/resources/pdf/toolbar_manager.js
@@ -68,7 +68,7 @@ function ToolbarManager(window, toolbar, zoomToolbar) {
ToolbarManager.prototype = {
showToolbarsForMouseMove: function(e) {
- this.isMouseNearTopToolbar_ = isMouseNearTopToolbar(e);
+ this.isMouseNearTopToolbar_ = this.toolbar_ && isMouseNearTopToolbar(e);
this.isMouseNearSideToolbar_ = isMouseNearSideToolbar(e);
// Allow the top toolbar to be shown if the mouse moves away from the side
@@ -96,7 +96,8 @@ ToolbarManager.prototype = {
* Display both UI toolbars.
*/
showToolbars: function() {
- this.toolbar_.show();
+ if (this.toolbar_)
+ this.toolbar_.show();
this.zoomToolbar_.show();
},
@@ -106,11 +107,15 @@ ToolbarManager.prototype = {
* elements.
*/
hideToolbarsIfAllowed: function() {
- if (!(this.isMouseNearTopToolbar_ || this.isMouseNearSideToolbar_ ||
- this.toolbar_.shouldKeepOpen())) {
+ if (this.isMouseNearSideToolbar_ || this.isMouseNearTopToolbar_)
+ return;
+
+ if (this.toolbar_ && this.toolbar_.shouldKeepOpen())
+ return;
+
+ if (this.toolbar_)
this.toolbar_.hide();
- this.zoomToolbar_.hide();
- }
+ this.zoomToolbar_.hide();
},
/**
@@ -128,7 +133,7 @@ ToolbarManager.prototype = {
* hides the basic toolbars otherwise.
*/
hideSingleToolbarLayer: function() {
- if (!this.toolbar_.hideDropdowns())
+ if (!this.toolbar_ || !this.toolbar_.hideDropdowns())
this.hideToolbarsIfAllowed();
},
@@ -141,6 +146,8 @@ ToolbarManager.prototype = {
* of the screen.
*/
forceHideTopToolbar: function() {
+ if (!this.toolbar_)
+ return;
this.toolbar_.hide();
this.sideToolbarAllowedOnly_ = true;
this.sideToolbarAllowedOnlyTimer_ = this.window_.setTimeout(function() {
@@ -154,6 +161,8 @@ ToolbarManager.prototype = {
* @private
*/
resizeDropdowns_: function() {
+ if (!this.toolbar_)
+ return;
var lowerBound = this.window_.innerHeight - this.zoomToolbar_.clientHeight;
this.toolbar_.setDropdownLowerBound(lowerBound);
}
« no previous file with comments | « chrome/browser/resources/pdf/pdf_scripting_api.js ('k') | pdf/out_of_process_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698