| OLD | NEW |
| 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-folder-node', | 6 is: 'bookmarks-folder-node', |
| 7 | 7 |
| 8 behaviors: [ | 8 behaviors: [ |
| 9 bookmarks.MouseFocusBehavior, | 9 bookmarks.MouseFocusBehavior, |
| 10 bookmarks.StoreClient, | 10 bookmarks.StoreClient, |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 252 /** | 252 /** |
| 253 * @private | 253 * @private |
| 254 * @return {string} | 254 * @return {string} |
| 255 */ | 255 */ |
| 256 getFolderIcon_: function() { | 256 getFolderIcon_: function() { |
| 257 return this.isSelectedFolder_ ? 'bookmarks:folder-open' : 'cr:folder'; | 257 return this.isSelectedFolder_ ? 'bookmarks:folder-open' : 'cr:folder'; |
| 258 }, | 258 }, |
| 259 | 259 |
| 260 /** @private */ | 260 /** @private */ |
| 261 selectFolder_: function() { | 261 selectFolder_: function() { |
| 262 this.dispatch( | 262 if (!this.isSelectedFolder_) { |
| 263 bookmarks.actions.selectFolder(this.item_.id, this.getState().nodes)); | 263 this.dispatch( |
| 264 bookmarks.actions.selectFolder(this.itemId, this.getState().nodes)); |
| 265 } |
| 264 }, | 266 }, |
| 265 | 267 |
| 266 /** | 268 /** |
| 269 * @param {!Event} e |
| 270 * @private |
| 271 */ |
| 272 onContextMenu_: function(e) { |
| 273 e.preventDefault(); |
| 274 this.selectFolder_(); |
| 275 bookmarks.CommandManager.getInstance().openCommandMenuAtPosition( |
| 276 e.clientX, e.clientY, new Set([this.itemId])); |
| 277 }, |
| 278 |
| 279 /** |
| 267 * @private | 280 * @private |
| 268 * @return {!Array<!BookmarksFolderNodeElement>} | 281 * @return {!Array<!BookmarksFolderNodeElement>} |
| 269 */ | 282 */ |
| 270 getChildFolderNodes_: function() { | 283 getChildFolderNodes_: function() { |
| 271 return Array.from(this.root.querySelectorAll('bookmarks-folder-node')); | 284 return Array.from(this.root.querySelectorAll('bookmarks-folder-node')); |
| 272 }, | 285 }, |
| 273 | 286 |
| 274 /** | 287 /** |
| 275 * Occurs when the drop down arrow is tapped. | 288 * Occurs when the drop down arrow is tapped. |
| 276 * @private | 289 * @private |
| 277 * @param {!Event} e | 290 * @param {!Event} e |
| 278 */ | 291 */ |
| 279 toggleFolder_: function(e) { | 292 toggleFolder_: function(e) { |
| 280 this.dispatch( | 293 this.dispatch( |
| 281 bookmarks.actions.changeFolderOpen(this.item_.id, this.isClosed_)); | 294 bookmarks.actions.changeFolderOpen(this.itemId, this.isClosed_)); |
| 282 e.stopPropagation(); | 295 e.stopPropagation(); |
| 283 }, | 296 }, |
| 284 | 297 |
| 285 /** | 298 /** |
| 286 * @private | 299 * @private |
| 287 * @param {!Event} e | 300 * @param {!Event} e |
| 288 */ | 301 */ |
| 289 preventDefault_: function(e) { | 302 preventDefault_: function(e) { |
| 290 e.preventDefault(); | 303 e.preventDefault(); |
| 291 }, | 304 }, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 339 }, | 352 }, |
| 340 | 353 |
| 341 /** | 354 /** |
| 342 * @private | 355 * @private |
| 343 * @return {string} | 356 * @return {string} |
| 344 */ | 357 */ |
| 345 getTabIndex_: function() { | 358 getTabIndex_: function() { |
| 346 return this.isSelectedFolder_ ? '0' : '-1'; | 359 return this.isSelectedFolder_ ? '0' : '-1'; |
| 347 }, | 360 }, |
| 348 }); | 361 }); |
| OLD | NEW |