Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(468)

Side by Side Diff: chrome/browser/resources/options2/content_settings.js

Issue 9316086: Fix JavaScript errors in options2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: new violations found after rebase Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 OptionsPage = options.OptionsPage; 6 const 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', templateData.contentSettingsPageTabTitle,
20 'content-settings-page'); 20 'content-settings-page');
21 21
22 // Keep track of the real value of the "clear on exit" preference. (The UI 22 // Keep track of the real value of the "clear on exit" preference. (The UI
23 // might override it if the reopen last pages setting is selected.) 23 // might override it if the reopen last pages setting is selected.)
24 var self = this; 24 var self = this;
25 Preferences.getInstance().addEventListener( 25 Preferences.getInstance().addEventListener(
26 "profile.clear_site_data_on_exit", 26 'profile.clear_site_data_on_exit',
27 function(event) { 27 function(event) {
28 if (event.value && event.value['value'] != undefined) { 28 if (event.value && event.value['value'] != undefined) {
29 self.clearCookiesOnExit = (event.value['value'] == true); 29 self.clearCookiesOnExit = (event.value['value'] == true);
30 } 30 }
31 }); 31 });
32 Preferences.getInstance().addEventListener( 32 Preferences.getInstance().addEventListener(
33 "session.restore_on_startup", 33 'session.restore_on_startup',
34 this.onSessionRestoreSelectedChanged.bind(this)); 34 this.onSessionRestoreSelectedChanged.bind(this));
35 } 35 }
36 36
37 cr.addSingletonGetter(ContentSettings); 37 cr.addSingletonGetter(ContentSettings);
38 38
39 ContentSettings.prototype = { 39 ContentSettings.prototype = {
40 __proto__: OptionsPage.prototype, 40 __proto__: OptionsPage.prototype,
41 41
42 initializePage: function() { 42 initializePage: function() {
43 OptionsPage.prototype.initializePage.call(this); 43 OptionsPage.prototype.initializePage.call(this);
44 44
45 chrome.send('getContentFilterSettings'); 45 chrome.send('getContentFilterSettings');
46 46
47 var exceptionsButtons = 47 var exceptionsButtons =
48 this.pageDiv.querySelectorAll('.exceptions-list-button'); 48 this.pageDiv.querySelectorAll('.exceptions-list-button');
49 for (var i = 0; i < exceptionsButtons.length; i++) { 49 for (var i = 0; i < exceptionsButtons.length; i++) {
50 exceptionsButtons[i].onclick = function(event) { 50 exceptionsButtons[i].onclick = function(event) {
51 var page = ContentSettingsExceptionsArea.getInstance(); 51 var page = ContentSettingsExceptionsArea.getInstance();
52 page.showList( 52 page.showList(
53 event.target.getAttribute('contentType')); 53 event.target.getAttribute('contentType'));
54 OptionsPage.navigateToPage('contentExceptions'); 54 OptionsPage.navigateToPage('contentExceptions');
55 // Add on the proper hash for the content type, and store that in the 55 // Add on the proper hash for the content type, and store that in the
56 // history so back/forward and tab restore works. 56 // history so back/forward and tab restore works.
57 var hash = event.target.getAttribute('contentType'); 57 var hash = event.target.getAttribute('contentType');
58 window.history.replaceState({pageName: page.name}, page.title, 58 window.history.replaceState({pageName: page.name}, page.title,
59 '/' + page.name + "#" + hash); 59 '/' + page.name + '#' + hash);
60 }; 60 };
61 } 61 }
62 62
63 var manageHandlersButton = $('manage-handlers-button'); 63 var manageHandlersButton = $('manage-handlers-button');
64 if (manageHandlersButton) { 64 if (manageHandlersButton) {
65 manageHandlersButton.onclick = function(event) { 65 manageHandlersButton.onclick = function(event) {
66 OptionsPage.navigateToPage('handlers'); 66 OptionsPage.navigateToPage('handlers');
67 }; 67 };
68 } 68 }
69 69
(...skipping 12 matching lines...) Expand all
82 82
83 if (!templateData.enable_web_intents && $('intent-section')) 83 if (!templateData.enable_web_intents && $('intent-section'))
84 $('intent-section').hidden = true; 84 $('intent-section').hidden = true;
85 85
86 if (templateData.enable_restore_session_state) { 86 if (templateData.enable_restore_session_state) {
87 this.sessionRestoreEnabled = true; 87 this.sessionRestoreEnabled = true;
88 this.updateSessionRestoreContentSettings(); 88 this.updateSessionRestoreContentSettings();
89 } 89 }
90 }, 90 },
91 91
92 onSessionRestoreSelectedChanged : function(event) { 92 onSessionRestoreSelectedChanged: function(event) {
93 if (!event.value || event.value['value'] == undefined) 93 if (!event.value || event.value['value'] == undefined)
94 return; 94 return;
95 95
96 this.sessionRestoreSelected = (event.value['value'] == 1); 96 this.sessionRestoreSelected = (event.value['value'] == 1);
97 97
98 if (this.sessionRestoreSelected) 98 if (this.sessionRestoreSelected)
99 this.updateSessionRestoreContentSettings(); 99 this.updateSessionRestoreContentSettings();
100 else 100 else
101 this.restoreContentSettings(); 101 this.restoreContentSettings();
102 }, 102 },
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 'list[mode=' + mode + ']'); 209 'list[mode=' + mode + ']');
210 exceptionsList.patternValidityCheckComplete(pattern, valid); 210 exceptionsList.patternValidityCheckComplete(pattern, valid);
211 }; 211 };
212 212
213 // Export 213 // Export
214 return { 214 return {
215 ContentSettings: ContentSettings 215 ContentSettings: ContentSettings
216 }; 216 };
217 217
218 }); 218 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698