| OLD | NEW |
| 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 | 6 |
| 7 var OptionsPage = options.OptionsPage; | 7 var OptionsPage = options.OptionsPage; |
| 8 | 8 |
| 9 /** | 9 /** |
| 10 * ClearBrowserData class | 10 * ClearBrowserData class |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 /** | 28 /** |
| 29 * Initialize the page. | 29 * Initialize the page. |
| 30 */ | 30 */ |
| 31 initializePage: function() { | 31 initializePage: function() { |
| 32 // Call base class implementation to starts preference initialization. | 32 // Call base class implementation to starts preference initialization. |
| 33 OptionsPage.prototype.initializePage.call(this); | 33 OptionsPage.prototype.initializePage.call(this); |
| 34 | 34 |
| 35 // The time period is stored as a number. | 35 // The time period is stored as a number. |
| 36 $('clearBrowsingDataTimePeriod').dataType = 'number'; | 36 $('clearBrowsingDataTimePeriod').dataType = 'number'; |
| 37 | 37 |
| 38 var f = this.updateCommitButtonState_.bind(this); | 38 var updateCommitButton = this.updateCommitButtonState_.bind(this); |
| 39 var types = ['browser.clear_data.browsing_history', | 39 var types = ['browser.clear_data.browsing_history', |
| 40 'browser.clear_data.download_history', | 40 'browser.clear_data.download_history', |
| 41 'browser.clear_data.cache', | 41 'browser.clear_data.cache', |
| 42 'browser.clear_data.cookies', | 42 'browser.clear_data.cookies', |
| 43 'browser.clear_data.passwords', | 43 'browser.clear_data.passwords', |
| 44 'browser.clear_data.form_data']; | 44 'browser.clear_data.form_data']; |
| 45 types.forEach(function(type) { | 45 types.forEach(function(type) { |
| 46 Preferences.getInstance().addEventListener(type, f); | 46 Preferences.getInstance().addEventListener(type, updateCommitButton); |
| 47 }); | 47 }); |
| 48 | 48 |
| 49 var checkboxes = document.querySelectorAll( | 49 var checkboxes = document.querySelectorAll( |
| 50 '#checkboxListData input[type=checkbox]'); | 50 '#checkboxListData input[type=checkbox]'); |
| 51 for (var i = 0; i < checkboxes.length; i++) { | 51 for (var i = 0; i < checkboxes.length; i++) { |
| 52 checkboxes[i].onclick = f; | 52 checkboxes[i].onclick = updateCommitButton; |
| 53 } | 53 } |
| 54 this.updateCommitButtonState_(); | 54 updateCommitButton(); |
| 55 | 55 |
| 56 // Setup click handler for the clear(Ok) button. | 56 // Setup click handler for the clear(Ok) button. |
| 57 $('clearBrowsingDataCommit').onclick = function(event) { | 57 $('clearBrowsingDataCommit').onclick = function(event) { |
| 58 chrome.send('performClearBrowserData'); | 58 chrome.send('performClearBrowserData'); |
| 59 }; | 59 }; |
| 60 }, | 60 }, |
| 61 | 61 |
| 62 // Set the enabled state of the commit button. | 62 // Set the enabled state of the commit button. |
| 63 updateCommitButtonState_: function() { | 63 updateCommitButtonState_: function() { |
| 64 var checkboxes = document.querySelectorAll( | 64 var checkboxes = document.querySelectorAll( |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 576) + 'px'; | 100 576) + 'px'; |
| 101 } | 101 } |
| 102 if (state) { | 102 if (state) { |
| 103 ClearBrowserDataPage.throbIntervalId = | 103 ClearBrowserDataPage.throbIntervalId = |
| 104 setInterval(advanceThrobber, 30); | 104 setInterval(advanceThrobber, 30); |
| 105 } else { | 105 } else { |
| 106 clearInterval(ClearBrowserDataPage.throbIntervalId); | 106 clearInterval(ClearBrowserDataPage.throbIntervalId); |
| 107 } | 107 } |
| 108 } | 108 } |
| 109 | 109 |
| 110 ClearBrowserDataPage.setClearLocalDataLabel = function(label) { |
| 111 $('deleteCookiesLabel').innerText = label; |
| 112 }; |
| 113 |
| 110 ClearBrowserDataPage.dismiss = function() { | 114 ClearBrowserDataPage.dismiss = function() { |
| 111 OptionsPage.clearOverlays(); | 115 OptionsPage.clearOverlays(); |
| 112 this.setClearingState(false); | 116 this.setClearingState(false); |
| 113 } | 117 } |
| 114 | 118 |
| 115 // Export | 119 // Export |
| 116 return { | 120 return { |
| 117 ClearBrowserDataPage: ClearBrowserDataPage | 121 ClearBrowserDataPage: ClearBrowserDataPage |
| 118 }; | 122 }; |
| 119 | 123 |
| 120 }); | 124 }); |
| 121 | 125 |
| OLD | NEW |