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

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

Issue 2984843003: MD Settings: Convert all usages of .bind(this) to use ES6 arrow function. (Closed)
Patch Set: Resolve conflicts. Created 3 years, 5 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 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 'settings-startup-urls-page' is the settings page 6 * @fileoverview 'settings-startup-urls-page' is the settings page
7 * containing the urls that will be opened when chrome is started. 7 * containing the urls that will be opened when chrome is started.
8 */ 8 */
9 9
10 Polymer({ 10 Polymer({
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 56
57 /** 57 /**
58 * The element to return focus to, when the startup-url-dialog is closed. 58 * The element to return focus to, when the startup-url-dialog is closed.
59 * @private {?HTMLElement} 59 * @private {?HTMLElement}
60 */ 60 */
61 startupUrlDialogAnchor_: null, 61 startupUrlDialogAnchor_: null,
62 62
63 /** @override */ 63 /** @override */
64 attached: function() { 64 attached: function() {
65 this.getNtpExtension_(); 65 this.getNtpExtension_();
66 this.addWebUIListener('update-ntp-extension', function(ntpExtension) { 66 this.addWebUIListener('update-ntp-extension', ntpExtension => {
67 // Note that |ntpExtension| is empty if there is no NTP extension. 67 // Note that |ntpExtension| is empty if there is no NTP extension.
68 this.ntpExtension_ = ntpExtension; 68 this.ntpExtension_ = ntpExtension;
69 }.bind(this)); 69 });
70 70
71 this.browserProxy_ = settings.StartupUrlsPageBrowserProxyImpl.getInstance(); 71 this.browserProxy_ = settings.StartupUrlsPageBrowserProxyImpl.getInstance();
72 this.addWebUIListener('update-startup-pages', function(startupPages) { 72 this.addWebUIListener('update-startup-pages', startupPages => {
73 // If an "edit" URL dialog was open, close it, because the underlying page 73 // If an "edit" URL dialog was open, close it, because the underlying page
74 // might have just been removed (and model indices have changed anyway). 74 // might have just been removed (and model indices have changed anyway).
75 if (this.startupUrlDialogModel_) 75 if (this.startupUrlDialogModel_)
76 this.destroyUrlDialog_(); 76 this.destroyUrlDialog_();
77 this.startupPages_ = startupPages; 77 this.startupPages_ = startupPages;
78 this.updateScrollableContents(); 78 this.updateScrollableContents();
79 }.bind(this)); 79 });
80 this.browserProxy_.loadStartupPages(); 80 this.browserProxy_.loadStartupPages();
81 81
82 this.addEventListener(settings.EDIT_STARTUP_URL_EVENT, function(event) { 82 this.addEventListener(settings.EDIT_STARTUP_URL_EVENT, event => {
83 this.startupUrlDialogModel_ = event.detail.model; 83 this.startupUrlDialogModel_ = event.detail.model;
84 this.startupUrlDialogAnchor_ = event.detail.anchor; 84 this.startupUrlDialogAnchor_ = event.detail.anchor;
85 this.showStartupUrlDialog_ = true; 85 this.showStartupUrlDialog_ = true;
86 event.stopPropagation(); 86 event.stopPropagation();
87 }.bind(this)); 87 });
88 }, 88 },
89 89
90 /** @private */ 90 /** @private */
91 getNtpExtension_: function() { 91 getNtpExtension_: function() {
92 settings.OnStartupBrowserProxyImpl.getInstance().getNtpExtension().then( 92 settings.OnStartupBrowserProxyImpl.getInstance().getNtpExtension().then(
93 function(ntpExtension) { 93 ntpExtension => {
94 this.ntpExtension_ = ntpExtension; 94 this.ntpExtension_ = ntpExtension;
95 }.bind(this)); 95 });
96 }, 96 },
97 97
98 /** 98 /**
99 * @param {!Event} e 99 * @param {!Event} e
100 * @private 100 * @private
101 */ 101 */
102 onAddPageTap_: function(e) { 102 onAddPageTap_: function(e) {
103 e.preventDefault(); 103 e.preventDefault();
104 this.showStartupUrlDialog_ = true; 104 this.showStartupUrlDialog_ = true;
105 this.startupUrlDialogAnchor_ = 105 this.startupUrlDialogAnchor_ =
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 /** 144 /**
145 * Determine whether to show the user defined startup pages. 145 * Determine whether to show the user defined startup pages.
146 * @param {number} restoreOnStartup Enum value from prefValues_. 146 * @param {number} restoreOnStartup Enum value from prefValues_.
147 * @return {boolean} Whether the open specific pages is selected. 147 * @return {boolean} Whether the open specific pages is selected.
148 * @private 148 * @private
149 */ 149 */
150 showStartupUrls_: function(restoreOnStartup) { 150 showStartupUrls_: function(restoreOnStartup) {
151 return restoreOnStartup == this.prefValues_.OPEN_SPECIFIC; 151 return restoreOnStartup == this.prefValues_.OPEN_SPECIFIC;
152 }, 152 },
153 }); 153 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698