OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 AutocompleteList = options.AutocompleteList; | 6 const AutocompleteList = options.AutocompleteList; |
7 const InlineEditableItem = options.InlineEditableItem; | 7 const InlineEditableItem = options.InlineEditableItem; |
8 const InlineEditableItemList = options.InlineEditableItemList; | 8 const InlineEditableItemList = options.InlineEditableItemList; |
9 | 9 |
10 /** | 10 /** |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 this.addEventListener('commitedit', this.onEditCommitted_); | 77 this.addEventListener('commitedit', this.onEditCommitted_); |
78 | 78 |
79 var self = this; | 79 var self = this; |
80 urlField.addEventListener('focus', function(event) { | 80 urlField.addEventListener('focus', function(event) { |
81 self.parentNode.autocompleteList.attachToInput(urlField); | 81 self.parentNode.autocompleteList.attachToInput(urlField); |
82 }); | 82 }); |
83 urlField.addEventListener('blur', function(event) { | 83 urlField.addEventListener('blur', function(event) { |
84 self.parentNode.autocompleteList.detach(); | 84 self.parentNode.autocompleteList.detach(); |
85 }); | 85 }); |
| 86 |
86 this.draggable = true; | 87 this.draggable = true; |
87 }, | 88 }, |
88 | 89 |
89 /** @inheritDoc */ | 90 /** @inheritDoc */ |
90 get currentInputIsValid() { | 91 get currentInputIsValid() { |
91 return this.urlField_.validity.valid; | 92 return this.urlField_.validity.valid; |
92 }, | 93 }, |
93 | 94 |
94 /** @inheritDoc */ | 95 /** @inheritDoc */ |
95 get hasBeenEdited() { | 96 get hasBeenEdited() { |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 } | 165 } |
165 return target; | 166 return target; |
166 }, | 167 }, |
167 | 168 |
168 /* | 169 /* |
169 * Handles the dragstart event. | 170 * Handles the dragstart event. |
170 * @param {Event} e The dragstart event. | 171 * @param {Event} e The dragstart event. |
171 * @private | 172 * @private |
172 */ | 173 */ |
173 handleDragStart_: function(e) { | 174 handleDragStart_: function(e) { |
| 175 // Prevent dragging if the list is disabled. |
| 176 if (this.disabled) { |
| 177 e.preventDefault(); |
| 178 return false; |
| 179 } |
| 180 |
174 var target = e.target; | 181 var target = e.target; |
175 // StartupPageListItem should be the only draggable element type in the | 182 // StartupPageListItem should be the only draggable element type in the |
176 // page but let's make sure. | 183 // page but let's make sure. |
177 if (target instanceof StartupPageListItem) { | 184 if (target instanceof StartupPageListItem) { |
178 this.draggedItem = target; | 185 this.draggedItem = target; |
179 this.draggedItem.editable = false; | 186 this.draggedItem.editable = false; |
180 e.dataTransfer.effectAllowed = 'move'; | 187 e.dataTransfer.effectAllowed = 'move'; |
181 // We need to put some kind of data in the drag or it will be | 188 // We need to put some kind of data in the drag or it will be |
182 // ignored. Use the URL in case the user drags to a text field or the | 189 // ignored. Use the URL in case the user drags to a text field or the |
183 // desktop. | 190 // desktop. |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 this.hideDropMarkerTimer_ = window.setTimeout(function() { | 300 this.hideDropMarkerTimer_ = window.setTimeout(function() { |
294 $('startupPagesListDropmarker').style.display = ''; | 301 $('startupPagesListDropmarker').style.display = ''; |
295 }, 100); | 302 }, 100); |
296 }, | 303 }, |
297 }; | 304 }; |
298 | 305 |
299 return { | 306 return { |
300 StartupPageList: StartupPageList | 307 StartupPageList: StartupPageList |
301 }; | 308 }; |
302 }); | 309 }); |
OLD | NEW |