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

Side by Side Diff: chrome/browser/resources/md_history/synced_device_card.js

Issue 2204833003: MD History: Add menu to cards on Synced Tabs page (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@history_improve_collapse_button
Patch Set: Fix tests Created 4 years, 4 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 unified diff | Download patch
OLDNEW
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: String,
11 11
12 // When the device information was last updated. 12 // When the device information was last updated.
13 lastUpdateTime: {type: String, value: ''}, 13 lastUpdateTime: String,
14 14
15 /** 15 /**
16 * The list of tabs open for this device. 16 * The list of tabs open for this device.
17 * @type {!Array<!ForeignSessionTab>} 17 * @type {!Array<!ForeignSessionTab>}
18 */ 18 */
19 tabs: { 19 tabs: {
20 type: Array, 20 type: Array,
21 value: function() { return []; }, 21 value: function() { return []; },
22 observer: 'updateIcons_' 22 observer: 'updateIcons_'
23 }, 23 },
24 24
25 /** 25 /**
26 * The indexes where a window separator should be shown. The use of a 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 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 37
38 // Internal identifier for the device.
38 sessionTag: String, 39 sessionTag: String,
39 }, 40 },
40 41
41 /** 42 /**
42 * Opens all the tabs displayed on the device in separate tabs.
43 * @private
44 */
45 openAllTabs_: function() {
46 md_history.BrowserService.getInstance().openForeignSessionAllTabs(
47 this.sessionTag);
48 },
49
50 /**
51 * @param {TapEvent} e 43 * @param {TapEvent} e
52 * @private 44 * @private
53 */ 45 */
54 openTab_: function(e) { 46 openTab_: function(e) {
55 var tab = /** @type {ForeignSessionTab} */(e.model.tab); 47 var tab = /** @type {ForeignSessionTab} */(e.model.tab);
56 var srcEvent = /** @type {Event} */(e.detail.sourceEvent); 48 var srcEvent = /** @type {Event} */(e.detail.sourceEvent);
57 md_history.BrowserService.getInstance().openForeignSessionTab( 49 md_history.BrowserService.getInstance().openForeignSessionTab(
58 this.sessionTag, tab.windowId, tab.sessionId, srcEvent); 50 this.sessionTag, tab.windowId, tab.sessionId, srcEvent);
59 e.preventDefault(); 51 e.preventDefault();
60 }, 52 },
(...skipping 29 matching lines...) Expand all
90 }, 82 },
91 83
92 /** 84 /**
93 * @param {boolean} cardOpen 85 * @param {boolean} cardOpen
94 * @return {string} 86 * @return {string}
95 */ 87 */
96 getCollapseTitle_: function(cardOpen) { 88 getCollapseTitle_: function(cardOpen) {
97 return cardOpen ? loadTimeData.getString('collapseSessionButton') : 89 return cardOpen ? loadTimeData.getString('collapseSessionButton') :
98 loadTimeData.getString('expandSessionButton'); 90 loadTimeData.getString('expandSessionButton');
99 }, 91 },
92
93 /**
94 * @param {CustomEvent} e
95 * @private
96 */
97 onMenuButtonTap_: function(e) {
98 this.fire('toggle-menu', {
99 target: Polymer.dom(e).localTarget,
100 tag: this.sessionTag
101 });
102 e.stopPropagation(); // Prevent iron-collapse.
103 },
100 }); 104 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698