OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 * Javascript for local_discovery.html, served from chrome://devices/ | 6 * Javascript for local_discovery.html, served from chrome://devices/ |
7 * This is used to show discoverable devices near the user as well as | 7 * This is used to show discoverable devices near the user as well as |
8 * cloud devices registered to them. | 8 * cloud devices registered to them. |
9 * | 9 * |
10 * The object defined in this javascript file listens for callbacks from the | 10 * The object defined in this javascript file listens for callbacks from the |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 cloudDevicesLoginButtonClicked); | 598 cloudDevicesLoginButtonClicked); |
599 | 599 |
600 $('register-login-button').addEventListener( | 600 $('register-login-button').addEventListener( |
601 'click', | 601 'click', |
602 registerLoginButtonClicked); | 602 registerLoginButtonClicked); |
603 | 603 |
604 $('register-overlay-login-button').addEventListener( | 604 $('register-overlay-login-button').addEventListener( |
605 'click', | 605 'click', |
606 registerOverlayLoginButtonClicked); | 606 registerOverlayLoginButtonClicked); |
607 | 607 |
| 608 if (loadTimeData.valueExists('backButtonURL')) { |
| 609 $('back-button').hidden = false; |
| 610 $('back-button').addEventListener('click', function() { |
| 611 window.location.href = loadTimeData.getString('backButtonURL'); |
| 612 }); |
| 613 } |
| 614 |
608 updateVisibility(); | 615 updateVisibility(); |
609 document.addEventListener('visibilitychange', updateVisibility, false); | 616 document.addEventListener('visibilitychange', updateVisibility, false); |
610 | 617 |
611 focusManager = new LocalDiscoveryFocusManager(); | 618 focusManager = new LocalDiscoveryFocusManager(); |
612 focusManager.initialize(); | 619 focusManager.initialize(); |
613 | 620 |
614 chrome.send('start'); | 621 chrome.send('start'); |
615 recordUmaEvent(DEVICES_PAGE_EVENTS.OPENED); | 622 recordUmaEvent(DEVICES_PAGE_EVENTS.OPENED); |
616 }); | 623 }); |
617 | 624 |
618 return { | 625 return { |
619 onRegistrationSuccess: onRegistrationSuccess, | 626 onRegistrationSuccess: onRegistrationSuccess, |
620 onRegistrationFailed: onRegistrationFailed, | 627 onRegistrationFailed: onRegistrationFailed, |
621 onUnregisteredDeviceUpdate: onUnregisteredDeviceUpdate, | 628 onUnregisteredDeviceUpdate: onUnregisteredDeviceUpdate, |
622 onRegistrationConfirmedOnPrinter: onRegistrationConfirmedOnPrinter, | 629 onRegistrationConfirmedOnPrinter: onRegistrationConfirmedOnPrinter, |
623 onCloudDeviceListAvailable: onCloudDeviceListAvailable, | 630 onCloudDeviceListAvailable: onCloudDeviceListAvailable, |
624 onCloudDeviceListUnavailable: onCloudDeviceListUnavailable, | 631 onCloudDeviceListUnavailable: onCloudDeviceListUnavailable, |
625 onDeviceCacheFlushed: onDeviceCacheFlushed, | 632 onDeviceCacheFlushed: onDeviceCacheFlushed, |
626 onRegistrationCanceledPrinter: onRegistrationCanceledPrinter, | 633 onRegistrationCanceledPrinter: onRegistrationCanceledPrinter, |
627 onRegistrationTimeout: onRegistrationTimeout, | 634 onRegistrationTimeout: onRegistrationTimeout, |
628 setUserLoggedIn: setUserLoggedIn, | 635 setUserLoggedIn: setUserLoggedIn, |
629 setupCloudPrintConnectorSection: setupCloudPrintConnectorSection, | 636 setupCloudPrintConnectorSection: setupCloudPrintConnectorSection, |
630 removeCloudPrintConnectorSection: removeCloudPrintConnectorSection | 637 removeCloudPrintConnectorSection: removeCloudPrintConnectorSection |
631 }; | 638 }; |
632 }); | 639 }); |
OLD | NEW |