| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 }, 50); | 462 }, 50); |
| 463 } | 463 } |
| 464 | 464 |
| 465 var doc = this.ownerDocument; | 465 var doc = this.ownerDocument; |
| 466 if (editing) { | 466 if (editing) { |
| 467 this.setAttribute('editing', ''); | 467 this.setAttribute('editing', ''); |
| 468 this.draggable = false; | 468 this.draggable = false; |
| 469 | 469 |
| 470 labelInput = doc.createElement('input'); | 470 labelInput = doc.createElement('input'); |
| 471 labelInput.placeholder = | 471 labelInput.placeholder = |
| 472 localStrings.getString('name_input_placeholder'); | 472 loadTimeData.getString('name_input_placeholder'); |
| 473 replaceAllChildren(labelEl, labelInput); | 473 replaceAllChildren(labelEl, labelInput); |
| 474 labelInput.value = title; | 474 labelInput.value = title; |
| 475 | 475 |
| 476 if (!isFolder) { | 476 if (!isFolder) { |
| 477 urlInput = doc.createElement('input'); | 477 urlInput = doc.createElement('input'); |
| 478 urlInput.type = 'url'; | 478 urlInput.type = 'url'; |
| 479 urlInput.required = true; | 479 urlInput.required = true; |
| 480 urlInput.placeholder = | 480 urlInput.placeholder = |
| 481 localStrings.getString('url_input_placeholder'); | 481 loadTimeData.getString('url_input_placeholder'); |
| 482 | 482 |
| 483 // We also need a name for the input for the CSS to work. | 483 // We also need a name for the input for the CSS to work. |
| 484 urlInput.name = '-url-input-' + cr.createUid(); | 484 urlInput.name = '-url-input-' + cr.createUid(); |
| 485 replaceAllChildren(urlEl, urlInput); | 485 replaceAllChildren(urlEl, urlInput); |
| 486 urlInput.value = url; | 486 urlInput.value = url; |
| 487 } | 487 } |
| 488 | 488 |
| 489 function stopPropagation(e) { | 489 function stopPropagation(e) { |
| 490 e.stopPropagation(); | 490 e.stopPropagation(); |
| 491 } | 491 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 | 532 |
| 533 // In case the item was removed before getting here we should | 533 // In case the item was removed before getting here we should |
| 534 // not alert. | 534 // not alert. |
| 535 if (listItem.parentNode) { | 535 if (listItem.parentNode) { |
| 536 // Select the item again. | 536 // Select the item again. |
| 537 var dataModel = this.parentNode.dataModel; | 537 var dataModel = this.parentNode.dataModel; |
| 538 var index = dataModel.indexOf(this.bookmarkNode); | 538 var index = dataModel.indexOf(this.bookmarkNode); |
| 539 var sm = this.parentNode.selectionModel; | 539 var sm = this.parentNode.selectionModel; |
| 540 sm.selectedIndex = sm.leadIndex = sm.anchorIndex = index; | 540 sm.selectedIndex = sm.leadIndex = sm.anchorIndex = index; |
| 541 | 541 |
| 542 alert(localStrings.getString('invalid_url')); | 542 alert(loadTimeData.getString('invalid_url')); |
| 543 } | 543 } |
| 544 urlInput.focus(); | 544 urlInput.focus(); |
| 545 urlInput.select(); | 545 urlInput.select(); |
| 546 return; | 546 return; |
| 547 } | 547 } |
| 548 newUrl = 'http://' + newUrl; | 548 newUrl = 'http://' + newUrl; |
| 549 } | 549 } |
| 550 urlEl.textContent = this.bookmarkNode.url = newUrl; | 550 urlEl.textContent = this.bookmarkNode.url = newUrl; |
| 551 } | 551 } |
| 552 | 552 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 566 } | 566 } |
| 567 } | 567 } |
| 568 } | 568 } |
| 569 }; | 569 }; |
| 570 | 570 |
| 571 return { | 571 return { |
| 572 BookmarkList: BookmarkList, | 572 BookmarkList: BookmarkList, |
| 573 list: list | 573 list: list |
| 574 }; | 574 }; |
| 575 }); | 575 }); |
| OLD | NEW |