| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 */ var localStrings = new LocalStrings(); | |
| 10 | |
| 11 /** | 9 /** |
| 12 * ManageProfileOverlay class | 10 * ManageProfileOverlay class |
| 13 * Encapsulated handling of the 'Manage profile...' overlay page. | 11 * Encapsulated handling of the 'Manage profile...' overlay page. |
| 14 * @constructor | 12 * @constructor |
| 15 * @class | 13 * @class |
| 16 */ | 14 */ |
| 17 function ManageProfileOverlay() { | 15 function ManageProfileOverlay() { |
| 18 OptionsPage.call(this, 'manageProfile', templateData.manageProfileTabTitle, | 16 OptionsPage.call(this, 'manageProfile', |
| 17 loadTimeData.getString('manageProfileTabTitle'), |
| 19 'manage-profile-overlay'); | 18 'manage-profile-overlay'); |
| 20 }; | 19 }; |
| 21 | 20 |
| 22 cr.addSingletonGetter(ManageProfileOverlay); | 21 cr.addSingletonGetter(ManageProfileOverlay); |
| 23 | 22 |
| 24 ManageProfileOverlay.prototype = { | 23 ManageProfileOverlay.prototype = { |
| 25 // Inherit from OptionsPage. | 24 // Inherit from OptionsPage. |
| 26 __proto__: OptionsPage.prototype, | 25 __proto__: OptionsPage.prototype, |
| 27 | 26 |
| 28 // Info about the currently managed/deleted profile. | 27 // Info about the currently managed/deleted profile. |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 }, | 139 }, |
| 141 | 140 |
| 142 /** | 141 /** |
| 143 * Display the error bubble, with |errorText| in the bubble. | 142 * Display the error bubble, with |errorText| in the bubble. |
| 144 * @param {string} errorText The localized string id to display as an error. | 143 * @param {string} errorText The localized string id to display as an error. |
| 145 * @private | 144 * @private |
| 146 */ | 145 */ |
| 147 showErrorBubble_: function(errorText) { | 146 showErrorBubble_: function(errorText) { |
| 148 var nameErrorEl = $('manage-profile-error-bubble'); | 147 var nameErrorEl = $('manage-profile-error-bubble'); |
| 149 nameErrorEl.hidden = false; | 148 nameErrorEl.hidden = false; |
| 150 nameErrorEl.textContent = localStrings.getString(errorText); | 149 nameErrorEl.textContent = loadTimeData.getString(errorText); |
| 151 | 150 |
| 152 $('manage-profile-ok').disabled = true; | 151 $('manage-profile-ok').disabled = true; |
| 153 }, | 152 }, |
| 154 | 153 |
| 155 /** | 154 /** |
| 156 * Hide the error bubble. | 155 * Hide the error bubble. |
| 157 * @private | 156 * @private |
| 158 */ | 157 */ |
| 159 hideErrorBubble_: function() { | 158 hideErrorBubble_: function() { |
| 160 $('manage-profile-error-bubble').hidden = true; | 159 $('manage-profile-error-bubble').hidden = true; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 /** | 222 /** |
| 224 * Display the "Delete Profile" dialog. | 223 * Display the "Delete Profile" dialog. |
| 225 * @param {Object} profileInfo The profile object of the profile to delete. | 224 * @param {Object} profileInfo The profile object of the profile to delete. |
| 226 * @private | 225 * @private |
| 227 */ | 226 */ |
| 228 showDeleteDialog_: function(profileInfo) { | 227 showDeleteDialog_: function(profileInfo) { |
| 229 ManageProfileOverlay.setProfileInfo(profileInfo); | 228 ManageProfileOverlay.setProfileInfo(profileInfo); |
| 230 $('manage-profile-overlay-manage').hidden = true; | 229 $('manage-profile-overlay-manage').hidden = true; |
| 231 $('manage-profile-overlay-delete').hidden = false; | 230 $('manage-profile-overlay-delete').hidden = false; |
| 232 $('delete-profile-message').textContent = | 231 $('delete-profile-message').textContent = |
| 233 localStrings.getStringF('deleteProfileMessage', profileInfo.name); | 232 loadTimeData.getStringF('deleteProfileMessage', profileInfo.name); |
| 234 $('delete-profile-message').style.backgroundImage = 'url("' + | 233 $('delete-profile-message').style.backgroundImage = 'url("' + |
| 235 profileInfo.iconURL + '")'; | 234 profileInfo.iconURL + '")'; |
| 236 | 235 |
| 237 // Because this dialog isn't useful when refreshing or as part of the | 236 // Because this dialog isn't useful when refreshing or as part of the |
| 238 // history, don't create a history entry for it when showing. | 237 // history, don't create a history entry for it when showing. |
| 239 OptionsPage.showPageByName('manageProfile', false); | 238 OptionsPage.showPageByName('manageProfile', false); |
| 240 }, | 239 }, |
| 241 }; | 240 }; |
| 242 | 241 |
| 243 // Forward public APIs to private implementations. | 242 // Forward public APIs to private implementations. |
| 244 [ | 243 [ |
| 245 'receiveDefaultProfileIcons', | 244 'receiveDefaultProfileIcons', |
| 246 'receiveProfileNames', | 245 'receiveProfileNames', |
| 247 'setProfileInfo', | 246 'setProfileInfo', |
| 248 'setProfileName', | 247 'setProfileName', |
| 249 'showManageDialog', | 248 'showManageDialog', |
| 250 'showDeleteDialog', | 249 'showDeleteDialog', |
| 251 ].forEach(function(name) { | 250 ].forEach(function(name) { |
| 252 ManageProfileOverlay[name] = function() { | 251 ManageProfileOverlay[name] = function() { |
| 253 var instance = ManageProfileOverlay.getInstance(); | 252 var instance = ManageProfileOverlay.getInstance(); |
| 254 return instance[name + '_'].apply(instance, arguments); | 253 return instance[name + '_'].apply(instance, arguments); |
| 255 }; | 254 }; |
| 256 }); | 255 }); |
| 257 | 256 |
| 258 // Export | 257 // Export |
| 259 return { | 258 return { |
| 260 ManageProfileOverlay: ManageProfileOverlay | 259 ManageProfileOverlay: ManageProfileOverlay |
| 261 }; | 260 }; |
| 262 }); | 261 }); |
| OLD | NEW |