| 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 /** @const */ var OptionsPage = options.OptionsPage; | 6 /** @const */ var OptionsPage = options.OptionsPage; |
| 7 | 7 |
| 8 ////////////////////////////////////////////////////////////////////////////// | 8 ////////////////////////////////////////////////////////////////////////////// |
| 9 // ContentSettings class: | 9 // ContentSettings class: |
| 10 | 10 |
| 11 /** | 11 /** |
| 12 * Encapsulated handling of content settings page. | 12 * Encapsulated handling of content settings page. |
| 13 * @constructor | 13 * @constructor |
| 14 */ | 14 */ |
| 15 function ContentSettings() { | 15 function ContentSettings() { |
| 16 this.activeNavTab = null; | 16 this.activeNavTab = null; |
| 17 this.sessionRestoreEnabled = false; | 17 this.sessionRestoreEnabled = false; |
| 18 this.sessionRestoreSelected = false; | 18 this.sessionRestoreSelected = false; |
| 19 OptionsPage.call(this, 'content', templateData.contentSettingsPageTabTitle, | 19 OptionsPage.call(this, 'content', |
| 20 loadTimeData.getString('contentSettingsPageTabTitle'), |
| 20 'content-settings-page'); | 21 'content-settings-page'); |
| 21 | 22 |
| 22 // Keep track of the real value of the "clear on exit" preference. (The UI | 23 // Keep track of the real value of the "clear on exit" preference. (The UI |
| 23 // might override it if the "continue where I left off" setting is | 24 // might override it if the "continue where I left off" setting is |
| 24 // selected.) | 25 // selected.) |
| 25 var self = this; | 26 var self = this; |
| 26 Preferences.getInstance().addEventListener( | 27 Preferences.getInstance().addEventListener( |
| 27 'profile.clear_site_data_on_exit', | 28 'profile.clear_site_data_on_exit', |
| 28 function(event) { | 29 function(event) { |
| 29 if (event.value && typeof event.value['value'] != 'undefined') { | 30 if (event.value && typeof event.value['value'] != 'undefined') { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 55 OptionsPage.navigateToPage('contentExceptions'); | 56 OptionsPage.navigateToPage('contentExceptions'); |
| 56 // Add on the proper hash for the content type, and store that in the | 57 // Add on the proper hash for the content type, and store that in the |
| 57 // history so back/forward and tab restore works. | 58 // history so back/forward and tab restore works. |
| 58 var hash = event.target.getAttribute('contentType'); | 59 var hash = event.target.getAttribute('contentType'); |
| 59 var url = page.name + '#' + hash; | 60 var url = page.name + '#' + hash; |
| 60 window.history.replaceState({pageName: page.name}, | 61 window.history.replaceState({pageName: page.name}, |
| 61 page.title, | 62 page.title, |
| 62 '/' + url); | 63 '/' + url); |
| 63 uber.invokeMethodOnParent('setPath', {path: url}); | 64 uber.invokeMethodOnParent('setPath', {path: url}); |
| 64 uber.invokeMethodOnParent('setTitle', | 65 uber.invokeMethodOnParent('setTitle', |
| 65 {title: templateData[hash + 'TabTitle']}); | 66 {title: loadTimeData.getString(hash + 'TabTitle')}); |
| 66 }; | 67 }; |
| 67 } | 68 } |
| 68 | 69 |
| 69 var manageHandlersButton = $('manage-handlers-button'); | 70 var manageHandlersButton = $('manage-handlers-button'); |
| 70 if (manageHandlersButton) { | 71 if (manageHandlersButton) { |
| 71 manageHandlersButton.onclick = function(event) { | 72 manageHandlersButton.onclick = function(event) { |
| 72 OptionsPage.navigateToPage('handlers'); | 73 OptionsPage.navigateToPage('handlers'); |
| 73 }; | 74 }; |
| 74 } | 75 } |
| 75 | 76 |
| 76 if (cr.isChromeOS) | 77 if (cr.isChromeOS) |
| 77 UIAccountTweaks.applyGuestModeVisibility(document); | 78 UIAccountTweaks.applyGuestModeVisibility(document); |
| 78 | 79 |
| 79 // Cookies filter page --------------------------------------------------- | 80 // Cookies filter page --------------------------------------------------- |
| 80 $('show-cookies-button').onclick = function(event) { | 81 $('show-cookies-button').onclick = function(event) { |
| 81 chrome.send('coreOptionsUserMetricsAction', ['Options_ShowCookies']); | 82 chrome.send('coreOptionsUserMetricsAction', ['Options_ShowCookies']); |
| 82 OptionsPage.navigateToPage('cookies'); | 83 OptionsPage.navigateToPage('cookies'); |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 // Remove from DOM instead of hiding so :last-of-type applies the style | 86 // Remove from DOM instead of hiding so :last-of-type applies the style |
| 86 // correctly. | 87 // correctly. |
| 87 var intentsSection = $('intents-section'); | 88 var intentsSection = $('intents-section'); |
| 88 if (!templateData.enable_web_intents && intentsSection) | 89 if (!loadTimeData.getBoolean('enable_web_intents') && intentsSection) |
| 89 intentsSection.parentNode.removeChild(intentsSection); | 90 intentsSection.parentNode.removeChild(intentsSection); |
| 90 | 91 |
| 91 if (templateData.enable_restore_session_state) { | 92 if (loadTimeData.getBoolean('enable_restore_session_state')) { |
| 92 this.sessionRestoreEnabled = true; | 93 this.sessionRestoreEnabled = true; |
| 93 this.updateSessionRestoreContentSettings(); | 94 this.updateSessionRestoreContentSettings(); |
| 94 } | 95 } |
| 95 | 96 |
| 96 $('content-settings-overlay-confirm').onclick = | 97 $('content-settings-overlay-confirm').onclick = |
| 97 OptionsPage.closeOverlay.bind(OptionsPage); | 98 OptionsPage.closeOverlay.bind(OptionsPage); |
| 98 }, | 99 }, |
| 99 | 100 |
| 100 /** | 101 /** |
| 101 * Called when the value of the "On startup" setting changes. | 102 * Called when the value of the "On startup" setting changes. |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 'list[mode=' + mode + ']'); | 223 'list[mode=' + mode + ']'); |
| 223 exceptionsList.patternValidityCheckComplete(pattern, valid); | 224 exceptionsList.patternValidityCheckComplete(pattern, valid); |
| 224 }; | 225 }; |
| 225 | 226 |
| 226 // Export | 227 // Export |
| 227 return { | 228 return { |
| 228 ContentSettings: ContentSettings | 229 ContentSettings: ContentSettings |
| 229 }; | 230 }; |
| 230 | 231 |
| 231 }); | 232 }); |
| OLD | NEW |