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: String, | 10 device: String, |
(...skipping 29 matching lines...) Expand all Loading... |
40 }, | 40 }, |
41 | 41 |
42 /** | 42 /** |
43 * Open a single synced tab. Listens to 'click' rather than 'tap' | 43 * Open a single synced tab. Listens to 'click' rather than 'tap' |
44 * to determine what modifier keys were pressed. | 44 * to determine what modifier keys were pressed. |
45 * @param {DomRepeatClickEvent} e | 45 * @param {DomRepeatClickEvent} e |
46 * @private | 46 * @private |
47 */ | 47 */ |
48 openTab_: function(e) { | 48 openTab_: function(e) { |
49 var tab = /** @type {ForeignSessionTab} */(e.model.tab); | 49 var tab = /** @type {ForeignSessionTab} */(e.model.tab); |
50 md_history.BrowserService.getInstance().openForeignSessionTab( | 50 var browserService = md_history.BrowserService.getInstance(); |
| 51 browserService.recordHistogram( |
| 52 SYNCED_TABS_HISTOGRAM_NAME, SyncedTabsHistogram.LINK_CLICKED, |
| 53 SyncedTabsHistogram.LIMIT); |
| 54 browserService.openForeignSessionTab( |
51 this.sessionTag, tab.windowId, tab.sessionId, e); | 55 this.sessionTag, tab.windowId, tab.sessionId, e); |
52 e.preventDefault(); | 56 e.preventDefault(); |
53 }, | 57 }, |
54 | 58 |
55 /** | 59 /** |
56 * Toggles the dropdown display of synced tabs for each device card. | 60 * Toggles the dropdown display of synced tabs for each device card. |
57 */ | 61 */ |
58 toggleTabCard: function() { | 62 toggleTabCard: function() { |
| 63 var histogramValue = this.$.collapse.opened ? |
| 64 SyncedTabsHistogram.COLLAPSE_SESSION : |
| 65 SyncedTabsHistogram.EXPAND_SESSION; |
| 66 |
| 67 md_history.BrowserService.getInstance().recordHistogram( |
| 68 SYNCED_TABS_HISTOGRAM_NAME, histogramValue, |
| 69 SyncedTabsHistogram.LIMIT); |
| 70 |
59 this.$.collapse.toggle(); | 71 this.$.collapse.toggle(); |
60 this.$['dropdown-indicator'].icon = | 72 this.$['dropdown-indicator'].icon = |
61 this.$.collapse.opened ? 'cr:expand-less' : 'cr:expand-more'; | 73 this.$.collapse.opened ? 'cr:expand-less' : 'cr:expand-more'; |
62 }, | 74 }, |
63 | 75 |
64 /** | 76 /** |
65 * When the synced tab information is set, the icon associated with the tab | 77 * When the synced tab information is set, the icon associated with the tab |
66 * website is also set. | 78 * website is also set. |
67 * @private | 79 * @private |
68 */ | 80 */ |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 * @param {CustomEvent} e | 117 * @param {CustomEvent} e |
106 * @private | 118 * @private |
107 */ | 119 */ |
108 onMenuButtonTap_: function(e) { | 120 onMenuButtonTap_: function(e) { |
109 this.fire('toggle-menu', { | 121 this.fire('toggle-menu', { |
110 target: Polymer.dom(e).localTarget, | 122 target: Polymer.dom(e).localTarget, |
111 tag: this.sessionTag | 123 tag: this.sessionTag |
112 }); | 124 }); |
113 e.stopPropagation(); // Prevent iron-collapse. | 125 e.stopPropagation(); // Prevent iron-collapse. |
114 }, | 126 }, |
| 127 |
| 128 onLinkRightClick_: function() { |
| 129 md_history.BrowserService.getInstance().recordHistogram( |
| 130 SYNCED_TABS_HISTOGRAM_NAME, SyncedTabsHistogram.LINK_RIGHT_CLICKED, |
| 131 SyncedTabsHistogram.LIMIT); |
| 132 }, |
115 }); | 133 }); |
OLD | NEW |