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

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: Rebase 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.isOmniboxExtension) { 145 if (!engine.isOmniboxExtension) {
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 18 matching lines...) Expand all
183 184
184 if (this.isPlaceholder) { 185 if (this.isPlaceholder) {
185 this.nameField_.placeholder = 186 this.nameField_.placeholder =
186 loadTimeData.getString('searchEngineTableNamePlaceholder'); 187 loadTimeData.getString('searchEngineTableNamePlaceholder');
187 this.keywordField_.placeholder = 188 this.keywordField_.placeholder =
188 loadTimeData.getString('searchEngineTableKeywordPlaceholder'); 189 loadTimeData.getString('searchEngineTableKeywordPlaceholder');
189 this.urlField_.placeholder = 190 this.urlField_.placeholder =
190 loadTimeData.getString('searchEngineTableURLPlaceholder'); 191 loadTimeData.getString('searchEngineTableURLPlaceholder');
191 } 192 }
192 193
194 this.setFocusableColumnIndex(this.nameField_, 0);
195 this.setFocusableColumnIndex(this.keywordField_, 1);
196 this.setFocusableColumnIndex(this.urlField_, 2);
197 this.setFocusableColumnIndex(makeDefaultButtonEl, 3);
198 this.setFocusableColumnIndex(this.closeButtonElement, 4);
199
193 var fields = [this.nameField_, this.keywordField_, this.urlField_]; 200 var fields = [this.nameField_, this.keywordField_, this.urlField_];
194 for (var i = 0; i < fields.length; i++) { 201 for (var i = 0; i < fields.length; i++) {
195 fields[i].oninput = this.startFieldValidation_.bind(this); 202 fields[i].oninput = this.startFieldValidation_.bind(this);
196 } 203 }
197 204
198 // Listen for edit events. 205 // Listen for edit events.
199 if (engine.canBeEdited) { 206 if (engine.canBeEdited) {
200 this.addEventListener('edit', this.onEditStarted_.bind(this)); 207 this.addEventListener('edit', this.onEditStarted_.bind(this));
201 this.addEventListener('canceledit', this.onEditCancelled_.bind(this)); 208 this.addEventListener('canceledit', this.onEditCancelled_.bind(this));
202 this.addEventListener('commitedit', this.onEditCommitted_.bind(this)); 209 this.addEventListener('commitedit', this.onEditCommitted_.bind(this));
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 }, 370 },
364 }; 371 };
365 372
366 // Export 373 // Export
367 return { 374 return {
368 SearchEngineList: SearchEngineList 375 SearchEngineList: SearchEngineList
369 }; 376 };
370 377
371 }); 378 });
372 379
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/inline_editable_list.js ('k') | ui/webui/resources/js/cr/ui/list.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698