OLD | NEW |
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 * Maximum time to wait after the page is fully loaded before we start to |
| 11 * load polymer elements. |
| 12 * @type {number} |
| 13 * @const |
| 14 */ |
| 15 var POLYMER_LOAD_TIMEOUT_MS = 5000; |
| 16 |
| 17 /** |
10 * QuickUnlockConfigureOverlay class | 18 * QuickUnlockConfigureOverlay class |
11 * Dialog that allows users to configure screen lock. | 19 * Dialog that allows users to configure screen lock. |
12 * @constructor | 20 * @constructor |
13 * @extends {cr.ui.pageManager.Page} | 21 * @extends {cr.ui.pageManager.Page} |
14 */ | 22 */ |
15 function QuickUnlockConfigureOverlay() { | 23 function QuickUnlockConfigureOverlay() { |
16 Page.call(this, 'quickUnlockConfigureOverlay', | 24 Page.call(this, 'quickUnlockConfigureOverlay', |
17 loadTimeData.getString('lockScreenTitle'), | 25 loadTimeData.getString('lockScreenTitle'), |
18 'quick-unlock-configure-overlay'); | 26 'quick-unlock-configure-overlay'); |
19 | 27 |
20 } | 28 } |
21 | 29 |
22 cr.addSingletonGetter(QuickUnlockConfigureOverlay); | 30 cr.addSingletonGetter(QuickUnlockConfigureOverlay); |
23 | 31 |
24 QuickUnlockConfigureOverlay.prototype = { | 32 QuickUnlockConfigureOverlay.prototype = { |
25 __proto__: Page.prototype, | 33 __proto__: Page.prototype, |
26 | 34 |
27 /** @override */ | 35 /** @override */ |
28 initializePage: function() { | 36 initializePage: function() { |
29 Page.prototype.initializePage.call(this); | 37 Page.prototype.initializePage.call(this); |
30 $('screen-lock-done').onclick = function() { | 38 $('screen-lock-done').onclick = function() { |
31 QuickUnlockConfigureOverlay.dismiss(); | 39 QuickUnlockConfigureOverlay.dismiss(); |
32 }; | 40 }; |
| 41 |
| 42 window.addEventListener('load', function() { |
| 43 // Setting a timeout here to avoid racing with some browsertests, |
| 44 // this should be here for only a short period of time as |
| 45 // md-settings are launching soon. |
| 46 setTimeout( |
| 47 this.ensurePolymerIsLoaded_.bind(this), POLYMER_LOAD_TIMEOUT_MS); |
| 48 }.bind(this)); |
33 }, | 49 }, |
34 | 50 |
35 /** @override */ | 51 /** @override */ |
36 didClosePage: function() { | 52 didClosePage: function() { |
37 settings.navigateTo(settings.Route.PEOPLE); | 53 settings.navigateTo(settings.Route.PEOPLE); |
38 }, | 54 }, |
39 | 55 |
40 /** @override */ | 56 /** @override */ |
41 didShowPage: function() { | 57 didShowPage: function() { |
42 this.ensurePolymerIsLoaded_().then(this.onPolymerLoaded_.bind(this)); | 58 this.ensurePolymerIsLoaded_().then(this.onPolymerLoaded_.bind(this)); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 103 |
88 QuickUnlockConfigureOverlay.dismiss = function() { | 104 QuickUnlockConfigureOverlay.dismiss = function() { |
89 PageManager.closeOverlay(); | 105 PageManager.closeOverlay(); |
90 }; | 106 }; |
91 | 107 |
92 // Export | 108 // Export |
93 return { | 109 return { |
94 QuickUnlockConfigureOverlay: QuickUnlockConfigureOverlay | 110 QuickUnlockConfigureOverlay: QuickUnlockConfigureOverlay |
95 }; | 111 }; |
96 }); | 112 }); |
OLD | NEW |