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

Unified Diff: chrome/browser/resources/md_bookmarks/item.js

Issue 2735953002: MD Bookmarks: Integrate new data store with UI elements (Closed)
Patch Set: calamity@ review 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/resources/md_bookmarks/item.html ('k') | chrome/browser/resources/md_bookmarks/list.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/resources/md_bookmarks/item.js
diff --git a/chrome/browser/resources/md_bookmarks/item.js b/chrome/browser/resources/md_bookmarks/item.js
index b75eb60de66bcab9440193406fa7a755ff258a94..16a525ba02031a9c608cbe9bcca92dab58bb40d0 100644
--- a/chrome/browser/resources/md_bookmarks/item.js
+++ b/chrome/browser/resources/md_bookmarks/item.js
@@ -5,23 +5,34 @@
Polymer({
is: 'bookmarks-item',
+ behaviors: [
+ bookmarks.StoreClient,
+ ],
+
properties: {
- /** @type {BookmarkTreeNode} */
- item: {
+ itemId: {
+ type: String,
+ observer: 'updateFromStore',
+ },
+
+ /** @private {BookmarkNode} */
+ item_: {
type: Object,
observer: 'onItemChanged_',
},
- isFolder_: Boolean,
-
- isSelectedItem: {
+ /** @private */
+ isSelectedItem_: {
type: Boolean,
reflectToAttribute: true,
},
+
+ /** @private */
+ isFolder_: Boolean,
},
observers: [
- 'updateFavicon_(item.url)',
+ 'updateFavicon_(item_.url)',
],
listeners: {
@@ -29,6 +40,14 @@ Polymer({
'dblclick': 'onDblClick_',
},
+ attached: function() {
+ this.watch('item_', function(store) {
+ return store.nodes[this.itemId];
+ }.bind(this));
+
+ this.updateFromStore();
+ },
+
/**
* @param {Event} e
* @private
@@ -37,13 +56,13 @@ Polymer({
e.stopPropagation();
this.fire('open-item-menu', {
target: e.target,
- item: this.item,
+ item: this.item_,
});
},
/** @private */
onItemChanged_: function() {
- this.isFolder_ = !(this.item.url);
+ this.isFolder_ = !(this.item_.url);
},
/**
@@ -52,7 +71,7 @@ Polymer({
*/
onClick_: function(e) {
this.fire('select-item', {
- item: this.item,
+ item: this.item_,
range: e.shiftKey,
add: e.ctrlKey,
});
@@ -63,10 +82,10 @@ Polymer({
* @private
*/
onDblClick_: function(e) {
- if (!this.item.url)
- this.fire('selected-folder-changed', this.item.id);
+ if (!this.item_.url)
+ this.dispatch(bookmarks.actions.selectFolder(this.item_.id));
else
- chrome.tabs.create({url: this.item.url});
+ chrome.tabs.create({url: this.item_.url});
},
/**
« no previous file with comments | « chrome/browser/resources/md_bookmarks/item.html ('k') | chrome/browser/resources/md_bookmarks/list.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698