Example #1
0
bool LocalSchemeHandler::ProcessRequest(CefRefPtr<CefRequest> request, CefRefPtr<CefCallback> callback)
{
    CEF_REQUIRE_IO_THREAD();
        
    String url = request->GetURL();
    Error err;
    m_pData = NULL;
    
    // remove query and hash parts
    String::size_type posQuery = url.find(TEXT("?"));
    String::size_type posHash = url.find(TEXT("#"));
    String::size_type len = String::npos;

    if (posQuery != String::npos && posHash != String::npos)
        len = std::min(posQuery, posHash);
    else if (posQuery != String::npos)
        len = posQuery;
    else if (posHash != String::npos)
        len = posHash;
    
    // the URL is prefixed with "local://"
    FileUtil::ReadFileBinary(DecodeURL(url.substr(8, len - 8)), &m_pData, m_size, err);
    m_mimeType = GetMIMETypeForFilename(url);

    // indicate the headers are available
    callback->Continue();
    return true;
}
Example #2
0
void CommonUrlImageView::setImageAndUrl(CAImage* image, const std::string& url)
{
    m_sUrl = DecodeURL(url);
    this->onRequestFinished(image, m_sUrl.c_str());
}
Example #3
0
void CommonUrlImageView::setUrl(const std::string& url)
{
    m_sUrl = DecodeURL(url);
    CommonHttpManager::getInstance()->get_image(m_sUrl, this, CommonHttpImage_selector(CommonUrlImageView::onRequestFinished), m_eType);
}