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

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

Issue 2939273002: DO NOT SUBMIT: what chrome/browser/resources/ could eventually look like with clang-format (Closed)
Patch Set: Created 3 years, 6 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 cr.define('options.browser_options', function() { 5 cr.define('options.browser_options', function() {
6 /** @const */ var AutocompleteList = cr.ui.AutocompleteList; 6 /** @const */ var AutocompleteList = cr.ui.AutocompleteList;
7 /** @const */ var InlineEditableItem = options.InlineEditableItem; 7 /** @const */ var InlineEditableItem = options.InlineEditableItem;
8 /** @const */ var InlineEditableItemList = options.InlineEditableItemList; 8 /** @const */ var InlineEditableItemList = options.InlineEditableItemList;
9 9
10 /** 10 /**
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 titleEl.title = pageInfo.tooltip; 61 titleEl.title = pageInfo.tooltip;
62 } 62 }
63 63
64 this.contentElement.appendChild(titleEl); 64 this.contentElement.appendChild(titleEl);
65 65
66 var urlEl = this.createEditableTextCell(pageInfo.url); 66 var urlEl = this.createEditableTextCell(pageInfo.url);
67 urlEl.className = 'url'; 67 urlEl.className = 'url';
68 urlEl.classList.add('weakrtl'); 68 urlEl.classList.add('weakrtl');
69 this.contentElement.appendChild(urlEl); 69 this.contentElement.appendChild(urlEl);
70 70
71 var urlField = /** @type {HTMLElement} */(urlEl.querySelector('input')); 71 var urlField = /** @type {HTMLElement} */ (urlEl.querySelector('input'));
72 urlField.className = 'weakrtl'; 72 urlField.className = 'weakrtl';
73 urlField.placeholder = loadTimeData.getString('startupPagesPlaceholder'); 73 urlField.placeholder = loadTimeData.getString('startupPagesPlaceholder');
74 this.urlField_ = urlField; 74 this.urlField_ = urlField;
75 75
76 this.addEventListener('commitedit', this.onEditCommitted_); 76 this.addEventListener('commitedit', this.onEditCommitted_);
77 77
78 var self = this; 78 var self = this;
79 urlField.addEventListener('focus', function(event) { 79 urlField.addEventListener('focus', function(event) {
80 self.parentNode.autocompleteList.attachToInput(urlField); 80 self.parentNode.autocompleteList.attachToInput(urlField);
81 }); 81 });
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 241
242 this.hideDropMarker_(); 242 this.hideDropMarker_();
243 243
244 // Insert the selection at the new position. 244 // Insert the selection at the new position.
245 var newIndex = this.dataModel.indexOf(dropTarget.pageInfo_); 245 var newIndex = this.dataModel.indexOf(dropTarget.pageInfo_);
246 if (this.dropPos == 'below') 246 if (this.dropPos == 'below')
247 newIndex += 1; 247 newIndex += 1;
248 248
249 // If there are selected indexes, it was a re-order. 249 // If there are selected indexes, it was a re-order.
250 if (this.selectionModel.selectedIndexes.length > 0) { 250 if (this.selectionModel.selectedIndexes.length > 0) {
251 chrome.send('dragDropStartupPage', 251 chrome.send(
252 [newIndex, this.selectionModel.selectedIndexes]); 252 'dragDropStartupPage',
253 [newIndex, this.selectionModel.selectedIndexes]);
253 return; 254 return;
254 } 255 }
255 256
256 // Otherwise it was potentially a drop of new data (e.g. a bookmark). 257 // Otherwise it was potentially a drop of new data (e.g. a bookmark).
257 var url = e.dataTransfer.getData('url'); 258 var url = e.dataTransfer.getData('url');
258 if (url) { 259 if (url) {
259 e.preventDefault(); 260 e.preventDefault();
260 chrome.send('addStartupPage', [url, newIndex]); 261 chrome.send('addStartupPage', [url, newIndex]);
261 } 262 }
262 }, 263 },
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 hideDropMarker_: function() { 309 hideDropMarker_: function() {
309 // Hide the marker in a timeout to reduce flickering as we move between 310 // Hide the marker in a timeout to reduce flickering as we move between
310 // valid drop targets. 311 // valid drop targets.
311 window.clearTimeout(this.hideDropMarkerTimer_); 312 window.clearTimeout(this.hideDropMarkerTimer_);
312 this.hideDropMarkerTimer_ = window.setTimeout(function() { 313 this.hideDropMarkerTimer_ = window.setTimeout(function() {
313 $('startupPagesListDropmarker').style.display = ''; 314 $('startupPagesListDropmarker').style.display = '';
314 }, 100); 315 }, 100);
315 }, 316 },
316 }; 317 };
317 318
318 return { 319 return {StartupPageList: StartupPageList};
319 StartupPageList: StartupPageList
320 };
321 }); 320 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698