summaryrefslogtreecommitdiffstats
path: root/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen.js
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/chrome/browser/resources/pdf/elements/viewer-password-screen.js')
-rw-r--r--chromium/chrome/browser/resources/pdf/elements/viewer-password-screen.js45
1 files changed, 45 insertions, 0 deletions
diff --git a/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen.js b/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen.js
new file mode 100644
index 00000000000..5506ad2915c
--- /dev/null
+++ b/chromium/chrome/browser/resources/pdf/elements/viewer-password-screen.js
@@ -0,0 +1,45 @@
+// 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-password-screen',
+
+ properties: {
+ invalid: Boolean,
+
+ strings: Object,
+ },
+
+ get active() {
+ return this.$.dialog.open;
+ },
+
+ show: function() {
+ this.$.dialog.showModal();
+ },
+
+ close: function() {
+ if (this.active) {
+ this.$.dialog.close();
+ }
+ },
+
+ deny: function() {
+ const password = /** @type {!CrInputElement} */ (this.$.password);
+ password.disabled = false;
+ this.$.submit.disabled = false;
+ this.invalid = true;
+ password.select();
+ },
+
+ submit: function() {
+ const password = /** @type {!CrInputElement} */ (this.$.password);
+ if (password.value.length == 0) {
+ return;
+ }
+ password.disabled = true;
+ this.$.submit.disabled = true;
+ this.fire('password-submitted', {password: password.value});
+ },
+});