blob: 365487a55254e8aa6b0366b8384f00ed68f0fa64 [file] [log] [blame]
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
Polymer({
is: 'bookmarks-list',
behaviors: [
bookmarks.StoreClient,
],
properties: {
/** @private {Array<string>} */
displayedList_: {
type: Array,
value: function() {
// Use an empty list during initialization so that the databinding to
// hide #bookmarksCard takes effect.
return [];
},
},
/** @private */
searchTerm_: String,
},
listeners: {
'click': 'deselectItems_',
},
attached: function() {
this.watch('displayedList_', function(state) {
return bookmarks.util.getDisplayedList(state);
});
this.watch('searchTerm_', function(state) {
return state.search.term;
});
this.updateFromStore();
},
getDropTarget: function() {
return this.$.message;
},
/** @private */
emptyListMessage_: function() {
var emptyListMessage = this.searchTerm_ ? 'noSearchResults' : 'emptyList';
return loadTimeData.getString(emptyListMessage);
},
/** @private */
isEmptyList_: function() {
return this.displayedList_.length == 0;
},
/** @private */
deselectItems_: function() {
this.dispatch(bookmarks.actions.deselectItems());
},
});