| 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 Page = cr.ui.pageManager.Page; |
| 7 var PageManager = cr.ui.pageManager.PageManager; |
| 7 | 8 |
| 8 /** | 9 /** |
| 9 * ImportDataOverlay class | 10 * ImportDataOverlay class |
| 10 * Encapsulated handling of the 'Import Data' overlay page. | 11 * Encapsulated handling of the 'Import Data' overlay page. |
| 11 * @class | 12 * @class |
| 12 */ | 13 */ |
| 13 function ImportDataOverlay() { | 14 function ImportDataOverlay() { |
| 14 OptionsPage.call(this, | 15 Page.call(this, |
| 15 'importData', | 16 'importData', |
| 16 loadTimeData.getString('importDataOverlayTabTitle'), | 17 loadTimeData.getString('importDataOverlayTabTitle'), |
| 17 'import-data-overlay'); | 18 'import-data-overlay'); |
| 18 } | 19 } |
| 19 | 20 |
| 20 cr.addSingletonGetter(ImportDataOverlay); | 21 cr.addSingletonGetter(ImportDataOverlay); |
| 21 | 22 |
| 22 ImportDataOverlay.prototype = { | 23 ImportDataOverlay.prototype = { |
| 23 // Inherit from OptionsPage. | 24 // Inherit from Page. |
| 24 __proto__: OptionsPage.prototype, | 25 __proto__: Page.prototype, |
| 25 | 26 |
| 26 /** @override */ | 27 /** @override */ |
| 27 initializePage: function() { | 28 initializePage: function() { |
| 28 // Call base class implementation to start preference initialization. | 29 Page.prototype.initializePage.call(this); |
| 29 OptionsPage.prototype.initializePage.call(this); | |
| 30 | 30 |
| 31 var self = this; | 31 var self = this; |
| 32 var checkboxes = | 32 var checkboxes = |
| 33 document.querySelectorAll('#import-checkboxes input[type=checkbox]'); | 33 document.querySelectorAll('#import-checkboxes input[type=checkbox]'); |
| 34 for (var i = 0; i < checkboxes.length; i++) { | 34 for (var i = 0; i < checkboxes.length; i++) { |
| 35 checkboxes[i].onchange = function() { | 35 checkboxes[i].onchange = function() { |
| 36 self.validateCommitButton_(); | 36 self.validateCommitButton_(); |
| 37 }; | 37 }; |
| 38 } | 38 } |
| 39 | 39 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 $('import-browsers').disabled = importing; | 233 $('import-browsers').disabled = importing; |
| 234 $('import-throbber').style.visibility = importing ? 'visible' : 'hidden'; | 234 $('import-throbber').style.visibility = importing ? 'visible' : 'hidden'; |
| 235 ImportDataOverlay.getInstance().validateCommitButton_(); | 235 ImportDataOverlay.getInstance().validateCommitButton_(); |
| 236 }; | 236 }; |
| 237 | 237 |
| 238 /** | 238 /** |
| 239 * Remove the import overlay from display. | 239 * Remove the import overlay from display. |
| 240 */ | 240 */ |
| 241 ImportDataOverlay.dismiss = function() { | 241 ImportDataOverlay.dismiss = function() { |
| 242 ImportDataOverlay.clearUserPrefs(); | 242 ImportDataOverlay.clearUserPrefs(); |
| 243 OptionsPage.closeOverlay(); | 243 PageManager.closeOverlay(); |
| 244 }; | 244 }; |
| 245 | 245 |
| 246 /** | 246 /** |
| 247 * Show a message confirming the success of the import operation. | 247 * Show a message confirming the success of the import operation. |
| 248 */ | 248 */ |
| 249 ImportDataOverlay.confirmSuccess = function() { | 249 ImportDataOverlay.confirmSuccess = function() { |
| 250 var showBookmarksMessage = $('import-favorites').checked; | 250 var showBookmarksMessage = $('import-favorites').checked; |
| 251 ImportDataOverlay.setImportingState(false); | 251 ImportDataOverlay.setImportingState(false); |
| 252 $('import-find-your-bookmarks').hidden = !showBookmarksMessage; | 252 $('import-find-your-bookmarks').hidden = !showBookmarksMessage; |
| 253 ImportDataOverlay.getInstance().updateSuccessState_(true); | 253 ImportDataOverlay.getInstance().updateSuccessState_(true); |
| 254 }; | 254 }; |
| 255 | 255 |
| 256 /** | 256 /** |
| 257 * Show the import data overlay. | 257 * Show the import data overlay. |
| 258 */ | 258 */ |
| 259 ImportDataOverlay.show = function() { | 259 ImportDataOverlay.show = function() { |
| 260 // Make sure that any previous import success message is hidden, and | 260 // Make sure that any previous import success message is hidden, and |
| 261 // we're showing the UI to import further data. | 261 // we're showing the UI to import further data. |
| 262 ImportDataOverlay.getInstance().updateSuccessState_(false); | 262 ImportDataOverlay.getInstance().updateSuccessState_(false); |
| 263 ImportDataOverlay.getInstance().validateCommitButton_(); | 263 ImportDataOverlay.getInstance().validateCommitButton_(); |
| 264 | 264 |
| 265 OptionsPage.navigateToPage('importData'); | 265 PageManager.showPageByName('importData'); |
| 266 }; | 266 }; |
| 267 | 267 |
| 268 // Export | 268 // Export |
| 269 return { | 269 return { |
| 270 ImportDataOverlay: ImportDataOverlay | 270 ImportDataOverlay: ImportDataOverlay |
| 271 }; | 271 }; |
| 272 }); | 272 }); |
| OLD | NEW |