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: 'history-synced-device-card', | 6 is: 'history-synced-device-card', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 // Name of the synced device. | 9 // Name of the synced device. |
| 10 device: {type: String, value: ''}, | 10 device: {type: String, value: ''}, |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 27 * separate array here is necessary for window separators to appear | 27 * separate array here is necessary for window separators to appear |
| 28 * correctly in search. See http://crrev.com/2022003002 for more details. | 28 * correctly in search. See http://crrev.com/2022003002 for more details. |
| 29 * @type {!Array<number>} | 29 * @type {!Array<number>} |
| 30 */ | 30 */ |
| 31 separatorIndexes: Array, | 31 separatorIndexes: Array, |
| 32 | 32 |
| 33 // Whether the card is open. | 33 // Whether the card is open. |
| 34 cardOpen_: {type: Boolean, value: true}, | 34 cardOpen_: {type: Boolean, value: true}, |
| 35 | 35 |
| 36 searchTerm: String, | 36 searchTerm: String, |
| 37 | |
| 38 windowId: Number, | |
|
tsergeant
2016/07/22 03:21:17
Nit: Newline between these
calamity
2016/07/27 05:22:07
Done.
| |
| 39 sessionTag: String, | |
| 37 }, | 40 }, |
| 38 | 41 |
| 39 /** | 42 /** |
| 40 * Opens all the tabs displayed on the device in separate tabs. | 43 * Opens all the tabs displayed on the device in separate tabs. |
| 44 * @param {Event} e | |
| 41 * @private | 45 * @private |
| 42 */ | 46 */ |
| 43 openAllTabs_: function() { | 47 openAllTabs_: function(e) { |
|
tsergeant
2016/07/22 03:21:17
e is unused, you can get rid of it
calamity
2016/07/27 05:22:06
Done.
| |
| 44 // TODO(calamity): add a warning if an excessive number of tabs will open. | 48 md_history.BrowserService.getInstance().openForeignSessionAllTabs( |
| 45 for (var i = 0; i < this.tabs.length; i++) | 49 this.sessionTag); |
| 46 window.open(this.tabs[i].url, '_blank'); | |
| 47 }, | 50 }, |
| 48 | 51 |
| 49 /** | 52 /** |
| 53 * @param {Event} e | |
| 54 * @private | |
| 55 */ | |
| 56 openTab_: function(e) { | |
| 57 var currentTarget = e.currentTarget; | |
|
tsergeant
2016/07/22 03:21:17
You should be able to use `e.model` to avoid stick
calamity
2016/07/27 05:22:07
Done.
| |
| 58 md_history.BrowserService.getInstance().openForeignSessionTab( | |
| 59 this.sessionTag, currentTarget.windowId, currentTarget.sessionId, e); | |
| 60 e.preventDefault(); | |
| 61 }, | |
| 62 | |
| 63 /** | |
| 50 * Toggles the dropdown display of synced tabs for each device card. | 64 * Toggles the dropdown display of synced tabs for each device card. |
| 51 */ | 65 */ |
| 52 toggleTabCard: function() { | 66 toggleTabCard: function() { |
| 53 this.$.collapse.toggle(); | 67 this.$.collapse.toggle(); |
| 54 this.$['dropdown-indicator'].icon = | 68 this.$['dropdown-indicator'].icon = |
| 55 this.$.collapse.opened ? 'cr:expand-less' : 'cr:expand-more'; | 69 this.$.collapse.opened ? 'cr:expand-less' : 'cr:expand-more'; |
| 56 }, | 70 }, |
| 57 | 71 |
| 58 /** | 72 /** |
| 59 * When the synced tab information is set, the icon associated with the tab | 73 * When the synced tab information is set, the icon associated with the tab |
| 60 * website is also set. | 74 * website is also set. |
| 61 * @private | 75 * @private |
| 62 */ | 76 */ |
| 63 updateIcons_: function() { | 77 updateIcons_: function() { |
| 64 this.async(function() { | 78 this.async(function() { |
| 65 var icons = Polymer.dom(this.root).querySelectorAll('.website-icon'); | 79 var icons = Polymer.dom(this.root).querySelectorAll('.website-icon'); |
| 66 | 80 |
| 67 for (var i = 0; i < this.tabs.length; i++) { | 81 for (var i = 0; i < this.tabs.length; i++) { |
| 68 icons[i].style.backgroundImage = | 82 icons[i].style.backgroundImage = |
| 69 cr.icon.getFaviconImageSet(this.tabs[i].url); | 83 cr.icon.getFaviconImageSet(this.tabs[i].url); |
| 70 } | 84 } |
| 71 }); | 85 }); |
| 72 }, | 86 }, |
| 73 | 87 |
| 74 /** @private */ | 88 /** @private */ |
| 75 isWindowSeparatorIndex_: function(index, separatorIndexes) { | 89 isWindowSeparatorIndex_: function(index, separatorIndexes) { |
| 76 return this.separatorIndexes.indexOf(index) != -1; | 90 return this.separatorIndexes.indexOf(index) != -1; |
| 77 } | 91 } |
| 78 }); | 92 }); |
| OLD | NEW |