Eliminated boilerplate from HostController and HostDaemonFacade.
commit4329e54c3541249dc55174ae9d982a1001118d1b
authorjrw <jrw@chromium.org>
Mon, 13 Apr 2015 20:34:42 +0000 (13 13:34 -0700)
committerCommit bot <commit-bot@chromium.org>
Mon, 13 Apr 2015 20:35:10 +0000 (13 20:35 +0000)
treebc6fb05cb2615cf7d6cf09efbdc0738890e3c363
parent818e1ffab9387ca6bcbdc8ed781ec29e39a9b61b
Eliminated boilerplate from HostController and HostDaemonFacade.

This change combines multiple closely related refactorings designed
mostly to make the code easier to understand:

- The start method of HostController now uses local variables to pass
  information between its local functions, rather than using
  positional arguments and the bind method.

- The HostDaemonFacade class now uses promises instead of callbacks.

- Promises converted from callbacks with multiple parameters now contain
  data with named fields.

- The remoting.Error.handler function is used to convert unexpected
  runtime errors into exceptions that are reported to the user instead
  of causing multi-step operations to simply hang.

BUG=471928

Review URL: https://codereview.chromium.org/1040233002

Cr-Commit-Position: refs/heads/master@{#324909}
remoting/webapp/crd/js/host_controller.js
remoting/webapp/crd/js/host_controller_unittest.js
remoting/webapp/crd/js/host_daemon_facade.js
remoting/webapp/crd/js/host_daemon_facade_unittest.js
remoting/webapp/crd/js/host_setup_dialog.js
remoting/webapp/crd/js/mock_host_daemon_facade.js