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, |
| 39 |
| 40 sessionTag: String, |
37 }, | 41 }, |
38 | 42 |
39 /** | 43 /** |
40 * Opens all the tabs displayed on the device in separate tabs. | 44 * Opens all the tabs displayed on the device in separate tabs. |
41 * @private | 45 * @private |
42 */ | 46 */ |
43 openAllTabs_: function() { | 47 openAllTabs_: function() { |
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 {TapEvent} e |
| 54 * @private |
| 55 */ |
| 56 openTab_: function(e) { |
| 57 var model = /** @type {ForeignSessionTab} */(e.model); |
| 58 var srcEvent = /** @type {Event} */(e.detail.sourceEvent); |
| 59 md_history.BrowserService.getInstance().openForeignSessionTab( |
| 60 this.sessionTag, model.windowId, model.sessionId, srcEvent); |
| 61 e.preventDefault(); |
| 62 }, |
| 63 |
| 64 /** |
50 * Toggles the dropdown display of synced tabs for each device card. | 65 * Toggles the dropdown display of synced tabs for each device card. |
51 */ | 66 */ |
52 toggleTabCard: function() { | 67 toggleTabCard: function() { |
53 this.$.collapse.toggle(); | 68 this.$.collapse.toggle(); |
54 this.$['dropdown-indicator'].icon = | 69 this.$['dropdown-indicator'].icon = |
55 this.$.collapse.opened ? 'cr:expand-less' : 'cr:expand-more'; | 70 this.$.collapse.opened ? 'cr:expand-less' : 'cr:expand-more'; |
56 }, | 71 }, |
57 | 72 |
58 /** | 73 /** |
59 * When the synced tab information is set, the icon associated with the tab | 74 * When the synced tab information is set, the icon associated with the tab |
60 * website is also set. | 75 * website is also set. |
61 * @private | 76 * @private |
62 */ | 77 */ |
63 updateIcons_: function() { | 78 updateIcons_: function() { |
64 this.async(function() { | 79 this.async(function() { |
65 var icons = Polymer.dom(this.root).querySelectorAll('.website-icon'); | 80 var icons = Polymer.dom(this.root).querySelectorAll('.website-icon'); |
66 | 81 |
67 for (var i = 0; i < this.tabs.length; i++) { | 82 for (var i = 0; i < this.tabs.length; i++) { |
68 icons[i].style.backgroundImage = | 83 icons[i].style.backgroundImage = |
69 cr.icon.getFaviconImageSet(this.tabs[i].url); | 84 cr.icon.getFaviconImageSet(this.tabs[i].url); |
70 } | 85 } |
71 }); | 86 }); |
72 }, | 87 }, |
73 | 88 |
74 /** @private */ | 89 /** @private */ |
75 isWindowSeparatorIndex_: function(index, separatorIndexes) { | 90 isWindowSeparatorIndex_: function(index, separatorIndexes) { |
76 return this.separatorIndexes.indexOf(index) != -1; | 91 return this.separatorIndexes.indexOf(index) != -1; |
77 } | 92 } |
78 }); | 93 }); |
OLD | NEW |