Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 Polymer({ | |
| 6 is: 'synced-device-card', | |
| 7 | |
| 8 properties: { | |
| 9 // The name of the synced tab device. | |
|
calamity
2016/02/02 04:09:48
nit: synced device.
yingran
2016/02/09 04:21:34
Done.
| |
| 10 device: { | |
| 11 type: String, | |
| 12 value: '' | |
| 13 }, | |
| 14 // The approximate time of when the tabs on the device was last updated. | |
|
calamity
2016/02/02 04:09:48
// When the device information was last updated.
yingran
2016/02/09 04:21:34
Done.
| |
| 15 lastUpdateTime: { | |
| 16 type: String, | |
| 17 value: '' | |
| 18 }, | |
| 19 // The list of tabs open for each synced device. | |
|
calamity
2016/02/02 04:09:48
for this device.
yingran
2016/02/09 04:21:34
Done.
| |
| 20 tabs: { | |
| 21 type: Array, | |
| 22 value: [], | |
|
calamity
2016/02/02 04:09:47
Does this do that wacky static thing? Should this
tsergeant
2016/02/03 03:00:00
Apparently, yes.
yingran
2016/02/09 04:21:34
Done.
| |
| 23 observer: 'updateIcons_' | |
| 24 }, | |
| 25 // Whether the synced tab display for the device is open. | |
|
calamity
2016/02/02 04:09:48
// Whether this card is open.
yingran
2016/02/09 04:21:34
Done.
| |
| 26 cardOpen: { | |
| 27 type: Boolean, | |
| 28 value: true | |
| 29 } | |
| 30 }, | |
| 31 | |
| 32 /** | |
| 33 * Opens all the tabs displayed on the synced device card in separate tabs on | |
| 34 * the user's browser. | |
| 35 * @private | |
| 36 */ | |
| 37 openAllTabs_: function() { | |
| 38 for (var i = 0; i < this.tabs.length; i++) { | |
| 39 window.open(this.tabs[i].url, '_blank'); | |
| 40 } | |
|
calamity
2016/02/02 04:09:47
Why not use normal history's implementation?
See
yingran
2016/02/09 04:21:34
Is there a place where I can see what I have to in
| |
| 41 }, | |
| 42 | |
| 43 /** | |
| 44 * Toggles the dropdown display of synced tabs for each device card. | |
| 45 */ | |
| 46 toggleTabCard: function() { | |
| 47 this.$.collapse.toggle(); | |
| 48 this.$$('#dropdown-indicator').icon = | |
| 49 ((this.$$('#dropdown-indicator').icon == 'expand-less') ? | |
|
calamity
2016/02/02 04:09:48
Use this.$.collapse.opened.
yingran
2016/02/09 04:21:34
Done.
| |
| 50 'expand-more' : 'expand-less'); | |
| 51 }, | |
| 52 | |
| 53 /** | |
| 54 * Converst a boolean to a string. | |
|
calamity
2016/02/02 04:09:47
Letters reverst.
yingran
2016/02/09 04:21:34
=___=
calamity
2016/02/11 00:23:30
ಠ_ಠ
| |
| 55 * @param {boolean} opened Whether the synced tab display is expanded. | |
| 56 * @return {string} opened The state of the synced tab display. | |
| 57 */ | |
| 58 isExpanded: function(opened) { | |
| 59 return String(opened); | |
| 60 }, | |
| 61 | |
| 62 /** | |
| 63 * When the synced tab information is set, the icon associated with the tab | |
| 64 * website is also set. | |
| 65 * @private | |
| 66 */ | |
| 67 updateIcons_: function() { | |
| 68 this.async(function() { | |
| 69 var icons = Polymer.dom(this.root).querySelectorAll('.website-icon'); | |
| 70 | |
| 71 for (var i = 0; i < this.tabs.length; i++) { | |
| 72 icons[i].style.backgroundImage = | |
| 73 getFaviconImageSet(this.tabs[i].url); | |
| 74 } | |
| 75 }); | |
| 76 } | |
| 77 }); | |
| OLD | NEW |