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

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

Issue 2529293015: Options: lazily load Polymer when quick unlock dialog is triggered (Closed)
Patch Set: asdf Created 4 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
« no previous file with comments | « no previous file | chrome/browser/resources/options/options.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 21 matching lines...) Expand all
32 }; 32 };
33 }, 33 },
34 34
35 /** @override */ 35 /** @override */
36 didClosePage: function() { 36 didClosePage: function() {
37 settings.navigateTo(settings.Route.PEOPLE); 37 settings.navigateTo(settings.Route.PEOPLE);
38 }, 38 },
39 39
40 /** @override */ 40 /** @override */
41 didShowPage: function() { 41 didShowPage: function() {
42 this.ensurePolymerIsLoaded_().then(this.onPolymerLoaded_.bind(this));
43 },
44
45 /**
46 * @return {!Promise}
47 * @private
48 */
49 ensurePolymerIsLoaded_: function() {
50 this.loaded_ = this.loaded_ || new Promise(function(resolve) {
51 var link = document.createElement('link');
52 link.rel = 'import';
53 link.href = 'chrome://settings-frame/options_polymer.html';
54 link.onload = resolve;
55 document.head.appendChild(link);
56 });
57 return this.loaded_;
58 },
59
60 /**
61 * Called when polymer has been loaded and the dialog should be displayed.
62 * @private
63 */
64 onPolymerLoaded_: function() {
42 settings.navigateTo(settings.Route.LOCK_SCREEN); 65 settings.navigateTo(settings.Route.LOCK_SCREEN);
43 var lockScreen = document.querySelector('settings-lock-screen'); 66 var lockScreen = document.querySelector('settings-lock-screen');
44 67
45 var checkbox = 68 var checkbox =
46 lockScreen.root.querySelector('div.settings-box.single-column'); 69 lockScreen.root.querySelector('div.settings-box.single-column');
47 checkbox.hidden = true; 70 checkbox.hidden = true;
48 71
49 var passwordPrompt = lockScreen.root. 72 var passwordPrompt = lockScreen.root.
50 querySelector('settings-password-prompt-dialog'); 73 querySelector('settings-password-prompt-dialog');
51 passwordPrompt.addEventListener('close', function() { 74 passwordPrompt.addEventListener('close', function() {
52 if (!lockScreen.setModes_) { 75 if (!lockScreen.setModes_) {
53 QuickUnlockConfigureOverlay.dismiss(); 76 QuickUnlockConfigureOverlay.dismiss();
54 } 77 }
55 }.bind(this)); 78 }.bind(this));
56 }, 79 },
57
58 }; 80 };
59 81
60 QuickUnlockConfigureOverlay.dismiss = function() { 82 QuickUnlockConfigureOverlay.dismiss = function() {
61 PageManager.closeOverlay(); 83 PageManager.closeOverlay();
62 }; 84 };
63 85
64 // Export 86 // Export
65 return { 87 return {
66 QuickUnlockConfigureOverlay: QuickUnlockConfigureOverlay 88 QuickUnlockConfigureOverlay: QuickUnlockConfigureOverlay
67 }; 89 };
68 }); 90 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/options/options.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698