| 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 /** | 5 /** |
| 6 * @typedef {{device: string, | 6 * @typedef {{device: string, |
| 7 * lastUpdateTime: string, | 7 * lastUpdateTime: string, |
| 8 * separatorIndexes: !Array<number>, | 8 * separatorIndexes: !Array<number>, |
| 9 * timestamp: number, | 9 * timestamp: number, |
| 10 * tabs: !Array<!ForeignSessionTab>, | 10 * tabs: !Array<!ForeignSessionTab>, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 tag: session.tag, | 111 tag: session.tag, |
| 112 }; | 112 }; |
| 113 }, | 113 }, |
| 114 | 114 |
| 115 onSignInTap_: function() { | 115 onSignInTap_: function() { |
| 116 chrome.send('SyncSetupShowSetupUI'); | 116 chrome.send('SyncSetupShowSetupUI'); |
| 117 chrome.send('SyncSetupStartSignIn', [false]); | 117 chrome.send('SyncSetupStartSignIn', [false]); |
| 118 }, | 118 }, |
| 119 | 119 |
| 120 onToggleMenu_: function(e) { | 120 onToggleMenu_: function(e) { |
| 121 this.$.menu.toggleMenu(e.detail.target, e.detail.tag); | 121 this.$.menu.get().then(function(menu) { |
| 122 menu.toggleMenu(e.detail.target, e.detail.tag); |
| 123 }); |
| 122 }, | 124 }, |
| 123 | 125 |
| 124 onOpenAllTap_: function() { | 126 onOpenAllTap_: function() { |
| 127 var menu = assert(this.$.menu.getIfExists()); |
| 125 md_history.BrowserService.getInstance().openForeignSessionAllTabs( | 128 md_history.BrowserService.getInstance().openForeignSessionAllTabs( |
| 126 this.$.menu.itemData); | 129 menu.itemData); |
| 127 this.$.menu.closeMenu(); | 130 menu.closeMenu(); |
| 128 }, | 131 }, |
| 129 | 132 |
| 130 onDeleteSessionTap_: function() { | 133 onDeleteSessionTap_: function() { |
| 134 var menu = assert(this.$.menu.getIfExists()); |
| 131 md_history.BrowserService.getInstance().deleteForeignSession( | 135 md_history.BrowserService.getInstance().deleteForeignSession( |
| 132 this.$.menu.itemData); | 136 menu.itemData); |
| 133 this.$.menu.closeMenu(); | 137 menu.closeMenu(); |
| 134 }, | 138 }, |
| 135 | 139 |
| 136 /** @private */ | 140 /** @private */ |
| 137 clearDisplayedSyncedDevices_: function() { | 141 clearDisplayedSyncedDevices_: function() { |
| 138 this.syncedDevices_ = []; | 142 this.syncedDevices_ = []; |
| 139 }, | 143 }, |
| 140 | 144 |
| 141 /** | 145 /** |
| 142 * Decide whether or not should display no synced tabs message. | 146 * Decide whether or not should display no synced tabs message. |
| 143 * @param {boolean} signInState | 147 * @param {boolean} signInState |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 // User signed in, show the loading message when querying for synced | 240 // User signed in, show the loading message when querying for synced |
| 237 // devices. | 241 // devices. |
| 238 this.fetchingSyncedTabs_ = true; | 242 this.fetchingSyncedTabs_ = true; |
| 239 }, | 243 }, |
| 240 | 244 |
| 241 searchTermChanged: function(searchTerm) { | 245 searchTermChanged: function(searchTerm) { |
| 242 this.clearDisplayedSyncedDevices_(); | 246 this.clearDisplayedSyncedDevices_(); |
| 243 this.updateSyncedDevices(this.sessionList); | 247 this.updateSyncedDevices(this.sessionList); |
| 244 } | 248 } |
| 245 }); | 249 }); |
| OLD | NEW |