Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
|
calamity
2017/03/20 05:04:50
Sooo last year.
tsergeant
2017/03/20 06:03:18
Done.
| |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 Polymer({ | |
| 6 is: 'bookmarks-edit-dialog', | |
| 7 | |
| 8 properties: { | |
| 9 /** @private {BookmarkNode} */ | |
| 10 editItem_: Object, | |
| 11 | |
| 12 /** @private */ | |
| 13 isFolder_: Boolean, | |
| 14 | |
| 15 /** @private */ | |
| 16 titleValue_: String, | |
| 17 | |
| 18 /** @private */ | |
| 19 urlValue_: String, | |
| 20 }, | |
| 21 | |
| 22 /** @param {BookmarkNode} editItem */ | |
| 23 editNode: function(editItem) { | |
|
calamity
2017/03/20 05:04:50
I think I'd prefer showForNode. It's not obvious t
tsergeant
2017/03/20 06:03:18
The difficulty with naming this is that there'll e
calamity
2017/03/22 00:36:50
Oh, I didn't realize this would be getting the add
tsergeant
2017/03/22 00:53:22
-> Cancel and Save are the button names for the na
| |
| 24 this.editItem_ = editItem; | |
| 25 this.isFolder_ = !editItem.url; | |
| 26 | |
| 27 this.titleValue_ = editItem.title; | |
| 28 if (!this.isFolder_) | |
| 29 this.urlValue_ = assert(editItem.url); | |
| 30 | |
| 31 this.$.dialog.showModal(); | |
| 32 }, | |
| 33 | |
| 34 /** | |
| 35 * @param {boolean} isFolder | |
| 36 * @return {string} | |
| 37 * @private | |
| 38 */ | |
| 39 getDialogTitle_: function(isFolder) { | |
| 40 return loadTimeData.getString( | |
| 41 isFolder ? 'renameFolderTitle' : 'editBookmarkTitle'); | |
| 42 }, | |
| 43 | |
| 44 /** @private */ | |
| 45 onSaveEditTap_: function() { | |
| 46 // TODO(tsergeant): Verify values. | |
| 47 var edit = {'title': this.titleValue_}; | |
| 48 if (!this.isFolder_) | |
| 49 edit['url'] = this.urlValue_; | |
| 50 | |
| 51 chrome.bookmarks.update(this.editItem_.id, edit); | |
| 52 this.$.dialog.close(); | |
| 53 }, | |
| 54 | |
| 55 /** @private */ | |
| 56 onCancelEditTap_: function() { | |
| 57 this.$.dialog.cancel(); | |
| 58 }, | |
|
calamity
2017/03/20 05:04:50
Can has Press enter to save?
tsergeant
2017/03/20 06:03:18
Yup, this constantly annoys me.
I've added a TODO
calamity
2017/03/22 00:36:50
Acknowledged.
| |
| 59 }); | |
| OLD | NEW |