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

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 nit 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 26 matching lines...) Expand all
37 savedUrlList: { 37 savedUrlList: {
38 type: Array, 38 type: Array,
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 self = this;
48 cr.define('Settings', function() { 48 cr.define('Settings', function() {
49 return { 49 return {
50 updateStartupPages: updateFunction, 50 updateStartupPages: function() {
51 return self.updateStartupPages_.apply(self, arguments);
52 },
51 }; 53 };
52 }); 54 });
53 }, 55 },
54 56
57
55 /** @private */ 58 /** @private */
56 prefsChanged_: function(change) { 59 prefsChanged_: function(change) {
57 if (this.savedUrlList == undefined && 60 if (!this.savedUrlList) {
58 this.get('prefs.session.startup_urls')) { 61 var pref = /** @type {chrome.settingsPrivate.PrefObject} */(
59 this.savedUrlList = this.prefs.session.startup_urls.value.slice(); 62 this.get('prefs.session.startup_urls'));
63 if (pref)
64 this.savedUrlList = pref.value.slice();
60 } 65 }
61 }, 66 },
62 67
63 /** @private */ 68 /** @private */
64 updateStartupPages_: function(data) { 69 updateStartupPages_: function(data) {
65 var urlArray = []; 70 var urlArray = [];
66 for (var i = 0; i < data.length; ++i) 71 for (var i = 0; i < data.length; ++i)
67 urlArray.push(data[i].url); 72 urlArray.push(data[i].url);
68 this.set('prefs.session.startup_urls.value', urlArray); 73 this.set('prefs.session.startup_urls.value', urlArray);
69 }, 74 },
(...skipping 20 matching lines...) Expand all
90 }, 95 },
91 96
92 /** 97 /**
93 * @param {!{model: !{index: number}}} e 98 * @param {!{model: !{index: number}}} e
94 * @private 99 * @private
95 */ 100 */
96 onRemoveUrlTap_: function(e) { 101 onRemoveUrlTap_: function(e) {
97 this.splice('prefs.session.startup_urls.value', e.model.index, 1); 102 this.splice('prefs.session.startup_urls.value', e.model.index, 1);
98 }, 103 },
99 }); 104 });
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