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

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

Issue 47033003: Fix "Set pages" drop crash by changing outside drags to simply add a new URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options/startup_page_list_browsertest.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 return; 239 return;
240 } 240 }
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 chrome.send('dragDropStartupPage', 249 // If there are selected indexes, it was a re-order.
250 [newIndex, this.selectionModel.selectedIndexes]); 250 if (this.selectionModel.selectedIndexes.length > 0) {
251 chrome.send('dragDropStartupPage',
252 [newIndex, this.selectionModel.selectedIndexes]);
253 return;
254 }
255
256 // Otherwise it was potentially a drop of new data (e.g. a bookmark).
257 var url = e.dataTransfer.getData('url');
258 if (url) {
259 e.preventDefault();
260 chrome.send('addStartupPage', [url, newIndex]);
261 }
251 }, 262 },
252 263
253 /** 264 /**
254 * Handles the dragleave event. 265 * Handles the dragleave event.
255 * @param {Event} e The dragleave event. 266 * @param {Event} e The dragleave event.
256 * @private 267 * @private
257 */ 268 */
258 handleDragLeave_: function(e) { 269 handleDragLeave_: function(e) {
259 this.hideDropMarker_(); 270 this.hideDropMarker_();
260 }, 271 },
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 this.hideDropMarkerTimer_ = window.setTimeout(function() { 312 this.hideDropMarkerTimer_ = window.setTimeout(function() {
302 $('startupPagesListDropmarker').style.display = ''; 313 $('startupPagesListDropmarker').style.display = '';
303 }, 100); 314 }, 100);
304 }, 315 },
305 }; 316 };
306 317
307 return { 318 return {
308 StartupPageList: StartupPageList 319 StartupPageList: StartupPageList
309 }; 320 };
310 }); 321 });
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options/startup_page_list_browsertest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698