OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 * @fileoverview The section of the history page that shows tabs from sessions | 6 * @fileoverview The section of the history page that shows tabs from sessions |
7 on other devices. | 7 on other devices. |
8 */ | 8 */ |
9 | 9 |
10 /////////////////////////////////////////////////////////////////////////////// | 10 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 // We need to use this to not lose the ids as we go through other loop | 274 // We need to use this to not lose the ids as we go through other loop |
275 // turns. | 275 // turns. |
276 function makeClickHandler(sessionTag, windowId, tabId) { | 276 function makeClickHandler(sessionTag, windowId, tabId) { |
277 return function(e) { | 277 return function(e) { |
278 recordUmaEvent_(HISTOGRAM_EVENT.LINK_CLICKED); | 278 recordUmaEvent_(HISTOGRAM_EVENT.LINK_CLICKED); |
279 chrome.send('openForeignSession', [sessionTag, windowId, tabId, | 279 chrome.send('openForeignSession', [sessionTag, windowId, tabId, |
280 e.button, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]); | 280 e.button, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]); |
281 e.preventDefault(); | 281 e.preventDefault(); |
282 }; | 282 }; |
283 }; | 283 }; |
284 a.addEventListener('click', makeClickHandler(sessionTag, | 284 ['click', 'auxclick'].forEach(function(eventName) { |
285 String(win.sessionId), | 285 a.addEventListener(eventName, |
286 String(tab.sessionId))); | 286 makeClickHandler(sessionTag, |
| 287 String(win.sessionId), |
| 288 String(tab.sessionId))); |
| 289 }); |
287 var wrapper = createElementWithClassName('div', 'device-tab-wrapper'); | 290 var wrapper = createElementWithClassName('div', 'device-tab-wrapper'); |
288 wrapper.appendChild(a); | 291 wrapper.appendChild(a); |
289 contents.appendChild(wrapper); | 292 contents.appendChild(wrapper); |
290 } else { | 293 } else { |
291 numTabsHidden++; | 294 numTabsHidden++; |
292 } | 295 } |
293 } | 296 } |
294 } | 297 } |
295 | 298 |
296 if (numTabsHidden > 0) { | 299 if (numTabsHidden > 0) { |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 devicesView.setSearchText($('search-field').value); | 570 devicesView.setSearchText($('search-field').value); |
568 }; | 571 }; |
569 $('search-field').addEventListener('search', doSearch); | 572 $('search-field').addEventListener('search', doSearch); |
570 $('search-button').addEventListener('click', doSearch); | 573 $('search-button').addEventListener('click', doSearch); |
571 | 574 |
572 chrome.send('otherDevicesInitialized'); | 575 chrome.send('otherDevicesInitialized'); |
573 } | 576 } |
574 | 577 |
575 // Add handlers to HTML elements. | 578 // Add handlers to HTML elements. |
576 document.addEventListener('DOMContentLoaded', load); | 579 document.addEventListener('DOMContentLoaded', load); |
OLD | NEW |