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

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

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

Powered by Google App Engine
This is Rietveld 408576698