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

Side by Side Diff: chrome/browser/resources/options2/browser_options.js

Issue 10579026: Fix edit profile link in NTP (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more nits Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/resources/options2/manage_profile_overlay.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 var RepeatingButton = cr.ui.RepeatingButton; 8 var RepeatingButton = cr.ui.RepeatingButton;
9 9
10 // 10 //
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 profilesList.autoExpands = true; 241 profilesList.autoExpands = true;
242 242
243 this.setProfilesInfo_(loadTimeData.getValue('profilesInfo')); 243 this.setProfilesInfo_(loadTimeData.getValue('profilesInfo'));
244 244
245 profilesList.addEventListener('change', 245 profilesList.addEventListener('change',
246 this.setProfileViewButtonsStatus_); 246 this.setProfileViewButtonsStatus_);
247 $('profiles-create').onclick = function(event) { 247 $('profiles-create').onclick = function(event) {
248 chrome.send('createProfile'); 248 chrome.send('createProfile');
249 }; 249 };
250 $('profiles-manage').onclick = function(event) { 250 $('profiles-manage').onclick = function(event) {
251 var selectedProfile = self.getSelectedProfileItem_(); 251 ManageProfileOverlay.showManageDialog();
252 if (selectedProfile)
253 ManageProfileOverlay.showManageDialog(selectedProfile);
254 }; 252 };
255 $('profiles-delete').onclick = function(event) { 253 $('profiles-delete').onclick = function(event) {
256 var selectedProfile = self.getSelectedProfileItem_(); 254 var selectedProfile = self.getSelectedProfileItem_();
257 if (selectedProfile) 255 if (selectedProfile)
258 ManageProfileOverlay.showDeleteDialog(selectedProfile); 256 ManageProfileOverlay.showDeleteDialog(selectedProfile);
259 }; 257 };
260 } 258 }
261 259
262 if (cr.isChromeOS) { 260 if (cr.isChromeOS) {
263 if (!UIAccountTweaks.loggedInAsGuest()) { 261 if (!UIAccountTweaks.loggedInAsGuest()) {
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1012 * filePath: "/path/to/profile/data/on/disk", 1010 * filePath: "/path/to/profile/data/on/disk",
1013 * isCurrentProfile: false 1011 * isCurrentProfile: false
1014 * }; 1012 * };
1015 * @private 1013 * @private
1016 */ 1014 */
1017 setProfilesInfo_: function(profiles) { 1015 setProfilesInfo_: function(profiles) {
1018 this.setProfileViewSingle_(profiles.length); 1016 this.setProfileViewSingle_(profiles.length);
1019 // add it to the list, even if the list is hidden so we can access it 1017 // add it to the list, even if the list is hidden so we can access it
1020 // later. 1018 // later.
1021 $('profiles-list').dataModel = new ArrayDataModel(profiles); 1019 $('profiles-list').dataModel = new ArrayDataModel(profiles);
1022 // We got new data, close the open overlay if it's open. 1020
1023 ManageProfileOverlay.getInstance().visible = false; 1021 // Received new data. If showing the "manage" overlay, keep it up to
1022 // date. If showing the "delete" overlay, close it.
1023 if (ManageProfileOverlay.getInstance().visible &&
1024 !$('manage-profile-overlay-manage').hidden) {
1025 ManageProfileOverlay.showManageDialog();
1026 } else {
1027 ManageProfileOverlay.getInstance().visible = false;
1028 }
1029
1024 this.setProfileViewButtonsStatus_(); 1030 this.setProfileViewButtonsStatus_();
1025 }, 1031 },
1026 1032
1033 /**
1034 * Returns the currently active profile for this browser window.
1035 * @return {Object} A profile info object.
1036 * @private
1037 */
1038 getCurrentProfile_: function() {
1039 for (var i = 0; i < $('profiles-list').dataModel.length; i++) {
Dan Beam 2012/06/20 22:13:51 var model = $('profiles-list').dataModel; // re-us
Evan Stade 2012/06/20 22:16:16 only twice, don't think it's worth it.
1040 var profile = $('profiles-list').dataModel.item(i);
1041 if (profile.isCurrentProfile)
1042 return profile;
1043 }
1044
1045 assert(false,
1046 'There should always be a current profile, but none found.');
1047 },
1048
1027 setGtkThemeButtonEnabled_: function(enabled) { 1049 setGtkThemeButtonEnabled_: function(enabled) {
1028 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i)) 1050 if (!cr.isChromeOS && navigator.platform.match(/linux|BSD/i))
1029 $('themes-GTK-button').disabled = !enabled; 1051 $('themes-GTK-button').disabled = !enabled;
1030 }, 1052 },
1031 1053
1032 setThemesResetButtonEnabled_: function(enabled) { 1054 setThemesResetButtonEnabled_: function(enabled) {
1033 $('themes-reset').disabled = !enabled; 1055 $('themes-reset').disabled = !enabled;
1034 }, 1056 },
1035 1057
1036 /** 1058 /**
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
1363 setContentFilterSettingsValue_: function(dict) { 1385 setContentFilterSettingsValue_: function(dict) {
1364 if ('cookies' in dict && 'value' in dict['cookies']) 1386 if ('cookies' in dict && 'value' in dict['cookies'])
1365 this.sessionOnlyCookies_ = dict['cookies']['value'] == 'session'; 1387 this.sessionOnlyCookies_ = dict['cookies']['value'] == 'session';
1366 } 1388 }
1367 1389
1368 }; 1390 };
1369 1391
1370 //Forward public APIs to private implementations. 1392 //Forward public APIs to private implementations.
1371 [ 1393 [
1372 'addBluetoothDevice', 1394 'addBluetoothDevice',
1395 'getCurrentProfile',
1373 'getStartStopSyncButton', 1396 'getStartStopSyncButton',
1374 'hideBluetoothSettings', 1397 'hideBluetoothSettings',
1375 'removeCloudPrintConnectorSection', 1398 'removeCloudPrintConnectorSection',
1376 'removeBluetoothDevice', 1399 'removeBluetoothDevice',
1377 'setAutoOpenFileTypesDisplayed', 1400 'setAutoOpenFileTypesDisplayed',
1378 'setBackgroundModeCheckboxState', 1401 'setBackgroundModeCheckboxState',
1379 'setBluetoothState', 1402 'setBluetoothState',
1380 'setCheckRevocationCheckboxState', 1403 'setCheckRevocationCheckboxState',
1381 'setContentFilterSettingsValue', 1404 'setContentFilterSettingsValue',
1382 'setFontSize', 1405 'setFontSize',
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1419 BrowserOptions.getLoggedInUsername = function() { 1442 BrowserOptions.getLoggedInUsername = function() {
1420 return BrowserOptions.getInstance().username_; 1443 return BrowserOptions.getInstance().username_;
1421 }; 1444 };
1422 } 1445 }
1423 1446
1424 // Export 1447 // Export
1425 return { 1448 return {
1426 BrowserOptions: BrowserOptions 1449 BrowserOptions: BrowserOptions
1427 }; 1450 };
1428 }); 1451 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/options2/manage_profile_overlay.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698