cygprofile: increase timeouts to allow showing web contents
[chromium-blink-merge.git] / chrome / browser / resources / pdf / elements / viewer-pdf-toolbar / viewer-pdf-toolbar.js
blob7b087436ae0ca9068d3f3ab3ba58bc976cfd96de
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
3 // found in the LICENSE file.
4 (function() {
5 Polymer({
6 is: 'viewer-pdf-toolbar',
8 behaviors: [
9 Polymer.NeonAnimationRunnerBehavior
12 properties: {
13 /**
14 * The current loading progress of the PDF document (0 - 100).
16 loadProgress: {
17 type: Number,
18 observer: 'loadProgressChanged'
21 /**
22 * The title of the PDF document.
24 docTitle: String,
26 /**
27 * The number of the page being viewed (1-based).
29 pageNo: Number,
31 /**
32 * Tree of PDF bookmarks (or null if the document has no bookmarks).
34 bookmarks: {
35 type: Object,
36 value: null
39 /**
40 * The number of pages in the PDF document.
42 docLength: Number,
44 /**
45 * Whether the toolbar is opened and visible.
47 opened: {
48 type: Boolean,
49 value: true
52 animationConfig: {
53 value: function() {
54 return {
55 'entry': {
56 name: 'slide-down-animation',
57 node: this,
58 timing: {
59 easing: 'cubic-bezier(0, 0, 0.2, 1)',
60 duration: 250
63 'exit': {
64 name: 'slide-up-animation',
65 node: this,
66 timing: {
67 easing: 'cubic-bezier(0.4, 0, 1, 1)',
68 duration: 250
76 hostAttributes: {
77 hidden: true // Toolbars are explicitly shown once the plugin is ready.
80 listeners: {
81 'neon-animation-finish': '_onAnimationFinished'
84 _onAnimationFinished: function() {
85 this.style.transform = this.opened ? 'none' : 'translateY(-100%)';
88 loadProgressChanged: function() {
89 if (this.loadProgress >= 100) {
90 this.$.title.classList.toggle('invisible', false);
91 this.$.pageselector.classList.toggle('invisible', false);
92 this.$.buttons.classList.toggle('invisible', false);
96 hide: function() {
97 if (this.opened)
98 this.toggleVisibility();
101 show: function() {
102 if (!this.opened) {
103 this.toggleVisibility();
107 toggleVisibility: function() {
108 this.opened = !this.opened;
109 this.cancelAnimation();
110 this.playAnimation(this.opened ? 'entry' : 'exit');
113 selectPageNumber: function() {
114 this.$.pageselector.select();
117 shouldKeepOpen: function() {
118 return this.$.bookmarks.dropdownOpen || this.loadProgress < 100 ||
119 this.$.pageselector.isActive();
122 hideDropdowns: function() {
123 if (this.$.bookmarks.dropdownOpen) {
124 this.$.bookmarks.toggleDropdown();
125 return true;
127 return false;
130 setDropdownLowerBound: function(lowerBound) {
131 this.$.bookmarks.lowerBound = lowerBound;
134 rotateLeft: function() {
135 this.fire('rotate-left');
138 rotateRight: function() {
139 this.fire('rotate-right');
142 save: function() {
143 this.fire('save');
146 print: function() {
147 this.fire('print');
150 })();