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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // We need to use this to not lose the ids as we go through other loop | 285 // We need to use this to not lose the ids as we go through other loop |
286 // turns. | 286 // turns. |
287 function makeClickHandler(sessionTag, windowId, tabId) { | 287 function makeClickHandler(sessionTag, windowId, tabId) { |
288 return function(e) { | 288 return function(e) { |
289 recordUmaEvent_(HISTOGRAM_EVENT.LINK_CLICKED); | 289 recordUmaEvent_(HISTOGRAM_EVENT.LINK_CLICKED); |
290 chrome.send('openForeignSession', [sessionTag, windowId, tabId, | 290 chrome.send('openForeignSession', [sessionTag, windowId, tabId, |
291 e.button, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]); | 291 e.button, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]); |
292 e.preventDefault(); | 292 e.preventDefault(); |
293 }; | 293 }; |
294 }; | 294 }; |
295 a.addEventListener('click', makeClickHandler(sessionTag, | 295 ['click', 'auxclick'].forEach(function(eventName) { |
296 String(win.sessionId), | 296 a.addEventListener(eventName, |
297 String(tab.sessionId))); | 297 makeClickHandler(sessionTag, |
| 298 String(win.sessionId), |
| 299 String(tab.sessionId))); |
| 300 }); |
298 var wrapper = createElementWithClassName('div', 'device-tab-wrapper'); | 301 var wrapper = createElementWithClassName('div', 'device-tab-wrapper'); |
299 wrapper.appendChild(a); | 302 wrapper.appendChild(a); |
300 contents.appendChild(wrapper); | 303 contents.appendChild(wrapper); |
301 } else { | 304 } else { |
302 numTabsHidden++; | 305 numTabsHidden++; |
303 } | 306 } |
304 } | 307 } |
305 } | 308 } |
306 | 309 |
307 if (numTabsHidden > 0) { | 310 if (numTabsHidden > 0) { |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 devicesView.setSearchText($('search-field').value); | 581 devicesView.setSearchText($('search-field').value); |
579 }; | 582 }; |
580 $('search-field').addEventListener('search', doSearch); | 583 $('search-field').addEventListener('search', doSearch); |
581 $('search-button').addEventListener('click', doSearch); | 584 $('search-button').addEventListener('click', doSearch); |
582 | 585 |
583 chrome.send('otherDevicesInitialized'); | 586 chrome.send('otherDevicesInitialized'); |
584 } | 587 } |
585 | 588 |
586 // Add handlers to HTML elements. | 589 // Add handlers to HTML elements. |
587 document.addEventListener('DOMContentLoaded', load); | 590 document.addEventListener('DOMContentLoaded', load); |
OLD | NEW |