double fpTime; LL_L2D(fpTime, time64); mPluginStreamInfo->SetLastModified((PRUint32)(fpTime * 1e-6 + 0.5)); }
double fpTime; LL_L2D(fpTime, time64); mPluginStreamInfo->SetLastModified((PRUint32)(fpTime * 1e-6 + 0.5));
nsresult nsPluginStreamListenerPeer::SetUpStreamListener(nsIRequest *request,                                                         nsIURI* aURL){  nsresult rv = NS_OK;  // If we don't yet have a stream listener, we need to get  // one from the plugin.  // NOTE: this should only happen when a stream was NOT created  // with GetURL or PostURL (i.e. it's the initial stream we  // send to the plugin as determined by the SRC or DATA attribute)  if(mPStreamListener == nsnull && mInstance != nsnull)    rv = mInstance->NewStream(&mPStreamListener);  if(rv != NS_OK)    return rv;  if(mPStreamListener == nsnull)    return NS_ERROR_NULL_POINTER;  PRBool useLocalCache = PR_FALSE;  // get httpChannel to retrieve some info we need for nsIPluginStreamInfo setup  nsCOMPtr<nsIChannel> channel = do_QueryInterface(request);  nsCOMPtr<nsIHttpChannel> httpChannel = do_QueryInterface(channel);  /*   * Assumption   * By the time nsPluginStreamListenerPeer::OnDataAvailable() gets   * called, all the headers have been read.   */  if (httpChannel) {    httpChannel->VisitResponseHeaders(this);    // set seekability (seekable if the stream has a known length and if the    // http server accepts byte ranges).    PRBool bSeekable = PR_FALSE;    PRUint32 length;    mPluginStreamInfo->GetLength(&length);    if (length) {      // first we look for a content-encoding header. If we find one,      // we tell the plugin that stream is not seekable,      // because range request on compressed content is irrelevant,      // so we force the plugin to use nsPluginStreamType_AsFile stream type      // and we have to save decompressed file into local plugin cache,      // because necko cache contains original compressed file.      nsCAutoString contentEncoding;      if (NS_SUCCEEDED(httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("Content-Encoding"),        contentEncoding))) {        useLocalCache = PR_TRUE;      } else {        nsCAutoString range;        if (NS_SUCCEEDED(httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("accept-ranges"), range)) &&          range.Equals(NS_LITERAL_CSTRING("bytes"), nsCaseInsensitiveCStringComparator())) {          bSeekable = PR_TRUE;          // nsPluginStreamInfo.mSeekable intitialized by PR_FALSE in ctor of nsPluginStreamInfo          // so we reset it only here.          mPluginStreamInfo->SetSeekable(bSeekable);        }      }      // we require a content len      // get Last-Modified header for plugin info      nsCAutoString lastModified;      if (NS_SUCCEEDED(httpChannel->GetResponseHeader(NS_LITERAL_CSTRING("last-modified"), lastModified)) &&        !lastModified.IsEmpty())      {        PRTime time64;        PR_ParseTimeString(lastModified.get(), PR_TRUE, &time64);  //convert string time to interger time        // Convert PRTime to unix-style time_t, i.e. seconds since the epoch        double fpTime;        LL_L2D(fpTime, time64);        mPluginStreamInfo->SetLastModified((PRUint32)(fpTime * 1e-6 + 0.5));      }    }  }  rv = mPStreamListener->OnStartBinding(mPluginStreamInfo);  mStartBinding = PR_TRUE;  if (NS_FAILED(rv))    return rv;  mPStreamListener->GetStreamType(&mStreamType);  if (!useLocalCache && mStreamType >= nsPluginStreamType_AsFile) {    // check it out if this is not a file channel.    nsCOMPtr<nsIFileChannel> fileChannel = do_QueryInterface(request);    if (!fileChannel) {      // and browser cache is not available      nsCOMPtr<nsICachingChannel> cacheChannel = do_QueryInterface(request);      if (!(cacheChannel && (NS_SUCCEEDED(cacheChannel->SetCacheAsFile(PR_TRUE))))) {        useLocalCache = PR_TRUE;      }    }  }  if (useLocalCache) {    SetupPluginCacheFile(channel);  }  return NS_OK;}