Chromium Code Reviews| 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-item', | 6 is: 'bookmarks-item', |
| 7 | 7 |
| 8 behaviors: [ | 8 behaviors: [ |
| 9 bookmarks.StoreClient, | 9 bookmarks.StoreClient, |
| 10 ], | 10 ], |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 return this; | 68 return this; |
| 69 }, | 69 }, |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * @param {Event} e | 72 * @param {Event} e |
| 73 * @private | 73 * @private |
| 74 */ | 74 */ |
| 75 onContextMenu_: function(e) { | 75 onContextMenu_: function(e) { |
| 76 e.preventDefault(); | 76 e.preventDefault(); |
| 77 if (!this.isSelectedItem_) { | 77 if (!this.isSelectedItem_) { |
| 78 this.dispatch(bookmarks.actions.selectItem( | 78 this.dispatch(bookmarks.actions.selectItem(this.itemId, this.getState(), { |
|
tsergeant
2017/05/18 23:13:37
I think it would be nice to pull out this and the
calamity
2017/05/19 06:46:56
Done.
| |
| 79 this.itemId, false, false, this.getState())); | 79 add: false, |
| 80 range: false, | |
| 81 toggle: false, | |
| 82 updateAnchor: true, | |
| 83 })); | |
| 80 } | 84 } |
| 81 this.fire('open-item-menu', { | 85 this.fire('open-item-menu', { |
| 82 x: e.clientX, | 86 x: e.clientX, |
| 83 y: e.clientY, | 87 y: e.clientY, |
| 84 }); | 88 }); |
| 85 }, | 89 }, |
| 86 | 90 |
| 87 /** | 91 /** |
| 88 * @param {Event} e | 92 * @param {Event} e |
| 89 * @private | 93 * @private |
| 90 */ | 94 */ |
| 91 onMenuButtonClick_: function(e) { | 95 onMenuButtonClick_: function(e) { |
| 92 e.stopPropagation(); | 96 e.stopPropagation(); |
| 93 this.dispatch(bookmarks.actions.selectItem( | 97 this.dispatch(bookmarks.actions.selectItem(this.itemId, this.getState(), { |
| 94 this.itemId, false, false, this.getState())); | 98 add: false, |
| 99 range: false, | |
| 100 toggle: false, | |
| 101 updateAnchor: true, | |
| 102 })); | |
| 95 this.fire('open-item-menu', { | 103 this.fire('open-item-menu', { |
| 96 targetElement: e.target, | 104 targetElement: e.target, |
| 97 }); | 105 }); |
| 98 }, | 106 }, |
| 99 | 107 |
| 100 /** | 108 /** |
| 101 * @param {Event} e | 109 * @param {Event} e |
| 102 * @private | 110 * @private |
| 103 */ | 111 */ |
| 104 onMenuButtonDblClick_: function(e) { | 112 onMenuButtonDblClick_: function(e) { |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 130 */ | 138 */ |
| 131 onItemBlur_: function() { | 139 onItemBlur_: function() { |
| 132 this.mouseFocus_ = false; | 140 this.mouseFocus_ = false; |
| 133 }, | 141 }, |
| 134 | 142 |
| 135 /** | 143 /** |
| 136 * @param {Event} e | 144 * @param {Event} e |
| 137 * @private | 145 * @private |
| 138 */ | 146 */ |
| 139 onClick_: function(e) { | 147 onClick_: function(e) { |
| 140 this.dispatch(bookmarks.actions.selectItem( | 148 this.dispatch(bookmarks.actions.selectItem(this.itemId, this.getState(), { |
| 141 this.itemId, e.ctrlKey, e.shiftKey, this.getState())); | 149 add: e.ctrlKey, |
| 150 range: e.shiftKey, | |
| 151 toggle: e.ctrlKey && !e.shiftKey, | |
| 152 updateAnchor: !e.shiftKey, | |
| 153 })); | |
| 142 e.stopPropagation(); | 154 e.stopPropagation(); |
| 143 }, | 155 }, |
| 144 | 156 |
| 145 /** | 157 /** |
| 146 * @param {Event} e | 158 * @param {Event} e |
| 147 * @private | 159 * @private |
| 148 */ | 160 */ |
| 149 onDblClick_: function(e) { | 161 onDblClick_: function(e) { |
| 150 if (!this.item_.url) { | 162 if (!this.item_.url) { |
| 151 this.dispatch( | 163 this.dispatch( |
| 152 bookmarks.actions.selectFolder(this.item_.id, this.getState().nodes)); | 164 bookmarks.actions.selectFolder(this.item_.id, this.getState().nodes)); |
| 153 } else { | 165 } else { |
| 154 chrome.tabs.create({url: this.item_.url}); | 166 chrome.tabs.create({url: this.item_.url}); |
| 155 } | 167 } |
| 156 }, | 168 }, |
| 157 | 169 |
| 158 /** | 170 /** |
| 159 * @param {string} url | 171 * @param {string} url |
| 160 * @private | 172 * @private |
| 161 */ | 173 */ |
| 162 updateFavicon_: function(url) { | 174 updateFavicon_: function(url) { |
| 163 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); | 175 this.$.icon.style.backgroundImage = cr.icon.getFavicon(url); |
| 164 }, | 176 }, |
| 165 }); | 177 }); |
| OLD | NEW |