| 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 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 */ | 528 */ |
| 529 function setForeignSessions(sessionList, isTabSyncEnabled) { | 529 function setForeignSessions(sessionList, isTabSyncEnabled) { |
| 530 // The other devices is shown iff tab sync is enabled. | 530 // The other devices is shown iff tab sync is enabled. |
| 531 if (isTabSyncEnabled) | 531 if (isTabSyncEnabled) |
| 532 devicesView.setSessionList(sessionList); | 532 devicesView.setSessionList(sessionList); |
| 533 else | 533 else |
| 534 devicesView.clearDOM(); | 534 devicesView.clearDOM(); |
| 535 } | 535 } |
| 536 | 536 |
| 537 /** | 537 /** |
| 538 * Called when this element is initialized, and from the new tab page when | 538 * Called when initialized or the user's signed in state changes, |
| 539 * the user's signed in state changes, | |
| 540 * @param {string} header The first line of text (unused here). | |
| 541 * @param {string} subHeader The second line of text (unused here). | |
| 542 * @param {string} iconURL The url for the login status icon. If this is null | |
| 543 then the login status icon is hidden (unused here). | |
| 544 * @param {boolean} isUserSignedIn Is the user currently signed in? | 539 * @param {boolean} isUserSignedIn Is the user currently signed in? |
| 545 */ | 540 */ |
| 546 function updateLogin(header, subHeader, iconURL, isUserSignedIn) { | 541 function updateSignInState(isUserSignedIn) { |
| 547 if (devicesView) | 542 if (devicesView) |
| 548 devicesView.updateSignInState(isUserSignedIn); | 543 devicesView.updateSignInState(isUserSignedIn); |
| 549 } | 544 } |
| 550 | 545 |
| 551 /////////////////////////////////////////////////////////////////////////////// | 546 /////////////////////////////////////////////////////////////////////////////// |
| 552 // Document Functions: | 547 // Document Functions: |
| 553 /** | 548 /** |
| 554 * Window onload handler, sets up the other devices view. | 549 * Window onload handler, sets up the other devices view. |
| 555 */ | 550 */ |
| 556 function load() { | 551 function load() { |
| 557 if (!loadTimeData.getBoolean('isInstantExtendedApiEnabled')) | 552 if (!loadTimeData.getBoolean('isInstantExtendedApiEnabled')) |
| 558 return; | 553 return; |
| 559 | 554 |
| 560 // We must use this namespace to reuse the handler code for foreign session | |
| 561 // and login. TODO(estade): change the call site in ntp_login_handler.cc so | |
| 562 // this hack isn't necessary. | |
| 563 cr.define('ntp', function() { | |
| 564 return { | |
| 565 updateLogin: updateLogin | |
| 566 }; | |
| 567 }); | |
| 568 | |
| 569 devicesView = new DevicesView(); | 555 devicesView = new DevicesView(); |
| 570 | 556 |
| 571 // Create the context menu that appears when the user right clicks | 557 // Create the context menu that appears when the user right clicks |
| 572 // on a device name or hit click on the button besides the device name | 558 // on a device name or hit click on the button besides the device name |
| 573 document.body.appendChild(DeviceContextMenuController.getInstance().menu); | 559 document.body.appendChild(DeviceContextMenuController.getInstance().menu); |
| 574 | 560 |
| 575 var doSearch = function(e) { | 561 var doSearch = function(e) { |
| 576 devicesView.setSearchText($('search-field').value); | 562 devicesView.setSearchText($('search-field').value); |
| 577 }; | 563 }; |
| 578 $('search-field').addEventListener('search', doSearch); | 564 $('search-field').addEventListener('search', doSearch); |
| 579 $('search-button').addEventListener('click', doSearch); | 565 $('search-button').addEventListener('click', doSearch); |
| 566 |
| 567 chrome.send('otherDevicesInitialized'); |
| 580 } | 568 } |
| 581 | 569 |
| 582 // Add handlers to HTML elements. | 570 // Add handlers to HTML elements. |
| 583 document.addEventListener('DOMContentLoaded', load); | 571 document.addEventListener('DOMContentLoaded', load); |
| OLD | NEW |