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

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

Issue 683813004: Fewer focusable items in chrome://settings/searchEngines (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 (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 cr.define('options', function() { 5 cr.define('options', function() {
6 /** @const */ var List = cr.ui.List; 6 /** @const */ var List = cr.ui.List;
7 /** @const */ var ListItem = cr.ui.ListItem; 7 /** @const */ var ListItem = cr.ui.ListItem;
8 8
9 /** 9 /**
10 * Creates a deletable list item, which has a button that will trigger a call 10 * Creates a deletable list item, which has a button that will trigger a call
(...skipping 20 matching lines...) Expand all
31 */ 31 */
32 closeButtonElement_: null, 32 closeButtonElement_: null,
33 33
34 /** 34 /**
35 * Whether or not this item can be deleted. 35 * Whether or not this item can be deleted.
36 * @type {boolean} 36 * @type {boolean}
37 * @private 37 * @private
38 */ 38 */
39 deletable_: true, 39 deletable_: true,
40 40
41 /**
42 * Whether or not the close button can ever be navigated to using the
43 * keyboard.
44 * @type {boolean}
Dan Beam 2014/10/29 01:37:12 @protected
bondd 2014/10/29 17:19:07 Done.
45 */
46 closeButtonFocusAllowed: false,
47
41 /** @override */ 48 /** @override */
42 decorate: function() { 49 decorate: function() {
43 ListItem.prototype.decorate.call(this); 50 ListItem.prototype.decorate.call(this);
44 51
45 this.classList.add('deletable-item'); 52 this.classList.add('deletable-item');
46 53
47 this.contentElement_ = /** @type {HTMLElement} */( 54 this.contentElement_ = /** @type {HTMLElement} */(
48 this.ownerDocument.createElement('div')); 55 this.ownerDocument.createElement('div'));
49 this.appendChild(this.contentElement_); 56 this.appendChild(this.contentElement_);
50 57
51 this.closeButtonElement_ = /** @type {HTMLElement} */( 58 this.closeButtonElement_ = /** @type {HTMLElement} */(
52 this.ownerDocument.createElement('button')); 59 this.ownerDocument.createElement('button'));
53 this.closeButtonElement_.className = 60 this.closeButtonElement_.className =
54 'raw-button row-delete-button custom-appearance'; 61 'raw-button row-delete-button custom-appearance';
55 this.closeButtonElement_.addEventListener('mousedown', 62 this.closeButtonElement_.addEventListener('mousedown',
56 this.handleMouseDownUpOnClose_); 63 this.handleMouseDownUpOnClose_);
57 this.closeButtonElement_.addEventListener('mouseup', 64 this.closeButtonElement_.addEventListener('mouseup',
58 this.handleMouseDownUpOnClose_); 65 this.handleMouseDownUpOnClose_);
59 this.closeButtonElement_.addEventListener('focus', 66 this.closeButtonElement_.addEventListener('focus',
60 this.handleFocus_.bind(this)); 67 this.handleFocus.bind(this));
61 this.closeButtonElement_.tabIndex = -1; 68 this.closeButtonElement_.tabIndex = -1;
62 this.closeButtonElement_.title = 69 this.closeButtonElement_.title =
63 loadTimeData.getString('deletableItemDeleteButtonTitle'); 70 loadTimeData.getString('deletableItemDeleteButtonTitle');
64 this.appendChild(this.closeButtonElement_); 71 this.appendChild(this.closeButtonElement_);
65 }, 72 },
66 73
67 /** 74 /**
68 * Returns the element subclasses should add content to. 75 * Returns the element subclasses should add content to.
69 * @return {HTMLElement} The element subclasses should popuplate. 76 * @return {HTMLElement} The element subclasses should popuplate.
70 */ 77 */
(...skipping 16 matching lines...) Expand all
87 return this.deletable_; 94 return this.deletable_;
88 }, 95 },
89 set deletable(value) { 96 set deletable(value) {
90 this.deletable_ = value; 97 this.deletable_ = value;
91 this.closeButtonElement_.disabled = !value; 98 this.closeButtonElement_.disabled = !value;
92 }, 99 },
93 100
94 /** 101 /**
95 * Called when a focusable child element receives focus. Selects this item 102 * Called when a focusable child element receives focus. Selects this item
96 * in the list selection model. 103 * in the list selection model.
97 * @private 104 * @protected
98 */ 105 */
99 handleFocus_: function() { 106 handleFocus: function() {
bondd 2014/10/28 22:29:57 Made this protected because existing code in inlin
100 // This handler is also fired when the child receives focus as a result of 107 // This handler is also fired when the child receives focus as a result of
101 // the item getting selected by the customized mouse/keyboard handling in 108 // the item getting selected by the customized mouse/keyboard handling in
102 // SelectionController. Take care not to destroy a potential multiple 109 // SelectionController. Take care not to destroy a potential multiple
103 // selection in this case. 110 // selection in this case.
104 if (this.selected) 111 if (this.selected)
105 return; 112 return;
106 113
107 var list = this.parentNode; 114 var list = this.parentNode;
108 var index = list.getIndexOfListItem(this); 115 var index = list.getIndexOfListItem(this);
109 list.selectionModel.selectedIndex = index; 116 list.selectionModel.selectedIndex = index;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 */ 204 */
198 deleteItemAtIndex: function(index) { 205 deleteItemAtIndex: function(index) {
199 }, 206 },
200 }; 207 };
201 208
202 return { 209 return {
203 DeletableItemList: DeletableItemList, 210 DeletableItemList: DeletableItemList,
204 DeletableItem: DeletableItem, 211 DeletableItem: DeletableItem,
205 }; 212 };
206 }); 213 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698