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

Side by Side Diff: chrome/browser/resources/options/import_data_overlay.js

Issue 6688016: web-ui settings: Fix incorrect handling for the Import dialog when no browser... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: code review tweaks Created 9 years, 9 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 | 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 (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 7
8 /** 8 /**
9 * ImportDataOverlay class 9 * ImportDataOverlay class
10 * Encapsulated handling of the 'Import Data' overlay page. 10 * Encapsulated handling of the 'Import Data' overlay page.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 checkbox.disabled = !enabled; 94 checkbox.disabled = !enabled;
95 checkbox.checked = enabled; 95 checkbox.checked = enabled;
96 }, 96 },
97 97
98 /** 98 /**
99 * Update the enabled and checked states of all checkboxes. 99 * Update the enabled and checked states of all checkboxes.
100 * @private 100 * @private
101 */ 101 */
102 updateCheckboxes_: function() { 102 updateCheckboxes_: function() {
103 var index = $('import-browsers').selectedIndex; 103 var index = $('import-browsers').selectedIndex;
104 var browserProfile = ImportDataOverlay.browserProfiles[index]; 104 var browserProfile;
105 if (this.browserProfiles.length > index)
106 browserProfile = this.browserProfiles[index];
105 var importOptions = ['history', 'favorites', 'passwords', 'search']; 107 var importOptions = ['history', 'favorites', 'passwords', 'search'];
106 for (var i = 0; i < importOptions.length; i++) { 108 for (var i = 0; i < importOptions.length; i++) {
107 var checkbox = $('import-' + importOptions[i]); 109 var checkbox = $('import-' + importOptions[i]);
108 this.setUpCheckboxState_(checkbox, browserProfile[importOptions[i]]); 110 this.setUpCheckboxState_(checkbox,
111 browserProfile ? browserProfile[importOptions[i]] : false);
109 } 112 }
110 }, 113 },
111 114
112 /** 115 /**
113 * Update the supported browsers popup with given entries. 116 * Update the supported browsers popup with given entries.
114 * @param {array} browsers List of supported browsers name. 117 * @param {array} browsers List of supported browsers name.
115 * @private 118 * @private
116 */ 119 */
117 updateSupportedBrowsers_: function(browsers) { 120 updateSupportedBrowsers_: function(browsers) {
118 ImportDataOverlay.browserProfiles = browsers; 121 this.browserProfiles = browsers;
119 var browserSelect = $('import-browsers'); 122 var browserSelect = $('import-browsers');
120 browserSelect.remove(0); // Remove the 'Loading...' option. 123 browserSelect.remove(0); // Remove the 'Loading...' option.
121 browserSelect.textContent = ''; 124 browserSelect.textContent = '';
122 var browserCount = browsers.length; 125 var browserCount = browsers.length;
123 126
124 if (browserCount == 0) { 127 if (browserCount == 0) {
125 var option = new Option(templateData.noProfileFound, 0); 128 var option = new Option(templateData.noProfileFound, 0);
126 browserSelect.appendChild(option); 129 browserSelect.appendChild(option);
127 130
128 this.setControlsSensitive_(false); 131 this.setControlsSensitive_(false);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 ImportDataOverlay.dismiss = function() { 176 ImportDataOverlay.dismiss = function() {
174 ImportDataOverlay.setImportingState(false); 177 ImportDataOverlay.setImportingState(false);
175 OptionsPage.closeOverlay(); 178 OptionsPage.closeOverlay();
176 }; 179 };
177 180
178 // Export 181 // Export
179 return { 182 return {
180 ImportDataOverlay: ImportDataOverlay 183 ImportDataOverlay: ImportDataOverlay
181 }; 184 };
182 }); 185 });
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698