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

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

Issue 2804039: First cut at the tabbed content settings page. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: no change Created 10 years, 5 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
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 ///////////////////////////////////////////////////////////////////////////////
6 // ContentSettings class:
7
8 /**
9 * Encapsulated handling of content settings page.
10 * @constructor
11 */
12 function ContentSettings(model) {
13 this.activeNavTab = null;
14 OptionsPage.call(this, 'content', templateData.contentSettingsPage,
15 'contentSettingsPage');
16 }
17
18 ContentSettings.getInstance = function() {
19 if (!ContentSettings.instance_)
20 ContentSettings.instance_ = new ContentSettings(null);
21 return ContentSettings.instance_;
22 }
23
24 ContentSettings.prototype = {
25 __proto__: OptionsPage.prototype,
26
27 initializePage: function() {
28 OptionsPage.prototype.initializePage.call(this);
29
30 chrome.send('getContentFilterSettings');
31 this.showTab($('cookies-nav-tab'));
32
33 var self = this;
34 $('content-settings-nav-tabs').onclick = function(event) {
35 self.showTab(event.srcElement);
36 };
37
38 // Cookies filter page -----------------------------------------------------
39 $('cookies-exceptions-button').onclick = function(event) {
40 // TODO(estade): show exceptions page.
41 };
42
43 $('block-third-party-cookies').onclick = function(event) {
44 chrome.send('setAllowThirdPartyCookies',
45 [String($('block-third-party-cookies').checked)]);
46 };
47
48 $('show-cookies-button').onclick = function(event) {
49 // TODO(estade): show cookies and other site data page.
50 };
51
52 // Images filter page ------------------------------------------------------
53 $('images-exceptions-button').onclick = function(event) {
54 // TODO(estade): show a dialog.
55 };
56 },
57
58 /**
59 * Shows the tab contents for the given navigation tab.
60 * @param {!Element} tab The tab that the user clicked.
61 */
62 showTab: function(tab) {
63 if (!tab.classList.contains('inactive-tab'))
64 return;
65
66 if (this.activeNavTab != null) {
67 this.activeNavTab.classList.remove('active-tab');
68 $(this.activeNavTab.getAttribute('tab-contents')).classList.
69 remove('active-tab-contents');
70 }
71
72 tab.classList.add('active-tab');
73 $(tab.getAttribute('tab-contents')).classList.add('active-tab-contents');
74 this.activeNavTab = tab;
75 },
76 };
77
78 /**
79 * Sets the initial values for all the content settings radios.
80 * @param {Object} dict A mapping from radio groups to the checked value for
81 * that group.
82 */
83 ContentSettings.setInitialContentFilterSettingsValue = function(dict) {
84 for (var group in dict) {
85 document.querySelector('input[type=radio][name=' + group +
86 '][value=' + dict[group] + ']').checked = true;
87 }
88 };
89
90 /**
91 * Sets the initial value for the Third Party Cookies checkbox.
92 * @param {boolean=} block True if we are blocking third party cookies.
93 */
94 ContentSettings.setBlockThirdPartyCookies = function(block) {
95 $('block-third-party-cookies').checked = block;
96 }
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/content_settings.html ('k') | chrome/browser/resources/options/content_settings_page.css » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698