gotMessage = function(e) {
      'use strict';
      channel.port1.removeEventListener(
          goog.events.EventType.MESSAGE, gotMessage, true);
      // If the connection has been cancelled, don't create the channel.
      if (!timer.isDisposed()) {
        deferred.callback(new goog.messaging.PortChannel(channel.port1));
      }
    }
Create a PortChannel that communicates with a window embedded in the current
page (e.g. an iframe contentWindow). The code within the window should call
{@link forGlobalWindow} to establish the connection.

It's possible to use this channel in conjunction with other messages to the
embedded window. However, only one PortChannel should be used for a given
window at a time.

@param {!Window} peerWindow The window object to communicate with.
@param {string} peerOrigin The expected origin of the window. See
    http://dev.w3.org/html5/postmsg/#dom-window-postmessage.
@param {goog.Timer=} opt_timer The timer that regulates how often the initial
    connection message is attempted. This will be automatically disposed once
    the connection is established, or when the connection is cancelled.
@return {!goog.messaging.DeferredChannel} The PortChannel. Although this is
    not actually an instance of the PortChannel class, it will behave like
    one in that MessagePorts may be sent across it. The DeferredChannel may
    be cancelled before a connection is established in order to abort the
    attempt to make a connection.