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