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

Side by Side Diff: chrome/browser/resources/pdf/elements/viewer-password-screen-legacy/viewer-password-screen-legacy.js

Issue 1521913002: PDF: Delete non-material viewer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
(Empty)
1 // Copyright 2014 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
5 Polymer({
6 is: 'viewer-password-screen-legacy',
7
8 properties: {
9 text: {
10 type: String,
11 value: 'This document is password protected. Please enter a password.',
12 },
13
14 active: {
15 type: Boolean,
16 value: false,
17 observer: 'activeChanged'
18 }
19 },
20
21 timerId: undefined,
22
23 ready: function() {
24 this.activeChanged();
25 },
26
27 accept: function() {
28 this.active = false;
29 },
30
31 deny: function() {
32 this.$.password.disabled = false;
33 this.$.submit.disabled = false;
34 this.$.password.focus();
35 this.$.password.select();
36 },
37
38 submit: function(e) {
39 // Prevent the default form submission behavior.
40 e.preventDefault();
41 if (this.$.password.value.length == 0)
42 return;
43 this.$.password.disabled = true;
44 this.$.submit.disabled = true;
45 this.fire('password-submitted', {password: this.$.password.value});
46 },
47
48 activeChanged: function() {
49 clearTimeout(this.timerId);
50 this.timerId = undefined;
51 if (this.active) {
52 this.style.visibility = 'visible';
53 this.style.opacity = 1;
54 this.$.password.focus();
55 } else {
56 this.style.opacity = 0;
57 this.timerId = setTimeout(function() {
58 this.style.visibility = 'hidden';
59 }.bind(this), 400);
60 }
61 }
62 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698