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

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

Issue 1353453003: [MD settings] fixes for OnStartup using the closure compiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review changes; ; 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/settings/on_startup_page/compiled_resources.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 'cr-settings-startup-urls-page' is the settings page 6 * @fileoverview 'cr-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 * Example: 9 * Example:
10 * 10 *
(...skipping 28 matching lines...) Expand all
39 }, 39 },
40 }, 40 },
41 41
42 observers: [ 42 observers: [
43 'prefsChanged_(prefs.session.startup_urls.value.*)', 43 'prefsChanged_(prefs.session.startup_urls.value.*)',
44 ], 44 ],
45 45
46 attached: function() { 46 attached: function() {
47 var updateFunction = this.updateStartupPages_.bind(this); 47 var updateFunction = this.updateStartupPages_.bind(this);
48 cr.define('Settings', function() { 48 cr.define('Settings', function() {
49 var localFunction = updateFunction;
49 return { 50 return {
50 updateStartupPages: updateFunction, 51 updateStartupPages: localFunction,
Dan Beam 2015/09/18 03:12:23 this is probably some chrome-specific compiler pas
dschuyler 2015/09/18 17:31:13 Acknowledged.
51 }; 52 };
Dan Beam 2015/09/18 03:12:23 does this work? var self = this; cr.define('Sett
dschuyler 2015/09/18 17:31:13 Yes, the closure compiler is happy with that. Don
52 }); 53 });
53 }, 54 },
54 55
56
55 /** @private */ 57 /** @private */
56 prefsChanged_: function(change) { 58 prefsChanged_: function(change) {
57 if (this.savedUrlList == undefined && 59 var pref = /** @type {chrome.settingsPrivate.PrefObject} */(
58 this.get('prefs.session.startup_urls')) { 60 this.get('prefs.session.startup_urls'));
59 this.savedUrlList = this.prefs.session.startup_urls.value.slice(); 61 if (this.savedUrlList == undefined && pref) {
Dan Beam 2015/09/18 03:12:23 nit: !this.savedUrlList instead of == undefined
Dan Beam 2015/09/18 03:12:23 nit: no curlies
dschuyler 2015/09/18 17:31:13 Done.
dschuyler 2015/09/18 17:31:13 Done.
62 this.savedUrlList = pref.value.slice();
60 } 63 }
61 }, 64 },
62 65
63 /** @private */ 66 /** @private */
64 updateStartupPages_: function(data) { 67 updateStartupPages_: function(data) {
65 var urlArray = []; 68 var urlArray = [];
66 for (var i = 0; i < data.length; ++i) 69 for (var i = 0; i < data.length; ++i)
67 urlArray.push(data[i].url); 70 urlArray.push(data[i].url);
68 this.set('prefs.session.startup_urls.value', urlArray); 71 this.set('prefs.session.startup_urls.value', urlArray);
69 }, 72 },
(...skipping 20 matching lines...) Expand all
90 }, 93 },
91 94
92 /** 95 /**
93 * @param {!{model: !{index: number}}} e 96 * @param {!{model: !{index: number}}} e
94 * @private 97 * @private
95 */ 98 */
96 onRemoveUrlTap_: function(e) { 99 onRemoveUrlTap_: function(e) {
97 this.splice('prefs.session.startup_urls.value', e.model.index, 1); 100 this.splice('prefs.session.startup_urls.value', e.model.index, 1);
98 }, 101 },
99 }); 102 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/settings/on_startup_page/compiled_resources.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698