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

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: 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 {Array} args A list containing the amount of local storage used
Bernhard Bauer 2014/08/15 14:53:05 From the code, it seems this is a dictionary?
Daniel Nishi 2014/08/15 16:56:45 chrome/browser/ui/webui/options/website_settings_h
Bernhard Bauer 2014/08/15 17:13:04 Oh, I overlooked it's the whole arguments array.
Daniel Nishi 2014/08/15 17:33:46 Done.
59 and its permission information.
60 * @private
61 */
62 populateOrigin_: function(args) {
63 $('local-storage-title').textContent = args[0];
64 var permissions = args[1];
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(args) {
95 WebsiteSettingsEditor.getInstance().populateOrigin_(args);
96 };
97
98 // Export
99 return {
100 WebsiteSettingsEditor: WebsiteSettingsEditor
101 };
102
103 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698