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

Side by Side Diff: chrome/browser/resources/plugins.html

Issue 1085003: Implement chrome://plugins page that can disable plugins. (Closed)
Patch Set: merge ToT again Created 10 years, 9 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
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE HTML>
2 <html i18n-values="dir:textdirection;">
3 <head>
4 <meta charset="utf-8">
5 <title i18n-content="pluginsTitle"></title>
6 <style>
7
8 body {
9 margin: 10px;
10 min-width: 47em;
11 }
12
13 a {
14 color: blue;
15 font-size: 103%;
16 }
17
18 div#header {
19 margin-bottom: 1.05em;
20 overflow: hidden;
21 padding-bottom: 1.5em;
22 padding-left: 0;
23 padding-top: 1.5em;
24 position: relative;
25 }
26
27 html[dir='rtl'] div#header {
28 padding-right: 0;
29 }
30
31 div#header h1 {
32 background: url('../../app/theme/extensions_section.png') 0px 20px no-repeat;
33 display: inline;
34 margin: 0;
35 padding-bottom: 43px;
36 padding-left: 75px;
37 padding-top: 40px;
38 }
39
40 html[dir='rtl'] div#header h1 {
41 background: url('../../app/theme/extensions_section.png') right no-repeat;
42 padding-right: 95px;
43 padding-left: 0;
44 }
45
46 h1 {
47 font-size: 156%;
48 font-weight: bold;
49 padding: 0;
50 margin: 0;
51 }
52
53 div.content {
54 font-size: 88%;
55 margin-top: 5px;
56 }
57
58 .section-header {
59 background: #ebeff9;
60 border-top: 1px solid #b5c7de;
61 font-size: 99%;
62 padding-bottom: 2px;
63 padding-left: 5px;
64 padding-top: 3px;
65 width: 100%;
66 }
67
68 html[dir='rtl'] .section-header {
69 padding-right: 5px;
70 padding-left: 0;
71 }
72
73 .section-header > table tr td:first-child {
74 width: 100%;
75 }
76
77 .section-header > table {
78 width: 100%;
79 }
80
81 .section-header-title {
82 font-weight: bold;
83 }
84
85 .vbox-container {
86 display: -webkit-box;
87 -webkit-box-orient: vertical;
88 }
89
90 .wbox {
91 display: -webkit-box;
92 -webkit-box-align: stretch;
93 -webkit-box-flex: 1;
94 }
95
96 .wbox#top {
97 padding-right: 5px;
98 }
99
100 html[dir='rtl'] .wbox#top {
101 padding-left: 5px;
102 padding-right: 0;
103 }
104
105 .showInTmiMode {
106 overflow: hidden;
107 }
108
109 body.hideTmiModeInitial .showInTmiMode {
110 height: 0 !important;
111 opacity: 0;
112 }
113
114 body.hideTmiMode .showInTmiMode {
115 height: 0 !important;
116 opacity: 0;
117 -webkit-transition: all .1s ease-out;
118 }
119
120 body.showTmiModeInitial .showInTmiMode {
121 opacity: 1;
122 }
123
124 body.showTmiMode .showInTmiMode {
125 opacity: 1;
126 -webkit-transition: all .1s ease-in;
127 }
128
129 .wbox-tmi-mode {
130 -webkit-box-align: stretch;
131 -webkit-box-flex: 1;
132 }
133
134 .tmi-mode-image {
135 margin-top: 2px;
136 padding-left: 5px;
137 padding-right: 5px;
138 }
139
140 .tmi-mode-link {
141 margin-right: 3px;
142 white-space: nowrap;
143 }
144
145 .tmi-mode-link a {
146 font-size: 97%;
147 }
148
149 .tmi-mode {
150 background: #f4f6fc;
151 border-bottom: 1px solid #edeff5;
152 font-size: 89%;
153 padding-bottom: 0.8em;
154 padding-left: 10px;
155 padding-top: 0.8em;
156 width: 100%;
157 }
158
159 html[dir='rtl'] .tmi-mode {
160 padding-right: 10px;
161 padding-left: 0;
162 }
163
164 .plugin_disabled > td {
165 background: url('gray.png') 0px 0px;
166 color: #a0a0a0;
167 padding-bottom: 4px;
168 padding-top: 5px;
169 }
170
171 .plugin_enabled > td {
172 padding-bottom: 4px;
173 padding-top: 5px;
174 }
175
176 .plugin {
177 border-bottom: 1px solid #cdcdcd;
178 }
179
180 /* Indent the text related to each plug-in. */
181 .plugin-text {
182 padding-left: 5px;
183 }
184
185 html[dir='rtl'] .plugin-text {
186 padding-right: 5px;
187 padding-left: 0;
188 }
189
190 .plugin-name {
191 font-weight: bold;
192 }
193
194 .no-plugins {
195 margin: 6em 0 0;
196 text-align: center;
197 font-size: 1.2em;
198 }
199
200 /* Use tables for layout, so eliminate extra spacing. */
201 .plugin-details table {
202 -webkit-border-horizontal-spacing: 0;
203 -webkit-border-vertical-spacing: 0;
204 }
205
206 /* Separate the inital line, Description, Location, and MIME Types lines. */
207 .plugin-details > div {
208 padding-top: 0.1em
209 }
210
211 /* Align rows of tables along the top. */
212 .plugin-details tr {
213 vertical-align: top;
214 }
215
216 /* Separate columns by 1em for the most part. */
217 .plugin-details td+td {
218 padding-left: 1em;
219 }
220
221 html[dir='rtl'] .plugin-details td+td {
222 padding-right: 1em;
223 padding-left: 0;
224 }
225
226 /* Make the MIME Types tables smaller. */
227 .plugin-details .mime_types {
228 font-size: 95%;
229 }
230
231 /* Separate the header from the contents in each MIME Types table. */
232 .plugin-details .mime_types .header td {
233 padding-bottom: 0.1em;
234 border-bottom: 1px solid;
235 }
236
237 /* Separate the columns for tables used for horizontal listings only a bit. */
238 .hlisting td+td {
239 padding-left: 0.4em;
240 }
241
242 html[dir='rtl'] .hlisting td+td {
243 padding-right: 0.4em;
244 padding-left: 0;
245 }
246
247 /* Match the indentation of .plugin-text. */
248 .plugin-actions {
249 padding-left: 5px;
250 margin-top: 0.2em;
251 margin-bottom: 0.2em;
252 }
253
254 html[dir='rtl'] .plugin-actions {
255 padding-right: 5px;
256 padding-left: 0;
257 }
258
259 button {
260 font-size: 104%;
261 }
262
263 </style>
264 <script>
265
266 /**
267 * This variable structure is here to document the structure that the template
268 * expects to correctly populate the page.
269 */
270 var pluginDataFormat = {
271 'plugins': [
272 {
273 'path': '/blahblah/blahblah/MyCrappyPlugin.plugin',
274 'name': 'MyCrappyPlugin',
275 'version': '1.2.3',
276 'description': 'My crappy plugin',
277 'mimeTypes': [
278 { 'description': 'Foo Media',
279 'fileExtensions': [ 'foo' ],
280 'mimeType': 'application/x-my-foo' },
281 { 'description': 'Bar Stuff',
282 'fileExtensions': [ 'bar','baz' ],
283 'mimeType': 'application/my-bar' }
284 ],
285 'enabled': true
286 },
287 {
288 'path': '/foobar/baz/YourGreatPlugin.plugin',
289 'name': 'YourGreatPlugin',
290 'version': '4.5',
291 'description': 'Your great plugin',
292 'mimeTypes': [
293 { 'description': 'Baz Stuff',
294 'fileExtensions': [ 'baz' ],
295 'mimeType': 'application/x-your-baz' }
296 ],
297 'enabled': false
298 }
299 ]
300 };
301
302 /**
303 * Takes the |pluginsData| input argument which represents data about the
304 * currently installed/running plugins and populates the html jstemplate with
305 * that data. It expects an object structure like the above.
306 * @param {Object} pluginsData Detailed info about installed plugins
307 */
308 function renderTemplate(pluginsData) {
309 // This is the javascript code that processes the template:
310 var input = new JsEvalContext(pluginsData);
311 var output = document.getElementById('pluginTemplate');
312 jstProcess(input, output);
313 }
314
315 /**
316 * Asks the C++ PluginsDOMHandler to get details about the installed plugins and
317 * return detailed data about the configuration. The PluginsDOMHandler should
318 * reply to returnPluginsData() (below).
319 */
320 function requestPluginsData() {
321 chrome.send('requestPluginsData', []);
322 }
323
324 /**
325 * Called by the dom_ui_ to re-populate the page with data representing the
326 * current state of installed plugins.
327 */
328 function returnPluginsData(pluginsData){
329 var bodyContainer = document.getElementById('body-container');
330 var body = document.body;
331
332 // Set all page content to be visible so we can measure heights.
333 bodyContainer.style.visibility = 'hidden';
334 body.className = '';
335 var slidables = document.getElementsByClassName('showInTmiMode');
336 for (var i = 0; i < slidables.length; i++)
337 slidables[i].style.height = 'auto';
338
339 renderTemplate(pluginsData);
340
341 // Make sure the left column (with "Description:", "Location:", etc.) is the
342 // same size for all plugins.
343 var labels = document.getElementsByClassName('plugin-details-label');
344 var maxLabelWidth = 0;
345 for (var i = 0; i < labels.length; i++)
346 labels[i].style.width = 'auto';
347 for (var i = 0; i < labels.length; i++)
348 maxLabelWidth = Math.max(maxLabelWidth, labels[i].offsetWidth);
349 for (var i = 0; i < labels.length; i++)
350 labels[i].style.width = maxLabelWidth + 'px';
351
352 // Explicitly set the height for each element that wants to be "slid" in and
353 // out when the tmiModeExpanded is toggled.
354 var slidables = document.getElementsByClassName('showInTmiMode');
355 for (var i = 0; i < slidables.length; i++)
356 slidables[i].style.height = slidables[i].offsetHeight + 'px';
357
358 // Reset visibility of page based on the current tmi mode.
359 document.getElementById('collapse').style.display =
360 tmiModeExpanded ? 'inline' : 'none';
361 document.getElementById('expand').style.display =
362 tmiModeExpanded ? 'none' : 'inline';
363 bodyContainer.style.visibility = 'visible';
364 body.className = tmiModeExpanded ?
365 'showTmiModeInitial' : 'hideTmiModeInitial';
366 }
367
368 /**
369 * Handles a 'enable' or 'disable' button getting clicked.
370 */
371 function handleEnablePlugin(node, enable) {
372 // Tell the C++ PluginsDOMHandler to enable/disable the plugin.
373 chrome.send('enablePlugin', [node.pluginPath, String(enable)]);
374 requestPluginsData();
375 }
376
377 // Keeps track of whether details have been made visible (expanded) or not.
378 var tmiModeExpanded = false;
379
380 /*
381 * Toggles visibility of details.
382 */
383 function toggleTmiMode() {
384 tmiModeExpanded = !tmiModeExpanded;
385
386 document.getElementById('collapse').style.display =
387 tmiModeExpanded ? 'inline' : 'none';
388 document.getElementById('expand').style.display =
389 tmiModeExpanded ? 'none' : 'inline';
390
391 document.body.className =
392 tmiModeExpanded ? 'showTmiMode' : 'hideTmiMode';
393 }
394
395 /**
396 * Determines whether a plugin's version should be displayed.
397 */
398 function shouldDisplayPluginVersion(plugin) {
399 return !!plugin.version;
400 }
401
402 /**
403 * Determines whether a plugin's description should be displayed.
404 */
405 function shouldDisplayPluginDescription(plugin) {
406 // Only display the description if it's not blank and if it's not just the
407 // name, version, or combination thereof.
408 return plugin.description &&
409 plugin.description != plugin.name &&
410 plugin.description != plugin.version &&
411 plugin.description != 'Version ' + plugin.version &&
412 plugin.description != plugin.name + ' ' + plugin.version;
413 }
414
415 /**
416 * Formats a file extension for display.
417 */
418 function formatFileExtension(ext) {
419 return '.' + ext;
420 }
421
422 // Unfortunately, we don't have notifications for plugin (list) status changes
423 // (yet), so in the meanwhile just update regularly.
424 setInterval('requestPluginsData()', 30000);
425
426 // Get data and have it displayed upon loading.
427 window.onload = requestPluginsData;
428
429 </script>
430 </head>
431 <body i18n-values=".style.fontFamily:fontfamily;.style.fontSize:fontsize">
432 <div id="body-container" style="visibility:hidden">
433
434 <div id="header"><h1 i18n-content="pluginsTitle">TITLE</h1></div>
435
436 <div id="pluginTemplate">
437
438 <div id="container" class="vbox-container">
439 <div id="top" class="wbox">
440
441 <div class="section-header">
442 <table cellpadding="0" cellspacing="0"><tr valign="center">
443 <td>
444 <span class="section-header-title" i18n-content="pluginsTitle"
445 >TITLE</span>
446 <span class="section-header-title"
447 jsdisplay="plugins.length > 0">(<span
448 jscontent="plugins.length"></span>)</span>
449 </td>
450 <td width="18">
451 <img id="collapse" class="tmi-mode-image"
452 style="display:none" onclick="toggleTmiMode();"
453 src="minus.png"></img>
454 <img id="expand" class="tmi-mode-image"
455 onclick="toggleTmiMode();" src="plus.png"></img>
456 </td>
457 <td>
458 <div class="tmi-mode-link">
459 <a onclick="toggleTmiMode();" style="cursor: default"
460 i18n-content="pluginsDetailsModeLink">DETAILS</a>
461 </div>
462 </td>
463 </tr></table>
464 </div>
465
466 </div>
467 </div>
468
469 <div class="content">
470 <div class="plugin-name no-plugins" jsdisplay="plugins.length === 0">
471 <div i18n-content="noPlugins">NO_PLUGINS_ARE_INSTALLED</div>
472 </div>
473
474 <div jsdisplay="plugins.length > 0">
475 <div class="plugin" jsselect="plugins">
476 <table width="100%" cellpadding="2" cellspacing="0">
477 <tr jsvalues=
478 ".className:enabled ? 'plugin_enabled' : 'plugin_disabled'">
479 <td valign="top">
480 <div class="plugin-text">
481 <div>
482 <span class="plugin-name"
483 jscontent="name">PLUGIN NAME</span>
484 <span jsdisplay="shouldDisplayPluginVersion($this)">
485 - <span i18n-content="pluginVersion">VERSION</span>
486 <span jscontent="version">x.x.x.x</span>
487 </span>
488 <span jsdisplay="!enabled"
489 i18n-content="pluginDisabled">(DISABLED)</span>
490 </div>
491 <div class="plugin-details">
492 <div><table><tr jsdisplay="shouldDisplayPluginDescription($this)">
493 <td class="plugin-details-label"
494 i18n-content="pluginDescription">DESCRIPTION:</td>
495 <td jsvalues=".innerHTML:description"></td>
496 </tr></table></div>
497 <div><table><tr>
498 <td class="plugin-details-label"
499 i18n-content="pluginPath">PATH:</td>
500 <td jscontent="path"></td>
501 </tr></table></div>
502 <div class="showInTmiMode">
503 <table><tr jsdisplay="mimeTypes.length > 0">
504 <td class="plugin-details-label"
505 i18n-content="pluginMimeTypes">MIME_TYPES:</td>
506 <td><table width="100%" class="mime_types">
507 <tr class="header">
508 <td i18n-content="pluginMimeTypesMimeType"
509 >MIME type</td>
510 <td i18n-content="pluginMimeTypesDescription"
511 >DESCRIPTION</td>
512 <td i18n-content="pluginMimeTypesFileExtensions"
513 >FILE_EXTENSIONS</td>
514 </tr>
515 <tr jsselect="mimeTypes">
516 <td jscontent="mimeType"></td>
517 <td jscontent="description"></td>
518 <td><table jsdisplay="fileExtensions.length > 0"
519 class="hlisting">
520 <tr><td jsselect="fileExtensions">
521 <span jscontent="formatFileExtension($this)"></span>
522 </td></tr>
523 </table></td>
524 </tr>
525 </table></td>
526 </tr></table>
527 </div>
528 </div>
529 </div>
530
531 <div class="plugin-actions">
532 <span>
533 <a
534 jsvalues=".pluginPath:path"
535 jsdisplay="enabled"
536 onclick="handleEnablePlugin(this, false)"
537 href="javascript:void();"
538 i18n-content="disable"
539 >DISABLE</a>
540 <a
541 jsvalues=".pluginPath:path"
542 jsdisplay="!enabled"
543 onclick="handleEnablePlugin(this, true)"
544 href="javascript:void();"
545 i18n-content="enable"
546 >ENABLE</a>
547 </span>
548 </div>
549 </td>
550 </tr>
551 </table>
552 </div>
553 </div>
554 </div>
555 </div>
556 </div>
557 </body>
558 </html>
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/resource_message_filter.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698