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

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

Issue 475193002: Add a single site view page to view and modify content settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 6 years, 4 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 2014 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 cr.define('options.WebsiteSettings', function() {
6 /** @const */ var Page = cr.ui.pageManager.Page;
7
8 /////////////////////////////////////////////////////////////////////////////
9 // WebsiteSettingsEditor class:
10
11 /**
12 * Encapsulated handling of the website settings editor page.
13 * @constructor
14 */
15 function WebsiteSettingsEditor() {
16 Page.call(this, 'websiteEdit',
17 loadTimeData.getString('websitesOptionsPageTabTitle'),
18 'website-settings-edit-page');
19 this.permissions = ['geolocation', 'notifications', 'media-stream'];
20 }
21
22 cr.addSingletonGetter(WebsiteSettingsEditor);
23
24 WebsiteSettingsEditor.prototype = {
25 __proto__: Page.prototype,
26
27
28 /** @override */
29 initializePage: function() {
30 Page.prototype.initializePage.call(this);
31
32 $('websiteSettingsEditorCancelButton').onclick =
33 PageManager.closeOverlay.bind(PageManager);
34
35 $('websiteSettingsEditorDoneButton').onclick = function(event) {
36 WebsiteSettingsEditor.getInstance().updatePermissions();
37 PageManager.closeOverlay.bind(PageManager)();
38 };
39 },
40
41 /**
42 * Populates the page with the proper information for a given URL.
43 * @param {string} url The URL of the page.
44 * @private
45 */
46 populatePage: function(url) {
47 this.url = url;
48
49 var titleEl = $('website-title');
50 titleEl.textContent = url;
51 titleEl.style.backgroundImage = getFaviconImageSet(url);
52
53 chrome.send('getOriginInfo', [url]);
54 },
55
56 /**
57 * Populates and displays the page with given origin information.
58 * @param {string} local_storage A string describing the local storage use.
59 * @param {Object} permissions A dictionary of permissions to their
60 * available and current settings, and if it is editable.
61 * @private
62 */
63 populateOrigin_: function(local_storage, permissions) {
64 $('local-storage-title').textContent = local_storage;
65 for (var key in permissions) {
66 var selector = $(key + '-select-option');
67
68 var options = permissions[key].options;
69 selector.options.length = 0;
70 for (var option in options) {
71 selector.options[selector.options.length] =
72 new Option(loadTimeData.getString(options[option] + 'Exception'),
73 options[option]);
74 }
75
76 selector.value = permissions[key].setting;
77 selector.originalValue = permissions[key].setting;
78 selector.disabled = !permissions[key].editable;
79 }
80 PageManager.showPageByName('websiteEdit', false);
81 },
82
83 updatePermissions: function() {
84 for (var key in this.permissions) {
85 var selection = $(this.permissions[key] + '-select-option');
86 if (selection.value != selection.originalValue) {
87 chrome.send('setOriginPermission',
88 [this.permissions[key], selection.value]);
89 }
90 }
91 },
92 };
93
94 WebsiteSettingsEditor.populateOrigin = function(local_storage, permissions) {
95 WebsiteSettingsEditor.getInstance().populateOrigin_(local_storage,
96 permissions);
97 };
98
99 // Export
100 return {
101 WebsiteSettingsEditor: WebsiteSettingsEditor
102 };
103
104 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/website_settings.js ('k') | chrome/browser/resources/options/website_settings_edit_site.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698