Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: chrome/browser/resources/md_bookmarks/list.js

Issue 2614703003: [MD Bookmarks] Add search. (Closed)
Patch Set: Add search result refresh for bookmark editing. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 Polymer({ 5 Polymer({
6 is: 'bookmarks-list', 6 is: 'bookmarks-list',
7 7
8 properties: { 8 properties: {
9 /** @type {BookmarkTreeNode} */ 9 /** @type {BookmarkTreeNode} */
10 selectedNode: Object, 10 menuItem_: Object,
11 11
12 /** @type {BookmarkTreeNode} */ 12 /** @type {Array<BookmarkTreeNode>} */
13 menuItem_: Object, 13 displayedList: Array,
14 }, 14 },
15 15
16 listeners: { 16 listeners: {
17 'open-item-menu': 'onOpenItemMenu_', 17 'open-item-menu': 'onOpenItemMenu_',
18 }, 18 },
19 19
20 /** 20 /**
21 * @param {Event} e 21 * @param {Event} e
22 * @private 22 * @private
23 */ 23 */
(...skipping 16 matching lines...) Expand all
40 onCopyURLTap_: function() { 40 onCopyURLTap_: function() {
41 var idList = [this.menuItem_.id]; 41 var idList = [this.menuItem_.id];
42 chrome.bookmarkManagerPrivate.copy(idList, function() { 42 chrome.bookmarkManagerPrivate.copy(idList, function() {
43 // TODO(jiaxi): Add toast later. 43 // TODO(jiaxi): Add toast later.
44 }); 44 });
45 this.closeDropdownMenu_(); 45 this.closeDropdownMenu_();
46 }, 46 },
47 47
48 /** @private */ 48 /** @private */
49 onDeleteTap_: function() { 49 onDeleteTap_: function() {
50 if (this.menuItem_.children) { 50 if (this.menuItem_.url) {
51 chrome.bookmarks.remove(this.menuItem_.id, function() {
52 // TODO(jiaxi): Add toast later.
53 }.bind(this));
54 } else {
51 chrome.bookmarks.removeTree(this.menuItem_.id, function() { 55 chrome.bookmarks.removeTree(this.menuItem_.id, function() {
52 // TODO(jiaxi): Add toast later. 56 // TODO(jiaxi): Add toast later.
53 }.bind(this)); 57 }.bind(this));
54 } else {
55 chrome.bookmarks.remove(this.menuItem_.id, function() {
56 // TODO(jiaxi): Add toast later.
57 }.bind(this));
58 } 58 }
59 this.closeDropdownMenu_(); 59 this.closeDropdownMenu_();
60 }, 60 },
61 61
62 /** @private */ 62 /** @private */
63 onSaveEditTap_: function() { 63 onSaveEditTap_: function() {
64 chrome.bookmarks.update(this.menuItem_.id, { 64 chrome.bookmarks.update(this.menuItem_.id, {
65 'title': this.menuItem_.title, 65 'title': this.menuItem_.title,
66 'url': this.menuItem_.url, 66 'url': this.menuItem_.url,
67 }); 67 });
68 this.$.editBookmark.close(); 68 this.$.editBookmark.close();
69 }, 69 },
70 70
71 /** @private */ 71 /** @private */
72 onCancelEditTap_: function() { 72 onCancelEditTap_: function() {
73 this.$.editBookmark.cancel(); 73 this.$.editBookmark.cancel();
74 }, 74 },
75 75
76 /** @private */ 76 /** @private */
77 closeDropdownMenu_: function() { 77 closeDropdownMenu_: function() {
78 var menu = /** @type {!CrActionMenuElement} */ ( 78 var menu = /** @type {!CrActionMenuElement} */ (
79 this.$.dropdown); 79 this.$.dropdown);
80 menu.close(); 80 menu.close();
81 }, 81 },
82 82
83 /** @private */ 83 /** @private */
84 isListEmpty_: function() { 84 isListEmpty_: function() {
85 return this.selectedNode.children.length == 0; 85 return this.displayedList.length == 0;
86 } 86 }
87 }); 87 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698