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

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

Issue 2740863003: MD Bookmarks: Implement search and selection in new data flow system (Closed)
Patch Set: Review round 2 Created 3 years, 9 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 behaviors: [ 8 behaviors: [
9 bookmarks.StoreClient, 9 bookmarks.StoreClient,
10 ], 10 ],
11 11
12 properties: { 12 properties: {
13 /** @type {BookmarkNode} */ 13 /** @type {BookmarkNode} */
14 menuItem_: Object, 14 menuItem_: Object,
15 15
16 /** @type {Array<string>} */ 16 /** @private {Array<string>} */
17 displayedList: { 17 displayedList_: {
18 type: Array, 18 type: Array,
19 value: function() { 19 value: function() {
20 // Use an empty list during initialization so that the databinding to 20 // Use an empty list during initialization so that the databinding to
21 // hide #bookmarksCard takes effect. 21 // hide #bookmarksCard takes effect.
22 return []; 22 return [];
23 }, 23 },
24 }, 24 },
25 25
26 searchTerm: String, 26 /** @private */
27 searchTerm_: String,
27 }, 28 },
28 29
29 listeners: { 30 listeners: {
30 'open-item-menu': 'onOpenItemMenu_', 31 'open-item-menu': 'onOpenItemMenu_',
31 }, 32 },
32 33
33 attached: function() { 34 attached: function() {
34 this.watch('displayedList', function(state) { 35 this.watch('displayedList_', function(state) {
35 return bookmarks.util.getDisplayedList(state); 36 return bookmarks.util.getDisplayedList(state);
36 }); 37 });
38 this.watch('searchTerm_', function(state) {
39 return state.search.term;
40 });
37 this.updateFromStore(); 41 this.updateFromStore();
38 }, 42 },
39 43
40 /** 44 /**
41 * @param {Event} e 45 * @param {Event} e
42 * @private 46 * @private
43 */ 47 */
44 onOpenItemMenu_: function(e) { 48 onOpenItemMenu_: function(e) {
45 this.menuItem_ = e.detail.item; 49 this.menuItem_ = e.detail.item;
46 var menu = /** @type {!CrActionMenuElement} */ ( 50 var menu = /** @type {!CrActionMenuElement} */ (
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 }, 110 },
107 111
108 /** @private */ 112 /** @private */
109 getEditorTitle_: function() { 113 getEditorTitle_: function() {
110 var title = this.menuItem_.url ? 'editBookmarkTitle' : 'renameFolderTitle'; 114 var title = this.menuItem_.url ? 'editBookmarkTitle' : 'renameFolderTitle';
111 return loadTimeData.getString(title); 115 return loadTimeData.getString(title);
112 }, 116 },
113 117
114 /** @private */ 118 /** @private */
115 emptyListMessage_: function() { 119 emptyListMessage_: function() {
116 var emptyListMessage = this.searchTerm ? 'noSearchResults' : 'emptyList'; 120 var emptyListMessage = this.searchTerm_ ? 'noSearchResults' : 'emptyList';
117 return loadTimeData.getString(emptyListMessage); 121 return loadTimeData.getString(emptyListMessage);
118 }, 122 },
119 123
120 /** @private */ 124 /** @private */
121 isEmptyList_: function() { 125 isEmptyList_: function() {
122 return this.displayedList.length == 0; 126 return this.displayedList_.length == 0;
123 }, 127 },
124 }); 128 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/md_bookmarks/list.html ('k') | chrome/browser/resources/md_bookmarks/reducers.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698