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

Side by Side Diff: chrome/browser/resources/settings/on_startup_page/on_startup_page.js

Issue 2507003005: Implement extension controlled indicators, starting with New Tab page (Closed)
Patch Set: merge Created 4 years, 1 month 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 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 CONTINUE: 1,
37 OPEN_NEW_TAB: 5, 38 OPEN_NEW_TAB: 5,
38 CONTINUE: 1,
39 OPEN_SPECIFIC: 4, 39 OPEN_SPECIFIC: 4,
40 }, 40 },
41 }, 41 },
42 }, 42 },
43 43
44 /** @override */
45 attached: function() {
46 this.getNtpExtension_();
47 },
48
49 /** @private */
50 getNtpExtension_: function() {
51 settings.OnStartupBrowserProxyImpl.getInstance().getNtpExtension().then(
52 function(ntpExtension) {
53 this.ntpExtension_ = ntpExtension;
54 }.bind(this));
55 },
56
57 /**
58 * @param {?NtpExtension} ntpExtension
59 * @param {number} restoreOnStartup Value of prefs.session.restore_on_startup.
60 * @return {boolean}
61 * @private
62 */
63 showIndicator_: function(ntpExtension, restoreOnStartup) {
64 return !!ntpExtension && restoreOnStartup == this.prefValues_.OPEN_NEW_TAB;
65 },
66
44 /** 67 /**
45 * Determine whether to show the user defined startup pages. 68 * Determine whether to show the user defined startup pages.
46 * @param {number} restoreOnStartup Enum value from prefValues_. 69 * @param {number} restoreOnStartup Enum value from prefValues_.
47 * @return {boolean} Whether the open specific pages is selected. 70 * @return {boolean} Whether the open specific pages is selected.
48 * @private 71 * @private
49 */ 72 */
50 showStartupUrls_: function(restoreOnStartup) { 73 showStartupUrls_: function(restoreOnStartup) {
51 return restoreOnStartup == this.prefValues_.OPEN_SPECIFIC; 74 return restoreOnStartup == this.prefValues_.OPEN_SPECIFIC;
52 }, 75 },
53 }); 76 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698