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

Side by Side Diff: elements/viewer-password-screen/viewer-password-screen.js

Issue 213223004: Make all the polymer elements CSP compliant. (Closed) Base URL: https://chromium.googlesource.com/chromium/html-office-public.git@master
Patch Set: Created 6 years, 8 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
(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('viewer-password-screen', {
6 text: 'This document is password protected. Please enter a password.',
7 active: false,
8 timerId: undefined,
9 ready: function () {
10 this.activeChanged();
11 },
12 accept: function() {
13 this.successMessage = '✔' // Tick.
14 this.$.successMessage.style.color = 'rgb(0,125,0)';
15 this.active = false;
16 },
17 deny: function() {
18 this.successMessage = '✘'; // Cross.
19 this.$.successMessage.style.color = 'rgb(255,0,0)';
20 this.$.password.disabled = false;
21 this.$.submit.disabled = false;
22 this.$.password.focus();
23 this.$.password.select();
24 },
25 submit: function(e) {
26 // Prevent the default form submission behavior.
27 e.preventDefault();
28 if (this.$.password.value.length == 0)
29 return;
30 this.successMessage = '...';
31 this.$.successMessage.style.color = 'rgb(0,0,0)';
32 this.$.password.disabled = true;
33 this.$.submit.disabled = true;
34 this.fire('password-submitted', {password: this.$.password.value});
35 },
36 activeChanged: function() {
37 clearTimeout(this.timerId);
38 this.timerId = undefined;
39 if (this.active) {
40 this.style.visibility = 'visible';
41 this.style.opacity = 1;
42 this.successMessage = '';
43 this.$.password.focus();
44 } else {
45 this.style.opacity = 0;
46 this.timerId = setTimeout(function() {
47 this.style.visibility = 'hidden'
48 }.bind(this), 400);
49 }
50 }
51 });
OLDNEW
« no previous file with comments | « elements/viewer-password-screen/viewer-password-screen.html ('k') | elements/viewer-progress-bar/viewer-progress-bar.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698