summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/pdf/elements/viewer-error-screen/viewer-error-screen.js
blob: cd6c3dc17d4a951ab038f524a76c8ef30bdec7be (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

Polymer({
  is: 'viewer-error-screen',
  properties: {
    reloadFn: {
      type: Object,
      value: null,
      observer: 'reloadFnChanged_'
    }
  },

  reloadFnChanged_: function() {
    // The default margins in paper-dialog don't work well with hiding/showing
    // the .buttons div. We need to manually manage the bottom margin to get
    // around this.
    if (this.reloadFn)
      this.$['load-failed-message'].classList.remove('last-item');
    else
      this.$['load-failed-message'].classList.add('last-item');
  },

  show: function() {
    this.$.dialog.open();
  },

  reload: function() {
    if (this.reloadFn)
      this.reloadFn();
  }
});