anchor.diff:  
     Future _pushViaUSB(ProgressMonitor monitor) {
       List<int> httpRequest;
  -    AndroidDevice device;
  -    bool canceled = false;
  -
  -    // Get the device
  -    return _fetchAndroidDevice().then((deviceResult) {
  -      device = deviceResult;
  -    }).then((_) {
  -      // Build the archive.
  -      return archiveContainer(appContainer, true);
  -    }).then((List<int> archivedData) {
  -      // Send the request for pushing the archive
  +    AndroidDevice _device;
  +
  +    // Build the archive.
  +    return archiveContainer(appContainer, true).then((List<int> archivedData) {
         monitor.worked(3);
         httpRequest = _buildHttpRequest('localhost', archivedData);
         monitor.worked(4);
   
         // Send this payload to the USB code.
  -      if (canceled) return null;
  -      return device.sendHttpRequest(httpRequest, 2424).timeout(
  +      return _fetchAndroidDevice();
  +    }).then((deviceResult) {
  +      _device = deviceResult;
  +
  +      return _device.sendHttpRequest(httpRequest, 2424).timeout(
             new Duration(minutes: 5), onTimeout: () {
               return new Future.error(
                   'Push timed out: Total time exceeds 5 minutes');
             });
       }).then((msg) {
  -      if (canceled) return null;
         monitor.worked(3);
         String resp = new String.fromCharCodes(msg);
         List<String> lines = resp.split('\r\n');
  
positive.code:     });
    }
  
    List<int> _buildHttpRequest(String target, List<int> payload) {
      List<int> httpRequest = [];
      // Build the HTTP request headers.
      String header =
          'POST /zippush?appId=${appContainer.project.name}&appType=chrome HTTP/1.1\r\n'
          'User-Agent: Spark IDE\r\n'
          'Host: ${target}:2424\r\n';
      List<int> body = [];
  
      // Add the CRX headers before the zip content.
      // This is the string "Cr24" then three little-endian 32-bit numbers:
      // - The version (2).
      // - The public key length (0).
      // - The signature length (0).
      // Since the App Dev Tool on the other end doesn't check
      // the signature or key, we don't bother sending them.
  
      // Now follows the actual zip data.
      body.addAll(payload);
      httpRequest.addAll(header.codeUnits);
      httpRequest.addAll('Content-length: ${body.length}\r\n\r\n'.codeUnits);
      httpRequest.addAll(body);
  
      return httpRequest;
    }
  
    Future _sendHttpPush(String target, ProgressMonitor monitor) {
      List<int> httpRequest;
      return archiveContainer(appContainer, true).then((List<int> archivedData) {
        monitor.worked(3);
        httpRequest = _buildHttpRequest(target, archivedData);
        monitor.worked(5);
        return _sendRequest(httpRequest, target);
      }).then((List<int> responseBytes) {
        String response = new String.fromCharCodes(responseBytes);
        List<String> lines = response.split('\n');
  
negative.code:         return new Future.error(
              '${header.first.substring(header.first.indexOf(' ') + 1)}: $body');
        } else {
          return body;
        }
      }).whenComplete(() {
        if (_device != null) _device.dispose();
      });
    }
  }
  