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

Side by Side Diff: chrome/browser/resources/options/chromeos/quick_unlock_configure_overlay.js

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 cr.define('options', function() { 5 cr.define('options', function() {
6 var Page = cr.ui.pageManager.Page; 6 var Page = cr.ui.pageManager.Page;
7 var PageManager = cr.ui.pageManager.PageManager; 7 var PageManager = cr.ui.pageManager.PageManager;
8 8
9 /** 9 /**
10 * QuickUnlockConfigureOverlay class 10 * QuickUnlockConfigureOverlay class
11 * Dialog that allows users to configure screen lock. 11 * Dialog that allows users to configure screen lock.
12 * @constructor 12 * @constructor
13 * @extends {cr.ui.pageManager.Page} 13 * @extends {cr.ui.pageManager.Page}
14 */ 14 */
15 function QuickUnlockConfigureOverlay() { 15 function QuickUnlockConfigureOverlay() {
16 Page.call(this, 'quickUnlockConfigureOverlay', 16 Page.call(
17 loadTimeData.getString('lockScreenTitle'), 17 this, 'quickUnlockConfigureOverlay',
18 'quick-unlock-configure-overlay'); 18 loadTimeData.getString('lockScreenTitle'),
19 19 'quick-unlock-configure-overlay');
20 } 20 }
21 21
22 cr.addSingletonGetter(QuickUnlockConfigureOverlay); 22 cr.addSingletonGetter(QuickUnlockConfigureOverlay);
23 23
24 QuickUnlockConfigureOverlay.prototype = { 24 QuickUnlockConfigureOverlay.prototype = {
25 __proto__: Page.prototype, 25 __proto__: Page.prototype,
26 26
27 /** @override */ 27 /** @override */
28 initializePage: function() { 28 initializePage: function() {
29 Page.prototype.initializePage.call(this); 29 Page.prototype.initializePage.call(this);
(...skipping 14 matching lines...) Expand all
44 didShowPage: function() { 44 didShowPage: function() {
45 this.ensurePolymerIsLoaded_().then(this.onPolymerLoaded_.bind(this)); 45 this.ensurePolymerIsLoaded_().then(this.onPolymerLoaded_.bind(this));
46 }, 46 },
47 47
48 /** 48 /**
49 * @return {!Promise} 49 * @return {!Promise}
50 * @private 50 * @private
51 */ 51 */
52 ensurePolymerIsLoaded_: function() { 52 ensurePolymerIsLoaded_: function() {
53 this.loaded_ = this.loaded_ || new Promise(function(resolve) { 53 this.loaded_ = this.loaded_ || new Promise(function(resolve) {
54 var link = document.createElement('link'); 54 var link = document.createElement('link');
55 link.rel = 'import'; 55 link.rel = 'import';
56 link.href = 'chrome://settings-frame/options_polymer.html'; 56 link.href =
57 link.onload = resolve; 57 'chrome://settings-frame/options_polymer.html';
58 document.head.appendChild(link); 58 link.onload = resolve;
59 }); 59 document.head.appendChild(link);
60 });
60 return this.loaded_; 61 return this.loaded_;
61 }, 62 },
62 63
63 /** 64 /**
64 * Called when polymer has been loaded and the dialog should be displayed. 65 * Called when polymer has been loaded and the dialog should be displayed.
65 * @private 66 * @private
66 */ 67 */
67 onPolymerLoaded_: function() { 68 onPolymerLoaded_: function() {
68 settings.navigateTo(settings.Route.LOCK_SCREEN); 69 settings.navigateTo(settings.Route.LOCK_SCREEN);
69 var lockScreen = document.querySelector('settings-lock-screen'); 70 var lockScreen = document.querySelector('settings-lock-screen');
70 71
71 // On settings the screen lock is part of the lock screen, but on options 72 // On settings the screen lock is part of the lock screen, but on options
72 // it is already part of the sync page, so hide the lock screen version on 73 // it is already part of the sync page, so hide the lock screen version on
73 // options. 74 // options.
74 var screenLockDiv = lockScreen.root.querySelector('#screenLockDiv'); 75 var screenLockDiv = lockScreen.root.querySelector('#screenLockDiv');
75 screenLockDiv.hidden = true; 76 screenLockDiv.hidden = true;
76 77
77 // The fingerprint settings and easy unlock on options is always hidden. 78 // The fingerprint settings and easy unlock on options is always hidden.
78 var fingerprintDiv = lockScreen.root.querySelector('#fingerprintDiv'); 79 var fingerprintDiv = lockScreen.root.querySelector('#fingerprintDiv');
79 fingerprintDiv.hidden = true; 80 fingerprintDiv.hidden = true;
80 var easyUnlockDiv = lockScreen.root.querySelector('#easyUnlock'); 81 var easyUnlockDiv = lockScreen.root.querySelector('#easyUnlock');
81 easyUnlockDiv.hidden = true; 82 easyUnlockDiv.hidden = true;
82 83
83 var passwordPrompt = lockScreen.root. 84 var passwordPrompt =
84 querySelector('settings-password-prompt-dialog'); 85 lockScreen.root.querySelector('settings-password-prompt-dialog');
85 passwordPrompt.addEventListener('close', function() { 86 passwordPrompt.addEventListener('close', function() {
86 if (!lockScreen.setModes_) { 87 if (!lockScreen.setModes_) {
87 QuickUnlockConfigureOverlay.dismiss(); 88 QuickUnlockConfigureOverlay.dismiss();
88 } 89 }
89 }.bind(this)); 90 }.bind(this));
90 }, 91 },
91 }; 92 };
92 93
93 QuickUnlockConfigureOverlay.dismiss = function() { 94 QuickUnlockConfigureOverlay.dismiss = function() {
94 PageManager.closeOverlay(); 95 PageManager.closeOverlay();
95 }; 96 };
96 97
97 // Export 98 // Export
98 return { 99 return {QuickUnlockConfigureOverlay: QuickUnlockConfigureOverlay};
99 QuickUnlockConfigureOverlay: QuickUnlockConfigureOverlay
100 };
101 }); 100 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698