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: { | 10 device: {type: String, value: ''}, |
11 type: String, | |
12 value: '' | |
13 }, | |
14 | 11 |
15 // When the device information was last updated. | 12 // When the device information was last updated. |
16 lastUpdateTime: { | 13 lastUpdateTime: {type: String, value: ''}, |
17 type: String, | |
18 value: '' | |
19 }, | |
20 | 14 |
21 /** | 15 /** |
22 * The list of tabs open for this device. | 16 * The list of tabs open for this device. |
23 * @type {!Array<!ForeignSessionTab>} | 17 * @type {!Array<!ForeignSessionTab>} |
24 */ | 18 */ |
25 tabs: { | 19 tabs: { |
26 type: Array, | 20 type: Array, |
27 value: function() { return []; }, | 21 value: function() { return []; }, |
28 observer: 'updateIcons_' | 22 observer: 'updateIcons_' |
29 }, | 23 }, |
30 | 24 |
| 25 /** |
| 26 * The indexes where a window separator should be shown. The use of a |
| 27 * separate array here is necessary for window separators to appear |
| 28 * correctly in search. See http://crrev.com/2022003002 for more details. |
| 29 * @type {!Array<number>} |
| 30 */ |
| 31 separatorIndexes: Array, |
| 32 |
31 // Whether the card is open. | 33 // Whether the card is open. |
32 cardOpen_: { | 34 cardOpen_: {type: Boolean, value: true}, |
33 type: Boolean, | |
34 value: true | |
35 }, | |
36 }, | 35 }, |
37 | 36 |
38 /** | 37 /** |
39 * Opens all the tabs displayed on the device in separate tabs. | 38 * Opens all the tabs displayed on the device in separate tabs. |
40 * @private | 39 * @private |
41 */ | 40 */ |
42 openAllTabs_: function() { | 41 openAllTabs_: function() { |
43 // TODO(calamity): add a warning if an excessive number of tabs will open. | 42 // TODO(calamity): add a warning if an excessive number of tabs will open. |
44 for (var i = 0; i < this.tabs.length; i++) | 43 for (var i = 0; i < this.tabs.length; i++) |
45 window.open(this.tabs[i].url, '_blank'); | 44 window.open(this.tabs[i].url, '_blank'); |
(...skipping 15 matching lines...) Expand all Loading... |
61 */ | 60 */ |
62 updateIcons_: function() { | 61 updateIcons_: function() { |
63 this.async(function() { | 62 this.async(function() { |
64 var icons = Polymer.dom(this.root).querySelectorAll('.website-icon'); | 63 var icons = Polymer.dom(this.root).querySelectorAll('.website-icon'); |
65 | 64 |
66 for (var i = 0; i < this.tabs.length; i++) { | 65 for (var i = 0; i < this.tabs.length; i++) { |
67 icons[i].style.backgroundImage = | 66 icons[i].style.backgroundImage = |
68 cr.icon.getFaviconImageSet(this.tabs[i].url); | 67 cr.icon.getFaviconImageSet(this.tabs[i].url); |
69 } | 68 } |
70 }); | 69 }); |
| 70 }, |
| 71 |
| 72 /** @private */ |
| 73 isWindowSeparatorIndex_: function(index, separatorIndexes) { |
| 74 return this.separatorIndexes.indexOf(index) != -1; |
71 } | 75 } |
72 }); | 76 }); |
OLD | NEW |