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

Side by Side Diff: chrome/browser/resources/supervised_user_internals.js

Issue 2600683002: Run tools/clang-format-js on some of chrome/browser/resources/ (Closed)
Patch Set: hackhackhack Created 3 years, 11 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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('chrome.supervised_user_internals', function() { 5 cr.define('chrome.supervised_user_internals', function() {
6 'use strict'; 6 'use strict';
7 7
8 function initialize() { 8 function initialize() {
9 function submitURL(event) { 9 function submitURL(event) {
10 $('try-url-result').textContent = ''; 10 $('try-url-result').textContent = '';
(...skipping 28 matching lines...) Expand all
39 node.setAttribute('highlighted', ''); 39 node.setAttribute('highlighted', '');
40 } 40 }
41 } 41 }
42 42
43 function receiveBasicInfo(info) { 43 function receiveBasicInfo(info) {
44 jstProcess(new JsEvalContext(info), $('basic-info')); 44 jstProcess(new JsEvalContext(info), $('basic-info'));
45 45
46 // Hack: Schedule another refresh after a while. 46 // Hack: Schedule another refresh after a while.
47 // TODO(treib): Get rid of this once we're properly notified of all 47 // TODO(treib): Get rid of this once we're properly notified of all
48 // relevant changes. 48 // relevant changes.
49 setTimeout(function() { chrome.send('getBasicInfo'); }, 5000); 49 setTimeout(function() {
50 chrome.send('getBasicInfo');
51 }, 5000);
50 } 52 }
51 53
52 function receiveUserSettings(settings) { 54 function receiveUserSettings(settings) {
53 if (settings === null) { 55 if (settings === null) {
54 $('user-settings').classList.add('hidden'); 56 $('user-settings').classList.add('hidden');
55 return; 57 return;
56 } 58 }
57 59
58 $('user-settings').classList.remove('hidden'); 60 $('user-settings').classList.remove('hidden');
59 61
60 // The user settings are returned as an object, flatten them into a 62 // The user settings are returned as an object, flatten them into a
61 // list of key/value pairs for easier consumption by the HTML template. 63 // list of key/value pairs for easier consumption by the HTML template.
62 // This is not done recursively, values are passed as their JSON 64 // This is not done recursively, values are passed as their JSON
63 // representation. 65 // representation.
64 var kvpairs = Object.keys(settings).map(function(key) { 66 var kvpairs = Object.keys(settings).map(function(key) {
65 return { 67 return {key: key, value: JSON.stringify(settings[key], null, 2)};
66 key: key,
67 value: JSON.stringify(settings[key], null, 2)
68 };
69 }); 68 });
70 69
71 jstProcess(new JsEvalContext({settings: kvpairs}), $('user-settings')); 70 jstProcess(new JsEvalContext({settings: kvpairs}), $('user-settings'));
72 } 71 }
73 72
74 function receiveTryURLResult(result) { 73 function receiveTryURLResult(result) {
75 $('try-url-result').textContent = result['allowResult']; 74 $('try-url-result').textContent = result['allowResult'];
76 $('manual-whitelist').textContent = result['manual']; 75 $('manual-whitelist').textContent = result['manual'];
77 $('whitelists').textContent = result['whitelists']; 76 $('whitelists').textContent = result['whitelists'];
78 } 77 }
(...skipping 24 matching lines...) Expand all
103 */ 102 */
104 function receiveFilteringResult(result) { 103 function receiveFilteringResult(result) {
105 filteringResults.push(result); 104 filteringResults.push(result);
106 105
107 var container = $('filtering-results-container'); 106 var container = $('filtering-results-container');
108 107
109 // Scroll to the bottom if we were already at the bottom. Otherwise, leave 108 // Scroll to the bottom if we were already at the bottom. Otherwise, leave
110 // the scrollbar alone. 109 // the scrollbar alone.
111 var shouldScrollDown = isScrolledToBottom(container); 110 var shouldScrollDown = isScrolledToBottom(container);
112 111
113 jstProcess(new JsEvalContext({ results: filteringResults }), container); 112 jstProcess(new JsEvalContext({results: filteringResults}), container);
114 113
115 if (shouldScrollDown) 114 if (shouldScrollDown)
116 scrollToBottom(container); 115 scrollToBottom(container);
117 } 116 }
118 117
119 // Return an object with all of the exports. 118 // Return an object with all of the exports.
120 return { 119 return {
121 initialize: initialize, 120 initialize: initialize,
122 highlightIfChanged: highlightIfChanged, 121 highlightIfChanged: highlightIfChanged,
123 receiveBasicInfo: receiveBasicInfo, 122 receiveBasicInfo: receiveBasicInfo,
124 receiveUserSettings: receiveUserSettings, 123 receiveUserSettings: receiveUserSettings,
125 receiveTryURLResult: receiveTryURLResult, 124 receiveTryURLResult: receiveTryURLResult,
126 receiveFilteringResult: receiveFilteringResult, 125 receiveFilteringResult: receiveFilteringResult,
127 }; 126 };
128 }); 127 });
129 128
130 document.addEventListener('DOMContentLoaded', 129 document.addEventListener(
131 chrome.supervised_user_internals.initialize); 130 'DOMContentLoaded', chrome.supervised_user_internals.initialize);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698