Add new certificateProvider extension API.
[chromium-blink-merge.git] / chrome / browser / resources / pdf / elements / viewer-zoom-toolbar / viewer-zoom-toolbar.js
blobd16512879dab278a91c3bbf216961ba4ec7e3a71
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.
5 (function() {
7   var FIT_TO_PAGE = 0;
8   var FIT_TO_WIDTH = 1;
10   Polymer({
11     is: 'viewer-zoom-toolbar',
13     properties: {
14       visible_: {
15         type: Boolean,
16         value: true
17       }
18     },
20     hostAttributes: {
21       hidden: true  // Toolbars are explicitly shown once the plugin is ready.
22     },
24     fitToggle: function() {
25       if (this.$['fit-button'].activeIndex == FIT_TO_WIDTH)
26         this.fire('fit-to-width');
27       else
28         this.fire('fit-to-page');
29     },
31     zoomIn: function() {
32       this.fire('zoom-in');
33     },
35     zoomOut: function() {
36       this.fire('zoom-out');
37     },
39     show: function() {
40       if (!this.visible_) {
41         this.visible_ = true;
42         this.$['fit-button'].show();
43         this.$['zoom-in-button'].show();
44         this.$['zoom-out-button'].show();
45       }
46     },
48     hide: function() {
49       if (this.visible_) {
50         this.visible_ = false;
51         this.$['fit-button'].hide();
52         this.$['zoom-in-button'].hide();
53         this.$['zoom-out-button'].hide();
54       }
55     },
56   });
58 })();