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

Unified Diff: chrome/browser/resources/settings/on_startup_page/startup_urls_page.js

Issue 1344613002: [MD settings] on startup use current pages (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9bce9e97b960c5ab00f652ffabac3385e336fb0d..ecf8e63c240646a0a355ea306325d53dd74945e4 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
@@ -36,18 +36,50 @@ Polymer({
/** @type {!Array<string>} */
savedUrlList: {
type: Array,
- value: function() { return []; }
},
},
+ observers: [
+ 'prefsChanged_(prefs.session.startup_urls.value.*)',
+ ],
+
+ attached: function() {
+ var caller = this;
michaelpg 2015/09/14 19:13:49 use .bind instead of caching this
dschuyler 2015/09/14 23:20:00 Done.
+ cr.define('Settings', function() {
michaelpg 2015/09/14 19:13:48 What is this for?
dschuyler 2015/09/14 23:20:00 This is routing the 'Settings.updateStartupPages'
+ return {
+ updateStartupPages: function(data) {
+ caller.updateStartupPages_(data);
+ },
+ };
+ });
+ },
+
+ prefsChanged_: function(change) {
+ if (this.savedUrlList === undefined &&
michaelpg 2015/09/14 19:13:48 use double equals (the property shouldn't be null,
dschuyler 2015/09/14 23:20:00 Actually, I'm expecting it to be undefined. I don
michaelpg 2015/09/17 21:18:13 We rarely use strict equality (===) which is the m
+ this.get('prefs.session.startup_urls')) {
+ this.savedUrlList = this.prefs.session.startup_urls.value.slice();
+ }
+ },
+
+ /** @private */
+ updateStartupPages_: function(data) {
+ var urlArray = [];
+ for (var i = 0; i < data.length; ++i) {
michaelpg 2015/09/14 19:13:48 no braces around single line
dschuyler 2015/09/14 23:20:00 Done.
+ urlArray.push(data[i].url);
michaelpg 2015/09/14 19:13:49 or: var urlArray = data.map(function(datum) { retu
dschuyler 2015/09/14 23:20:00 heh, was this an fyi and I can use either one - or
michaelpg 2015/09/17 21:18:13 "or" meant "optional" :-) I personally prefer this
+ }
+ this.set('prefs.session.startup_urls.value', urlArray);
+ },
+
/** @private */
onUseCurrentPagesTap_: function() {
- // TODO(dschuyler): I'll be making a chrome.send call here.
+ chrome.send('setStartupPagesToCurrentPages');
},
/** @private */
onCancelTap_: function() {
- this.set('prefs.session.startup_urls.value', this.savedUrlList.slice());
+ if (this.savedUrlList !== undefined) {
+ this.set('prefs.session.startup_urls.value', this.savedUrlList.slice());
+ }
},
/** @private */
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698