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 // TODO(arv): Now that this is driven by a data model, implement a data model | 5 // TODO(arv): Now that this is driven by a data model, implement a data model |
6 // that handles the loading and the events from the bookmark backend. | 6 // that handles the loading and the events from the bookmark backend. |
7 | 7 |
8 cr.define('bmm', function() { | 8 cr.define('bmm', function() { |
9 var List = cr.ui.List; | 9 var List = cr.ui.List; |
10 var ListItem = cr.ui.ListItem; | 10 var ListItem = cr.ui.ListItem; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 this.removeEventListener('mouseup', this.handleMiddleMouseUp_); | 226 this.removeEventListener('mouseup', this.handleMiddleMouseUp_); |
227 if (e.button == 1) { | 227 if (e.button == 1) { |
228 var el = e.target; | 228 var el = e.target; |
229 while (el.parentNode != this) { | 229 while (el.parentNode != this) { |
230 el = el.parentNode; | 230 el = el.parentNode; |
231 } | 231 } |
232 var node = el.bookmarkNode; | 232 var node = el.bookmarkNode; |
233 if (node && !bmm.isFolder(node)) | 233 if (node && !bmm.isFolder(node)) |
234 this.dispatchUrlClickedEvent_(node.url, e); | 234 this.dispatchUrlClickedEvent_(node.url, e); |
235 } | 235 } |
| 236 e.preventDefault(); |
236 }, | 237 }, |
237 | 238 |
238 // Bookmark model update callbacks | 239 // Bookmark model update callbacks |
239 handleBookmarkChanged: function(id, changeInfo) { | 240 handleBookmarkChanged: function(id, changeInfo) { |
240 var dataModel = this.dataModel; | 241 var dataModel = this.dataModel; |
241 var index = dataModel.findIndexById(id); | 242 var index = dataModel.findIndexById(id); |
242 if (index != -1) { | 243 if (index != -1) { |
243 var bookmarkNode = this.dataModel.item(index); | 244 var bookmarkNode = this.dataModel.item(index); |
244 bookmarkNode.title = changeInfo.title; | 245 bookmarkNode.title = changeInfo.title; |
245 if ('url' in changeInfo) | 246 if ('url' in changeInfo) |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 } | 597 } |
597 } | 598 } |
598 } | 599 } |
599 }; | 600 }; |
600 | 601 |
601 return { | 602 return { |
602 BookmarkList: BookmarkList, | 603 BookmarkList: BookmarkList, |
603 list: list | 604 list: list |
604 }; | 605 }; |
605 }); | 606 }); |
OLD | NEW |