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

Side by Side Diff: chrome/browser/resources/extensions/extension_list.js

Issue 952053003: extensions: allow trash to have a focus outline. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 5 years, 10 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 | « no previous file | chrome/browser/resources/extensions/extensions.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <include src="extension_error.js"> 5 <include src="extension_error.js">
6 6
7 /** 7 /**
8 * The type of the extension data object. The definition is based on 8 * The type of the extension data object. The definition is based on
9 * chrome/browser/ui/webui/extensions/extension_basic_info.cc 9 * chrome/browser/ui/webui/extensions/extension_basic_info.cc
10 * and 10 * and
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 * Returns true if the element should only be shown in developer mode. 190 * Returns true if the element should only be shown in developer mode.
191 * @param {Element} element 191 * @param {Element} element
192 * @return {boolean} 192 * @return {boolean}
193 * @private 193 * @private
194 */ 194 */
195 isDeveloperOption_: function(element) { 195 isDeveloperOption_: function(element) {
196 return /^dev-/.test(element.getAttribute('column-type')); 196 return /^dev-/.test(element.getAttribute('column-type'));
197 }, 197 },
198 }; 198 };
199 199
200 cr.define('options', function() { 200 cr.define('extensions', function() {
201 'use strict'; 201 'use strict';
202 202
203 /** 203 /**
204 * Creates a new list of extensions. 204 * Creates a new list of extensions.
205 * @param {Object=} opt_propertyBag Optional properties. 205 * @param {Object=} opt_propertyBag Optional properties.
206 * @constructor 206 * @constructor
207 * @extends {HTMLDivElement} 207 * @extends {HTMLDivElement}
208 */ 208 */
209 var ExtensionsList = cr.ui.define('div'); 209 var ExtensionList = cr.ui.define('div');
210 210
211 /** 211 /**
212 * @type {Object<string, number>} A map from extension id to last reloaded 212 * @type {Object<string, number>} A map from extension id to last reloaded
213 * timestamp. The timestamp is recorded when the user click the 'Reload' 213 * timestamp. The timestamp is recorded when the user click the 'Reload'
214 * link. It is used to refresh the icon of an unpacked extension. 214 * link. It is used to refresh the icon of an unpacked extension.
215 * This persists between calls to decorate. 215 * This persists between calls to decorate.
216 */ 216 */
217 var extensionReloadedTimestamp = {}; 217 var extensionReloadedTimestamp = {};
218 218
219 ExtensionsList.prototype = { 219 ExtensionList.prototype = {
220 __proto__: HTMLDivElement.prototype, 220 __proto__: HTMLDivElement.prototype,
221 221
222 /** 222 /**
223 * Indicates whether an embedded options page that was navigated to through 223 * Indicates whether an embedded options page that was navigated to through
224 * the '?options=' URL query has been shown to the user. This is necessary 224 * the '?options=' URL query has been shown to the user. This is necessary
225 * to prevent showExtensionNodes_ from opening the options more than once. 225 * to prevent showExtensionNodes_ from opening the options more than once.
226 * @type {boolean} 226 * @type {boolean}
227 * @private 227 * @private
228 */ 228 */
229 optionsShown_: false, 229 optionsShown_: false,
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 e.preventDefault(); 442 e.preventDefault();
443 }); 443 });
444 444
445 // 'Remove' button. 445 // 'Remove' button.
446 var trashTemplate = $('template-collection').querySelector('.trash'); 446 var trashTemplate = $('template-collection').querySelector('.trash');
447 var trash = trashTemplate.cloneNode(true); 447 var trash = trashTemplate.cloneNode(true);
448 trash.title = loadTimeData.getString('extensionUninstall'); 448 trash.title = loadTimeData.getString('extensionUninstall');
449 trash.hidden = extension.managedInstall; 449 trash.hidden = extension.managedInstall;
450 trash.setAttribute('column-type', 'trash'); 450 trash.setAttribute('column-type', 'trash');
451 trash.addEventListener('click', function(e) { 451 trash.addEventListener('click', function(e) {
452 trash.classList.add('open');
453 trash.classList.toggle('mouse-clicked', e.detail > 0);
452 chrome.send('extensionSettingsUninstall', [extension.id]); 454 chrome.send('extensionSettingsUninstall', [extension.id]);
453 }); 455 });
454 row.querySelector('.enable-controls').appendChild(trash); 456 row.querySelector('.enable-controls').appendChild(trash);
455 457
456 // Developer mode //////////////////////////////////////////////////////// 458 // Developer mode ////////////////////////////////////////////////////////
457 459
458 // The path, if provided by unpacked extension. 460 // The path, if provided by unpacked extension.
459 row.setupColumn('.load-path a:first-of-type', 'dev-loadPath', 'click', 461 row.setupColumn('.load-path a:first-of-type', 'dev-loadPath', 'click',
460 function(e) { 462 function(e) {
461 chrome.send('extensionSettingsShowPath', [String(extension.id)]); 463 chrome.send('extensionSettingsShowPath', [String(extension.id)]);
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 self.optionsShown_ = false; 877 self.optionsShown_ = false;
876 $('overlay').removeEventListener('cancelOverlay', f); 878 $('overlay').removeEventListener('cancelOverlay', f);
877 }); 879 });
878 880
879 // TODO(dbeam): why do we need to focus <extensionoptions> before and 881 // TODO(dbeam): why do we need to focus <extensionoptions> before and
880 // after its showing animation? Makes very little sense to me. 882 // after its showing animation? Makes very little sense to me.
881 overlay.setInitialFocus(); 883 overlay.setInitialFocus();
882 }, 884 },
883 }; 885 };
884 886
887 ExtensionList.uninstallCancel = function() {
888 var trash = document.querySelector('.trash.open');
889 if (trash.classList.contains('mouse-clicked'))
890 trash.blur();
891 trash.classList.remove('open');
892 };
893
885 return { 894 return {
886 ExtensionsList: ExtensionsList 895 ExtensionList: ExtensionList
887 }; 896 };
888 }); 897 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/extensions/extensions.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698