OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** | 5 /** |
6 * @fileoverview | 6 * @fileoverview |
7 * 'settings-on-startup-page' is a settings page. | 7 * 'settings-on-startup-page' is a settings page. |
8 * | 8 * |
9 * Example: | 9 * Example: |
10 * | 10 * |
11 * <neon-animated-pages> | 11 * <neon-animated-pages> |
12 * <settings-on-startup-page prefs="{{prefs}}"> | 12 * <settings-on-startup-page prefs="{{prefs}}"> |
13 * </settings-on-startup-page> | 13 * </settings-on-startup-page> |
14 * ... other pages ... | 14 * ... other pages ... |
15 * </neon-animated-pages> | 15 * </neon-animated-pages> |
16 */ | 16 */ |
17 Polymer({ | 17 Polymer({ |
18 is: 'settings-on-startup-page', | 18 is: 'settings-on-startup-page', |
19 | 19 |
20 properties: { | 20 properties: { |
21 /** | |
22 * Preferences state. | |
23 */ | |
24 prefs: { | 21 prefs: { |
25 type: Object, | 22 type: Object, |
26 notify: true, | 23 notify: true, |
27 }, | 24 }, |
28 | 25 |
26 /** @private {?NtpExtension} */ | |
27 ntpExtension_: Object, | |
28 | |
29 /** | 29 /** |
30 * Enum values for the 'session.restore_on_startup' preference. | 30 * Enum values for the 'session.restore_on_startup' preference. |
31 * @private {!Object<string, number>} | 31 * @private {!Object<string, number>} |
32 */ | 32 */ |
33 prefValues_: { | 33 prefValues_: { |
34 readOnly: true, | 34 readOnly: true, |
35 type: Object, | 35 type: Object, |
36 value: { | 36 value: { |
37 OPEN_NEW_TAB: 5, | 37 OPEN_NEW_TAB: 5, |
dpapad
2016/11/17 01:50:07
Nit: Alphabetize? Or sort by value?
Dan Beam
2016/11/17 02:50:14
Done.
| |
38 CONTINUE: 1, | 38 CONTINUE: 1, |
39 OPEN_SPECIFIC: 4, | 39 OPEN_SPECIFIC: 4, |
40 }, | 40 }, |
41 }, | 41 }, |
42 }, | 42 }, |
43 | 43 |
44 attached: function() { | |
dpapad
2016/11/17 01:50:07
@override
Dan Beam
2016/11/17 02:50:14
Done.
| |
45 this.getNtpExtension_(); | |
46 }, | |
47 | |
48 /** @private */ | |
49 getNtpExtension_: function() { | |
50 settings.OnStartupBrowserProxyImpl.getInstance().getNtpExtension().then( | |
51 function(ntpExtension) { | |
52 this.ntpExtension_ = ntpExtension; | |
53 }.bind(this)); | |
54 }, | |
55 | |
56 /** | |
57 * @param {?NtpExtension} ntpExtension | |
58 * @param {number} restoreOnStartup Value of prefs.session.restore_on_startup. | |
59 * @return {boolean} | |
60 * @private | |
61 */ | |
62 showIndicator_: function(ntpExtension, restoreOnStartup) { | |
63 return !!ntpExtension && restoreOnStartup == this.prefValues_.OPEN_NEW_TAB; | |
64 }, | |
65 | |
44 /** | 66 /** |
45 * Determine whether to show the user defined startup pages. | 67 * Determine whether to show the user defined startup pages. |
46 * @param {number} restoreOnStartup Enum value from prefValues_. | 68 * @param {number} restoreOnStartup Enum value from prefValues_. |
47 * @return {boolean} Whether the open specific pages is selected. | 69 * @return {boolean} Whether the open specific pages is selected. |
48 * @private | 70 * @private |
49 */ | 71 */ |
50 showStartupUrls_: function(restoreOnStartup) { | 72 showStartupUrls_: function(restoreOnStartup) { |
51 return restoreOnStartup == this.prefValues_.OPEN_SPECIFIC; | 73 return restoreOnStartup == this.prefValues_.OPEN_SPECIFIC; |
52 }, | 74 }, |
53 }); | 75 }); |
OLD | NEW |