Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4160)

Unified Diff: chrome/browser/resources/md_history/synced_device_card.js

Issue 1607403004: MD History: Display synced tabs history (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@second_patch
Patch Set: Style fixes & having no synced history will hide the sidebar Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/md_history/synced_device_card.js
diff --git a/chrome/browser/resources/md_history/synced_device_card.js b/chrome/browser/resources/md_history/synced_device_card.js
new file mode 100644
index 0000000000000000000000000000000000000000..fff412a7615e24e55e4dbfa66aed7d349e79497e
--- /dev/null
+++ b/chrome/browser/resources/md_history/synced_device_card.js
@@ -0,0 +1,77 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+Polymer({
+ is: 'synced-device-card',
+
+ properties: {
+ // 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.
+ device: {
+ type: String,
+ value: ''
+ },
+ // 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.
+ lastUpdateTime: {
+ type: String,
+ value: ''
+ },
+ // 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.
+ tabs: {
+ type: Array,
+ 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.
+ observer: 'updateIcons_'
+ },
+ // 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.
+ cardOpen: {
+ type: Boolean,
+ value: true
+ }
+ },
+
+ /**
+ * Opens all the tabs displayed on the synced device card in separate tabs on
+ * the user's browser.
+ * @private
+ */
+ openAllTabs_: function() {
+ for (var i = 0; i < this.tabs.length; i++) {
+ window.open(this.tabs[i].url, '_blank');
+ }
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
+ },
+
+ /**
+ * Toggles the dropdown display of synced tabs for each device card.
+ */
+ toggleTabCard: function() {
+ this.$.collapse.toggle();
+ this.$$('#dropdown-indicator').icon =
+ ((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.
+ 'expand-more' : 'expand-less');
+ },
+
+ /**
+ * 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 ಠ_ಠ
+ * @param {boolean} opened Whether the synced tab display is expanded.
+ * @return {string} opened The state of the synced tab display.
+ */
+ isExpanded: function(opened) {
+ return String(opened);
+ },
+
+ /**
+ * When the synced tab information is set, the icon associated with the tab
+ * website is also set.
+ * @private
+ */
+ updateIcons_: function() {
+ this.async(function() {
+ var icons = Polymer.dom(this.root).querySelectorAll('.website-icon');
+
+ for (var i = 0; i < this.tabs.length; i++) {
+ icons[i].style.backgroundImage =
+ getFaviconImageSet(this.tabs[i].url);
+ }
+ });
+ }
+});

Powered by Google App Engine
This is Rietveld 408576698