| 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 * ClearBrowserDataOverlay class | 9 * ClearBrowserDataOverlay class |
| 10 * Encapsulated handling of the 'Clear Browser Data' overlay page. | 10 * Encapsulated handling of the 'Clear Browser Data' overlay page. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 initializePage: function() { | 28 initializePage: function() { |
| 29 // Call base class implementation to starts preference initialization. | 29 // Call base class implementation to starts preference initialization. |
| 30 OptionsPage.prototype.initializePage.call(this); | 30 OptionsPage.prototype.initializePage.call(this); |
| 31 | 31 |
| 32 var f = this.updateCommitButtonState_.bind(this); | 32 var f = this.updateCommitButtonState_.bind(this); |
| 33 var types = ['browser.clear_data.browsing_history', | 33 var types = ['browser.clear_data.browsing_history', |
| 34 'browser.clear_data.download_history', | 34 'browser.clear_data.download_history', |
| 35 'browser.clear_data.cache', | 35 'browser.clear_data.cache', |
| 36 'browser.clear_data.cookies', | 36 'browser.clear_data.cookies', |
| 37 'browser.clear_data.passwords', | 37 'browser.clear_data.passwords', |
| 38 'browser.clear_data.form_data']; | 38 'browser.clear_data.form_data', |
| 39 'browser.clear_data.content_licenses']; |
| 39 types.forEach(function(type) { | 40 types.forEach(function(type) { |
| 40 Preferences.getInstance().addEventListener(type, f); | 41 Preferences.getInstance().addEventListener(type, f); |
| 41 }); | 42 }); |
| 42 | 43 |
| 43 var checkboxes = document.querySelectorAll( | 44 var checkboxes = document.querySelectorAll( |
| 44 '#cbdContentArea input[type=checkbox]'); | 45 '#cbdContentArea input[type=checkbox]'); |
| 45 for (var i = 0; i < checkboxes.length; i++) { | 46 for (var i = 0; i < checkboxes.length; i++) { |
| 46 checkboxes[i].onclick = f; | 47 checkboxes[i].onclick = f; |
| 47 } | 48 } |
| 48 this.updateCommitButtonState_(); | 49 this.updateCommitButtonState_(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 73 // | 74 // |
| 74 // Chrome callbacks | 75 // Chrome callbacks |
| 75 // | 76 // |
| 76 ClearBrowserDataOverlay.setClearingState = function(state) { | 77 ClearBrowserDataOverlay.setClearingState = function(state) { |
| 77 $('deleteBrowsingHistoryCheckbox').disabled = state; | 78 $('deleteBrowsingHistoryCheckbox').disabled = state; |
| 78 $('deleteDownloadHistoryCheckbox').disabled = state; | 79 $('deleteDownloadHistoryCheckbox').disabled = state; |
| 79 $('deleteCacheCheckbox').disabled = state; | 80 $('deleteCacheCheckbox').disabled = state; |
| 80 $('deleteCookiesCheckbox').disabled = state; | 81 $('deleteCookiesCheckbox').disabled = state; |
| 81 $('deletePasswordsCheckbox').disabled = state; | 82 $('deletePasswordsCheckbox').disabled = state; |
| 82 $('deleteFormDataCheckbox').disabled = state; | 83 $('deleteFormDataCheckbox').disabled = state; |
| 84 $('deauthorizeContentLicensesCheckbox').disabled = state; |
| 83 $('clearBrowserDataTimePeriod').disabled = state; | 85 $('clearBrowserDataTimePeriod').disabled = state; |
| 84 $('cbdThrobber').style.visibility = state ? 'visible' : 'hidden'; | 86 $('cbdThrobber').style.visibility = state ? 'visible' : 'hidden'; |
| 85 | 87 |
| 86 if (state) | 88 if (state) |
| 87 $('clearBrowserDataCommit').disabled = true; | 89 $('clearBrowserDataCommit').disabled = true; |
| 88 else | 90 else |
| 89 ClearBrowserDataOverlay.getInstance().updateCommitButtonState_(); | 91 ClearBrowserDataOverlay.getInstance().updateCommitButtonState_(); |
| 90 }; | 92 }; |
| 91 | 93 |
| 92 ClearBrowserDataOverlay.doneClearing = function() { | 94 ClearBrowserDataOverlay.doneClearing = function() { |
| 93 // The delay gives the user some feedback that the clearing | 95 // The delay gives the user some feedback that the clearing |
| 94 // actually worked. Otherwise the dialog just vanishes instantly in most | 96 // actually worked. Otherwise the dialog just vanishes instantly in most |
| 95 // cases. | 97 // cases. |
| 96 window.setTimeout(function() { | 98 window.setTimeout(function() { |
| 97 ClearBrowserDataOverlay.dismiss(); | 99 ClearBrowserDataOverlay.dismiss(); |
| 98 }, 200); | 100 }, 200); |
| 99 }; | 101 }; |
| 100 | 102 |
| 101 ClearBrowserDataOverlay.dismiss = function() { | 103 ClearBrowserDataOverlay.dismiss = function() { |
| 102 OptionsPage.closeOverlay(); | 104 OptionsPage.closeOverlay(); |
| 103 this.setClearingState(false); | 105 this.setClearingState(false); |
| 104 }; | 106 }; |
| 105 | 107 |
| 106 // Export | 108 // Export |
| 107 return { | 109 return { |
| 108 ClearBrowserDataOverlay: ClearBrowserDataOverlay | 110 ClearBrowserDataOverlay: ClearBrowserDataOverlay |
| 109 }; | 111 }; |
| 110 }); | 112 }); |
| OLD | NEW |