Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 cr.define('options', function() { | 5 cr.define('options', function() { |
| 6 var OptionsPage = options.OptionsPage; | 6 var OptionsPage = options.OptionsPage; |
| 7 var ArrayDataModel = cr.ui.ArrayDataModel; | 7 var ArrayDataModel = cr.ui.ArrayDataModel; |
| 8 | 8 |
| 9 const localStrings = new LocalStrings(); | 9 const localStrings = new LocalStrings(); |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 ManageProfileOverlay.prototype = { | 26 ManageProfileOverlay.prototype = { |
| 27 // Inherit from OptionsPage. | 27 // Inherit from OptionsPage. |
| 28 __proto__: OptionsPage.prototype, | 28 __proto__: OptionsPage.prototype, |
| 29 | 29 |
| 30 // Info about the currently managed/deleted profile. | 30 // Info about the currently managed/deleted profile. |
| 31 profileInfo_: null, | 31 profileInfo_: null, |
| 32 | 32 |
| 33 // An object containing all known profile names. | 33 // An object containing all known profile names. |
| 34 profileNames_: {}, | 34 profileNames_: {}, |
| 35 | 35 |
| 36 // The currently selected icon in the icon grid. | |
| 37 iconGridSelectedURL_: null, | |
| 38 | |
| 36 /** | 39 /** |
| 37 * Initialize the page. | 40 * Initialize the page. |
| 38 */ | 41 */ |
| 39 initializePage: function() { | 42 initializePage: function() { |
| 40 // Call base class implementation to start preference initialization. | 43 // Call base class implementation to start preference initialization. |
| 41 OptionsPage.prototype.initializePage.call(this); | 44 OptionsPage.prototype.initializePage.call(this); |
| 42 | 45 |
| 43 var self = this; | 46 var self = this; |
| 44 var iconGrid = $('manage-profile-icon-grid'); | 47 var iconGrid = $('manage-profile-icon-grid'); |
| 45 options.ProfilesIconGrid.decorate(iconGrid); | 48 options.ProfilesIconGrid.decorate(iconGrid); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 84 * @param {Object} profileInfo An object of the form: | 87 * @param {Object} profileInfo An object of the form: |
| 85 * profileInfo = { | 88 * profileInfo = { |
| 86 * name: "Profile Name", | 89 * name: "Profile Name", |
| 87 * iconURL: "chrome://path/to/icon/image", | 90 * iconURL: "chrome://path/to/icon/image", |
| 88 * filePath: "/path/to/profile/data/on/disk" | 91 * filePath: "/path/to/profile/data/on/disk" |
| 89 * isCurrentProfile: false, | 92 * isCurrentProfile: false, |
| 90 * }; | 93 * }; |
| 91 * @private | 94 * @private |
| 92 */ | 95 */ |
| 93 setProfileInfo_: function(profileInfo) { | 96 setProfileInfo_: function(profileInfo) { |
| 97 this.iconGridSelectedURL_ = profileInfo.iconURL; | |
| 94 this.profileInfo_ = profileInfo; | 98 this.profileInfo_ = profileInfo; |
| 95 $('manage-profile-name').value = profileInfo.name; | 99 $('manage-profile-name').value = profileInfo.name; |
| 96 $('manage-profile-icon-grid').selectedItem = profileInfo.iconURL; | 100 $('manage-profile-icon-grid').selectedItem = profileInfo.iconURL; |
| 97 }, | 101 }, |
| 98 | 102 |
| 99 /** | 103 /** |
| 100 * Sets the name of the currently edited profile. | 104 * Sets the name of the currently edited profile. |
| 101 * @private | 105 * @private |
| 102 */ | 106 */ |
| 103 setProfileName_: function(name) { | 107 setProfileName_: function(name) { |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 190 chrome.send('setProfileNameAndIcon', | 194 chrome.send('setProfileNameAndIcon', |
| 191 [this.profileInfo_.filePath, name, iconURL]); | 195 [this.profileInfo_.filePath, name, iconURL]); |
| 192 }, | 196 }, |
| 193 | 197 |
| 194 /** | 198 /** |
| 195 * Called when the selected icon in the icon grid changes. | 199 * Called when the selected icon in the icon grid changes. |
| 196 * @private | 200 * @private |
| 197 */ | 201 */ |
| 198 onIconGridSelectionChanged_: function() { | 202 onIconGridSelectionChanged_: function() { |
| 199 var iconURL = $('manage-profile-icon-grid').selectedItem; | 203 var iconURL = $('manage-profile-icon-grid').selectedItem; |
| 204 if (!iconURL || iconURL == this.iconGridSelectedURL_) | |
| 205 return; | |
| 206 this.iconGridSelectedURL_ = iconURL; | |
|
binji
2011/12/12 18:44:52
Shouldn't this be set, even if iconURL is null?
sail
2011/12/12 18:53:58
The iconURL becomes NULL when the overlay is close
| |
| 200 chrome.send('profileIconSelectionChanged', | 207 chrome.send('profileIconSelectionChanged', |
| 201 [this.profileInfo_.filePath, iconURL]); | 208 [this.profileInfo_.filePath, iconURL]); |
| 202 }, | 209 }, |
| 203 | 210 |
| 204 /** | 211 /** |
| 205 * Display the "Manage Profile" dialog. | 212 * Display the "Manage Profile" dialog. |
| 206 * @param {Object} profileInfo The profile object of the profile to manage. | 213 * @param {Object} profileInfo The profile object of the profile to manage. |
| 207 * @private | 214 * @private |
| 208 */ | 215 */ |
| 209 showManageDialog_: function(profileInfo) { | 216 showManageDialog_: function(profileInfo) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 249 ManageProfileOverlay[name] = function(value) { | 256 ManageProfileOverlay[name] = function(value) { |
| 250 ManageProfileOverlay.getInstance()[name + '_'](value); | 257 ManageProfileOverlay.getInstance()[name + '_'](value); |
| 251 }; | 258 }; |
| 252 }); | 259 }); |
| 253 | 260 |
| 254 // Export | 261 // Export |
| 255 return { | 262 return { |
| 256 ManageProfileOverlay: ManageProfileOverlay | 263 ManageProfileOverlay: ManageProfileOverlay |
| 257 }; | 264 }; |
| 258 }); | 265 }); |
| OLD | NEW |