Index: chrome/browser/resources/settings/on_startup_page/startup_urls_page.js |
diff --git a/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js b/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js |
index bdfa547f5fba6bbcdc9d6c71c00ce013f3fb4b86..31e78f8c2be0482d52b7fca758401f8ceb7cd5ee 100644 |
--- a/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js |
+++ b/chrome/browser/resources/settings/on_startup_page/startup_urls_page.js |
@@ -26,6 +26,8 @@ var StartupPageInfo; |
Polymer({ |
is: 'settings-startup-urls-page', |
+ behaviors: [WebUIListenerBehavior], |
+ |
properties: { |
/** |
* Preferences state. |
@@ -35,6 +37,9 @@ Polymer({ |
notify: true, |
}, |
+ /** @type {settings.StartupUrlsPageBrowserProxy} */ |
+ browserProxy_: Object, |
+ |
/** @private {string} */ |
newUrl_: { |
type: String, |
@@ -49,17 +54,16 @@ Polymer({ |
}, |
attached: function() { |
- var self = this; |
- cr.define('Settings', function() { |
- return { |
- updateStartupPages: function() { |
- return self.updateStartupPages_.apply(self, arguments); |
- }, |
- }; |
- }); |
- chrome.send('onStartupPrefsPageLoad'); |
+ this.addWebUIListener('update-startup-pages', |
+ this.updateStartupPages_.bind(this)); |
+ this.browserProxy_ = settings.StartupUrlsPageBrowserProxyImpl.getInstance(); |
+ this.browserProxy_.loadStartupPages(); |
}, |
+ /** |
dschuyler
2016/03/30 23:14:40
Should there be an @param for the url
Dan Beam
2016/03/31 00:06:28
Done.
|
+ * @return {string} A set of icon URLs. |
+ * @private |
+ */ |
getIconSet_: function(url) { |
return getFaviconImageSet(url); |
}, |
@@ -77,7 +81,7 @@ Polymer({ |
/** @private */ |
onUseCurrentPagesTap_: function() { |
- chrome.send('setStartupPagesToCurrentPages'); |
+ this.browserProxy_.useCurrentPages(); |
}, |
/** @private */ |
@@ -90,13 +94,13 @@ Polymer({ |
* @private |
*/ |
isAddEnabled_: function() { |
- return this.newUrl_.trim().length > 0; |
+ return this.browserProxy_ && this.browserProxy_.canAddPage(this.newUrl_); |
Dan Beam
2016/03/30 02:30:23
i don't currently know whether the "this.browserPr
dschuyler
2016/03/30 23:14:40
I asked Demetrios about it. He suggested changing
Dan Beam
2016/03/31 00:06:28
Done. (had to initialize browserProxy_ in created)
|
}, |
/** @private */ |
onAddTap_: function() { |
assert(this.isAddEnabled_()); |
- chrome.send('addStartupPage', [this.newUrl_.trim()]); |
+ this.browserProxy_.addStartupPage(this.newUrl_); |
this.$.addUrlDialog.close(); |
}, |
@@ -105,6 +109,6 @@ Polymer({ |
* @private |
*/ |
onRemoveUrlTap_: function(e) { |
- chrome.send('removeStartupPage', [e.model.index]); |
+ this.browserProxy_.removeStartupPage(e.model.index); |
}, |
}); |