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

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

Issue 501063002: Surface battery auditing information on the website settings option page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@origin-power-map
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
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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.WebsiteSettings', function() { 5 cr.define('options.WebsiteSettings', function() {
6 /** @const */ var Page = cr.ui.pageManager.Page; 6 /** @const */ var Page = cr.ui.pageManager.Page;
7 7
8 ///////////////////////////////////////////////////////////////////////////// 8 /////////////////////////////////////////////////////////////////////////////
9 // WebsiteSettingsEditor class: 9 // WebsiteSettingsEditor class:
10 10
(...skipping 15 matching lines...) Expand all
26 26
27 27
28 /** @override */ 28 /** @override */
29 initializePage: function() { 29 initializePage: function() {
30 Page.prototype.initializePage.call(this); 30 Page.prototype.initializePage.call(this);
31 31
32 $('website-settings-storage-delete-button').onclick = function(event) { 32 $('website-settings-storage-delete-button').onclick = function(event) {
33 chrome.send('deleteLocalStorage'); 33 chrome.send('deleteLocalStorage');
34 }; 34 };
35 35
36 $('website-settings-battery-stop-button').onclick = function(event) {
37 chrome.send('stopOrigin');
38 };
39
36 $('websiteSettingsEditorCancelButton').onclick = 40 $('websiteSettingsEditorCancelButton').onclick =
37 PageManager.closeOverlay.bind(PageManager); 41 PageManager.closeOverlay.bind(PageManager);
38 42
39 $('websiteSettingsEditorDoneButton').onclick = function(event) { 43 $('websiteSettingsEditorDoneButton').onclick = function(event) {
40 WebsiteSettingsEditor.getInstance().updatePermissions(); 44 WebsiteSettingsEditor.getInstance().updatePermissions();
41 PageManager.closeOverlay.bind(PageManager)(); 45 PageManager.closeOverlay.bind(PageManager)();
42 }; 46 };
43 }, 47 },
44 48
45 /** 49 /**
46 * Populates the page with the proper information for a given URL. 50 * Populates the page with the proper information for a given URL.
47 * @param {string} url The URL of the page. 51 * @param {string} url The URL of the page.
48 * @private 52 * @private
49 */ 53 */
50 populatePage: function(url) { 54 populatePage: function(url) {
51 this.url = url; 55 this.url = url;
52 56
53 var titleEl = $('website-title'); 57 var titleEl = $('website-title');
54 titleEl.textContent = url; 58 titleEl.textContent = url;
55 titleEl.style.backgroundImage = getFaviconImageSet(url); 59 titleEl.style.backgroundImage = getFaviconImageSet(url);
56 60
57 chrome.send('getOriginInfo', [url]); 61 chrome.send('getOriginInfo', [url]);
58 }, 62 },
59 63
60 /** 64 /**
61 * Populates and displays the page with given origin information. 65 * Populates and displays the page with given origin information.
62 * @param {string} localStorage A string describing the local storage use. 66 * @param {string} localStorage A string describing the local storage use.
67 * @param {string} batteryUsage A string describing the battery use.
63 * @param {Object} permissions A dictionary of permissions to their 68 * @param {Object} permissions A dictionary of permissions to their
64 * available and current settings, and if it is editable. 69 * available and current settings, and if it is editable.
65 * @param {boolean} showPage If the page should raised. 70 * @param {boolean} showPage If the page should raised.
66 * @private 71 * @private
67 */ 72 */
68 populateOrigin_: function(localStorage, permissions, showPage) { 73 populateOrigin_: function(localStorage, batteryUsage, permissions,
74 showPage) {
69 $('local-storage-title').textContent = localStorage; 75 $('local-storage-title').textContent = localStorage;
76 $('battery-title').textContent = batteryUsage;
70 for (var key in permissions) { 77 for (var key in permissions) {
71 var selector = $(key + '-select-option'); 78 var selector = $(key + '-select-option');
72 79
73 var options = permissions[key].options; 80 var options = permissions[key].options;
74 selector.options.length = 0; 81 selector.options.length = 0;
75 for (var option in options) { 82 for (var option in options) {
76 selector.options[selector.options.length] = 83 selector.options[selector.options.length] =
77 new Option(loadTimeData.getString(options[option] + 'Exception'), 84 new Option(loadTimeData.getString(options[option] + 'Exception'),
78 options[option]); 85 options[option]);
79 } 86 }
(...skipping 10 matching lines...) Expand all
90 for (var key in this.permissions) { 97 for (var key in this.permissions) {
91 var selection = $(this.permissions[key] + '-select-option'); 98 var selection = $(this.permissions[key] + '-select-option');
92 if (selection.value != selection.originalValue) { 99 if (selection.value != selection.originalValue) {
93 chrome.send('setOriginPermission', 100 chrome.send('setOriginPermission',
94 [this.permissions[key], selection.value]); 101 [this.permissions[key], selection.value]);
95 } 102 }
96 } 103 }
97 }, 104 },
98 }; 105 };
99 106
100 WebsiteSettingsEditor.populateOrigin = function(localStorage, permissions, 107 WebsiteSettingsEditor.populateOrigin = function(localStorage, batteryUsage,
101 showPage) { 108 permissions, showPage) {
Bernhard Bauer 2014/08/26 08:16:07 Indent two more spaces. Alternatively, break after
Daniel Nishi 2014/08/26 17:45:38 Indent added.
102 WebsiteSettingsEditor.getInstance().populateOrigin_(localStorage, 109 WebsiteSettingsEditor.getInstance().populateOrigin_(localStorage,
110 batteryUsage,
103 permissions, 111 permissions,
104 showPage); 112 showPage);
105 }; 113 };
106 114
107 // Export 115 // Export
108 return { 116 return {
109 WebsiteSettingsEditor: WebsiteSettingsEditor 117 WebsiteSettingsEditor: WebsiteSettingsEditor
110 }; 118 };
111 119
112 }); 120 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698