OLD | NEW |
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 Loading... |
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 Loading... |
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 }); |
OLD | NEW |