Chromium Code Reviews| 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 | 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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 50 String($('import-history').checked), | 50 String($('import-history').checked), |
| 51 String($('import-favorites').checked), | 51 String($('import-favorites').checked), |
| 52 String($('import-passwords').checked), | 52 String($('import-passwords').checked), |
| 53 String($('import-search').checked)]); | 53 String($('import-search').checked)]); |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 $('import-data-cancel').onclick = function() { | 56 $('import-data-cancel').onclick = function() { |
| 57 ImportDataOverlay.dismiss(); | 57 ImportDataOverlay.dismiss(); |
| 58 }; | 58 }; |
| 59 | 59 |
| 60 $('import-choose-file').onclick = function() { | |
| 61 chrome.send('chooseBookmarksFile'); | |
| 62 }; | |
| 63 | |
| 60 $('import-data-show-bookmarks-bar').onchange = function() { | 64 $('import-data-show-bookmarks-bar').onchange = function() { |
| 61 // Note: The callback 'toggleShowBookmarksBar' is handled within the | 65 // Note: The callback 'toggleShowBookmarksBar' is handled within the |
| 62 // browser options handler -- rather than the import data handler -- | 66 // browser options handler -- rather than the import data handler -- |
| 63 // as the implementation is shared by several clients. | 67 // as the implementation is shared by several clients. |
| 64 chrome.send('toggleShowBookmarksBar'); | 68 chrome.send('toggleShowBookmarksBar'); |
| 65 } | 69 } |
| 66 | 70 |
| 67 $('import-data-confirm').onclick = function() { | 71 $('import-data-confirm').onclick = function() { |
| 68 ImportDataOverlay.dismiss(); | 72 ImportDataOverlay.dismiss(); |
| 69 }; | 73 }; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 setUpCheckboxState_: function(checkbox, enabled) { | 108 setUpCheckboxState_: function(checkbox, enabled) { |
| 105 checkbox.setDisabled('noProfileData', !enabled); | 109 checkbox.setDisabled('noProfileData', !enabled); |
| 106 }, | 110 }, |
| 107 | 111 |
| 108 /** | 112 /** |
| 109 * Update the enabled and checked states of all checkboxes. | 113 * Update the enabled and checked states of all checkboxes. |
| 110 * @private | 114 * @private |
| 111 */ | 115 */ |
| 112 updateCheckboxes_: function() { | 116 updateCheckboxes_: function() { |
| 113 var index = $('import-browsers').selectedIndex; | 117 var index = $('import-browsers').selectedIndex; |
| 118 var bookmarksFileSelected = (index == this.browserProfiles.length - 1); | |
|
Dan Beam
2013/08/08 05:34:00
nit: remove extra ()
tfarina
2013/08/10 15:05:39
Done.
| |
| 119 $('import-choose-file').hidden = !bookmarksFileSelected; | |
| 120 $('import-data-commit').hidden = bookmarksFileSelected; | |
| 121 | |
| 114 var browserProfile; | 122 var browserProfile; |
| 115 if (this.browserProfiles.length > index) | 123 if (this.browserProfiles.length > index) |
| 116 browserProfile = this.browserProfiles[index]; | 124 browserProfile = this.browserProfiles[index]; |
| 117 var importOptions = ['history', 'favorites', 'passwords', 'search']; | 125 var importOptions = ['history', 'favorites', 'passwords', 'search']; |
| 118 for (var i = 0; i < importOptions.length; i++) { | 126 for (var i = 0; i < importOptions.length; i++) { |
| 119 var checkbox = $('import-' + importOptions[i]); | 127 var checkbox = $('import-' + importOptions[i]); |
| 120 var enable = browserProfile && browserProfile[importOptions[i]]; | 128 var enable = browserProfile && browserProfile[importOptions[i]]; |
| 129 checkbox.checked = enable; | |
| 121 this.setUpCheckboxState_(checkbox, enable); | 130 this.setUpCheckboxState_(checkbox, enable); |
| 122 } | 131 } |
| 123 }, | 132 }, |
| 124 | 133 |
| 125 /** | 134 /** |
| 126 * Update the supported browsers popup with given entries. | 135 * Update the supported browsers popup with given entries. |
| 127 * @param {array} browsers List of supported browsers name. | 136 * @param {array} browsers List of supported browsers name. |
| 128 * @private | 137 * @private |
| 129 */ | 138 */ |
| 130 updateSupportedBrowsers_: function(browsers) { | 139 updateSupportedBrowsers_: function(browsers) { |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 ImportDataOverlay.getInstance().validateCommitButton_(); | 248 ImportDataOverlay.getInstance().validateCommitButton_(); |
| 240 | 249 |
| 241 OptionsPage.navigateToPage('importData'); | 250 OptionsPage.navigateToPage('importData'); |
| 242 }; | 251 }; |
| 243 | 252 |
| 244 // Export | 253 // Export |
| 245 return { | 254 return { |
| 246 ImportDataOverlay: ImportDataOverlay | 255 ImportDataOverlay: ImportDataOverlay |
| 247 }; | 256 }; |
| 248 }); | 257 }); |
| OLD | NEW |