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

Side by Side Diff: chrome/browser/resources/pdf/ui_manager.js

Issue 966293002: Make sure the PDF material toolbar gets hidden after loading. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 'use strict'; 5 'use strict';
6 6
7 var HIDE_TIMEOUT = 2000; 7 var HIDE_TIMEOUT = 2000;
8 8
9 /** 9 /**
10 * Creates a UI Manager to handle transitioning of toolbars and panes. 10 * Creates a UI Manager to handle transitioning of toolbars and panes.
11 * @constructor 11 * @constructor
12 * @param {Object} window The window containing the UI. 12 * @param {Object} window The window containing the UI.
13 * @param {Object} toolbar The toolbar element. 13 * @param {Object} toolbar The toolbar element.
14 * @param {Array} panes The panes that may be pulled in. 14 * @param {Array} panes The panes that may be pulled in.
15 */ 15 */
16 function UiManager(window, toolbar, panes) { 16 function UiManager(window, toolbar, panes) {
17 this.window_ = window; 17 this.window_ = window;
18 this.toolbar_ = toolbar; 18 this.toolbar_ = toolbar;
19 this.panes_ = panes; 19 this.panes_ = panes;
20 20
21 this.uiTimeout_ = null; 21 this.uiTimeout_ = null;
22 22
23 var userInputs = ['click', 'keydown', 'mousemove', 'scroll']; 23 var userInputs = ['click', 'keydown', 'mousemove', 'scroll'];
24 for (var i = 0; i < userInputs.length; i++) 24 for (var i = 0; i < userInputs.length; i++)
25 this.window_.addEventListener(userInputs[i], this.showUi_.bind(this)); 25 this.window_.addEventListener(userInputs[i], this.showUi.bind(this));
26 } 26 }
27 27
28 UiManager.prototype = { 28 UiManager.prototype = {
29 /** 29 /**
30 * @private 30 * @private
31 * Display the toolbar and any pane that was previously opened. 31 * Display the toolbar and any pane that was previously opened.
32 */ 32 */
33 showUi_: function() { 33 showUi: function() {
34 this.toolbar_.show(); 34 this.toolbar_.show();
35 for (var i = 0; i < this.panes_.length; i++) 35 for (var i = 0; i < this.panes_.length; i++)
36 this.panes_[i].showIfOpenedByUser(); 36 this.panes_[i].showIfOpenedByUser();
37 37
38 if (this.uiTimeout_) 38 if (this.uiTimeout_)
39 clearTimeout(this.uiTimeout_); 39 clearTimeout(this.uiTimeout_);
40 this.uiTimeout_ = setTimeout(this.hideUi_.bind(this), HIDE_TIMEOUT); 40 this.uiTimeout_ = setTimeout(this.hideUi_.bind(this), HIDE_TIMEOUT);
41 }, 41 },
42 42
43 /** 43 /**
44 * @private 44 * @private
45 * Hide the toolbar and any pane that was previously opened. 45 * Hide the toolbar and any pane that was previously opened.
46 */ 46 */
47 hideUi_: function() { 47 hideUi_: function() {
48 this.toolbar_.hide(); 48 this.toolbar_.hide();
49 for (var i = 0; i < this.panes_.length; i++) 49 for (var i = 0; i < this.panes_.length; i++)
50 this.panes_[i].hideIfOpenedByUser(); 50 this.panes_[i].hideIfOpenedByUser();
51 } 51 }
52 }; 52 };
OLDNEW
« chrome/browser/resources/pdf/pdf.js ('K') | « chrome/browser/resources/pdf/pdf.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698