| 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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 this.addHighlightedText_(a, tab.title); | 279 this.addHighlightedText_(a, tab.title); |
| 280 // Add a tooltip, since it might be ellipsized. The ones that are not | 280 // Add a tooltip, since it might be ellipsized. The ones that are not |
| 281 // necessary will be removed once added to the document, so we can | 281 // necessary will be removed once added to the document, so we can |
| 282 // compute sizes. | 282 // compute sizes. |
| 283 a.title = tab.title; | 283 a.title = tab.title; |
| 284 | 284 |
| 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 if (e.button > 1) |
| 290 return; // Ignore buttons other than left and middle. |
| 289 recordUmaEvent_(HISTOGRAM_EVENT.LINK_CLICKED); | 291 recordUmaEvent_(HISTOGRAM_EVENT.LINK_CLICKED); |
| 290 chrome.send('openForeignSession', [sessionTag, windowId, tabId, | 292 chrome.send('openForeignSession', [sessionTag, windowId, tabId, |
| 291 e.button, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]); | 293 e.button, e.altKey, e.ctrlKey, e.metaKey, e.shiftKey]); |
| 292 e.preventDefault(); | 294 e.preventDefault(); |
| 293 }; | 295 }; |
| 294 }; | 296 }; |
| 295 ['click', 'auxclick'].forEach(function(eventName) { | 297 ['click', 'auxclick'].forEach(function(eventName) { |
| 296 a.addEventListener(eventName, | 298 a.addEventListener(eventName, |
| 297 makeClickHandler(sessionTag, | 299 makeClickHandler(sessionTag, |
| 298 String(win.sessionId), | 300 String(win.sessionId), |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 devicesView.setSearchText($('search-field').value); | 583 devicesView.setSearchText($('search-field').value); |
| 582 }; | 584 }; |
| 583 $('search-field').addEventListener('search', doSearch); | 585 $('search-field').addEventListener('search', doSearch); |
| 584 $('search-button').addEventListener('click', doSearch); | 586 $('search-button').addEventListener('click', doSearch); |
| 585 | 587 |
| 586 chrome.send('otherDevicesInitialized'); | 588 chrome.send('otherDevicesInitialized'); |
| 587 } | 589 } |
| 588 | 590 |
| 589 // Add handlers to HTML elements. | 591 // Add handlers to HTML elements. |
| 590 document.addEventListener('DOMContentLoaded', load); | 592 document.addEventListener('DOMContentLoaded', load); |
| OLD | NEW |