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

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

Issue 664583006: Improve keyboard navigation on 'Manage search engines' options page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 (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 /** 5 /**
6 * @typedef {{canBeDefault: boolean, 6 * @typedef {{canBeDefault: boolean,
7 * canBeEdited: boolean, 7 * canBeEdited: boolean,
8 * canBeRemoved: boolean, 8 * canBeRemoved: boolean,
9 * default: boolean, 9 * default: boolean,
10 * displayName: string, 10 * displayName: string,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 nameColEl.appendChild(nameEl); 132 nameColEl.appendChild(nameEl);
133 133
134 // Then the keyword column. 134 // Then the keyword column.
135 var keywordEl = this.createEditableTextCell(engine.keyword); 135 var keywordEl = this.createEditableTextCell(engine.keyword);
136 keywordEl.className = 'keyword-column'; 136 keywordEl.className = 'keyword-column';
137 keywordEl.classList.add('weakrtl'); 137 keywordEl.classList.add('weakrtl');
138 this.contentElement.appendChild(keywordEl); 138 this.contentElement.appendChild(keywordEl);
139 139
140 // And the URL column. 140 // And the URL column.
141 var urlEl = this.createEditableTextCell(engine.url); 141 var urlEl = this.createEditableTextCell(engine.url);
142 var makeDefaultButtonEl = null;
Dan Beam 2014/10/18 01:35:44 probably don't need the "= null"
142 // Extensions should not display a URL column. 143 // Extensions should not display a URL column.
143 if (!engine.isExtension) { 144 if (!engine.isExtension) {
144 var urlWithButtonEl = this.ownerDocument.createElement('div'); 145 var urlWithButtonEl = this.ownerDocument.createElement('div');
145 urlWithButtonEl.appendChild(urlEl); 146 urlWithButtonEl.appendChild(urlEl);
146 urlWithButtonEl.className = 'url-column'; 147 urlWithButtonEl.className = 'url-column';
147 urlWithButtonEl.classList.add('weakrtl'); 148 urlWithButtonEl.classList.add('weakrtl');
148 this.contentElement.appendChild(urlWithButtonEl); 149 this.contentElement.appendChild(urlWithButtonEl);
149 // Add the Make Default button. Temporary until drag-and-drop 150 // Add the Make Default button. Temporary until drag-and-drop
150 // re-ordering is implemented. When this is removed, remove the extra 151 // re-ordering is implemented. When this is removed, remove the extra
151 // div above. 152 // div above.
152 if (engine.canBeDefault) { 153 if (engine.canBeDefault) {
153 var makeDefaultButtonEl = this.ownerDocument.createElement('button'); 154 makeDefaultButtonEl = this.ownerDocument.createElement('button');
154 makeDefaultButtonEl.className = 155 makeDefaultButtonEl.className =
155 'custom-appearance list-inline-button'; 156 'custom-appearance list-inline-button';
156 makeDefaultButtonEl.textContent = 157 makeDefaultButtonEl.textContent =
157 loadTimeData.getString('makeDefaultSearchEngineButton'); 158 loadTimeData.getString('makeDefaultSearchEngineButton');
158 makeDefaultButtonEl.onclick = function(e) { 159 makeDefaultButtonEl.onclick = function(e) {
159 chrome.send('managerSetDefaultSearchEngine', [engine.modelIndex]); 160 chrome.send('managerSetDefaultSearchEngine', [engine.modelIndex]);
160 }; 161 };
161 makeDefaultButtonEl.onmousedown = function(e) { 162 makeDefaultButtonEl.onmousedown = function(e) {
162 // Don't select the row when clicking the button. 163 // Don't select the row when clicking the button.
163 e.stopPropagation(); 164 e.stopPropagation();
(...skipping 21 matching lines...) Expand all
185 186
186 if (this.isPlaceholder) { 187 if (this.isPlaceholder) {
187 this.nameField_.placeholder = 188 this.nameField_.placeholder =
188 loadTimeData.getString('searchEngineTableNamePlaceholder'); 189 loadTimeData.getString('searchEngineTableNamePlaceholder');
189 this.keywordField_.placeholder = 190 this.keywordField_.placeholder =
190 loadTimeData.getString('searchEngineTableKeywordPlaceholder'); 191 loadTimeData.getString('searchEngineTableKeywordPlaceholder');
191 this.urlField_.placeholder = 192 this.urlField_.placeholder =
192 loadTimeData.getString('searchEngineTableURLPlaceholder'); 193 loadTimeData.getString('searchEngineTableURLPlaceholder');
193 } 194 }
194 195
196 this.setFocusableColumnIndex(this.nameField_, 0);
197 this.setFocusableColumnIndex(this.keywordField_, 1);
198 this.setFocusableColumnIndex(this.urlField_, 2);
199 this.setFocusableColumnIndex(makeDefaultButtonEl, 3);
200 this.setFocusableColumnIndex(this.closeButtonElement, 4);
201
195 var fields = [this.nameField_, this.keywordField_, this.urlField_]; 202 var fields = [this.nameField_, this.keywordField_, this.urlField_];
196 for (var i = 0; i < fields.length; i++) { 203 for (var i = 0; i < fields.length; i++) {
197 fields[i].oninput = this.startFieldValidation_.bind(this); 204 fields[i].oninput = this.startFieldValidation_.bind(this);
198 } 205 }
199 206
200 // Listen for edit events. 207 // Listen for edit events.
201 if (engine.canBeEdited) { 208 if (engine.canBeEdited) {
202 this.addEventListener('edit', this.onEditStarted_.bind(this)); 209 this.addEventListener('edit', this.onEditStarted_.bind(this));
203 this.addEventListener('canceledit', this.onEditCancelled_.bind(this)); 210 this.addEventListener('canceledit', this.onEditCancelled_.bind(this));
204 this.addEventListener('commitedit', this.onEditCommitted_.bind(this)); 211 this.addEventListener('commitedit', this.onEditCommitted_.bind(this));
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 }, 372 },
366 }; 373 };
367 374
368 // Export 375 // Export
369 return { 376 return {
370 SearchEngineList: SearchEngineList 377 SearchEngineList: SearchEngineList
371 }; 378 };
372 379
373 }); 380 });
374 381
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698