Ejemplo n.º 1
0
bool CapsuleProc::FindOverlapCenter(IMG		rawSubImg,
									long&	centerX,
									long&	centerY)
{
	if(!IsImage(rawSubImg))
	{
		centerX = -1;
		centerY = -1;
		return false;
	}
	
	long width	= ImageWidth (rawSubImg);
	long height = ImageHeight(rawSubImg);
	
	long xc		= width/2;
	long yc0	= height/2 - height/8;
	long yc1	= height/2 + height/8;
	
	double upMean	= 0;
	double downMean = 0;
	
	long offsetX = width/4;
	long offsetY = 5;
	
	TArea upArea = CreateTArea(xc - offsetX,   yc0 + offsetY, 2*offsetX, 2*offsetY);
	
	LMSetImage			(m_lightMeter, rawSubImg);
	LMSetProcessFlag	(m_lightMeter, 0,  TRUE);
	LMSetArea			(m_lightMeter, 0,  upArea);
	LMExecute			(m_lightMeter);
	LMGetStatisticMean	(m_lightMeter, 0, &upMean);
	
	
	TArea downArea = CreateTArea(xc - offsetX, yc1 - offsetY, 2*offsetX, -2*offsetY);
	LMSetImage			(m_lightMeter, rawSubImg);
	LMSetProcessFlag	(m_lightMeter, 0,  TRUE);
	LMSetArea			(m_lightMeter, 0,  downArea);
	LMExecute			(m_lightMeter);
	LMGetStatisticMean	(m_lightMeter, 0, &downMean);
	
	centerX = xc;
	centerY = upMean <= downMean ? yc0 : yc1;
	return true;
}
Ejemplo n.º 2
0
// TODO(jmadill): This is not complete.
void TOutputVulkanGLSL::writeLayoutQualifier(const TType &type)
{
    TInfoSinkBase &out                      = objSink();
    const TLayoutQualifier &layoutQualifier = type.getLayoutQualifier();
    out << "layout(";

    if (type.getQualifier() == EvqAttribute || type.getQualifier() == EvqFragmentOut ||
        type.getQualifier() == EvqVertexIn)
    {
        // TODO(jmadill): Multiple output locations.
        out << "location = "
            << "0";
    }

    if (IsImage(type.getBasicType()) && layoutQualifier.imageInternalFormat != EiifUnspecified)
    {
        ASSERT(type.getQualifier() == EvqTemporary || type.getQualifier() == EvqUniform);
        out << getImageInternalFormatString(layoutQualifier.imageInternalFormat);
    }

    out << ") ";
}
Ejemplo n.º 3
0
void MythUIFileBrowser::PathSelected(MythUIButtonListItem *item)
{
    if (!item)
        return;

    if (m_previewImage)
        m_previewImage->Reset();

    MFileInfo finfo = item->GetData().value<MFileInfo>();

    if (finfo.isParentDir())
    {
        if (m_infoText)
            m_infoText->Reset();

        if (m_filenameText)
            m_filenameText->Reset();

        if (m_fullpathText)
            m_fullpathText->Reset();
    }
    else
    {
        if (IsImage(finfo.suffix()) && m_previewImage)
        {
            m_previewImage->SetFilename(finfo.absoluteFilePath());
            m_previewTimer->start(250);
        }

        if (m_infoText)
            m_infoText->SetText(FormatSize(finfo.size()));

        if (m_filenameText)
            m_filenameText->SetText(finfo.fileName());

        if (m_fullpathText)
            m_fullpathText->SetText(finfo.absoluteFilePath());
    }
}
Ejemplo n.º 4
0
bool CapsuleProc::RectBlackBlob(	IMG			image,
									long		wndSize,
									long		dynThres,
									long		minBlobSize,
									TBlobTouchBorderFilter	ignorBorder,
									long		minBlobWidth,
									long		minBlobHeight)
{
	if(!IsImage(image))	{ return true; }

	IMG DynamicImage = NULL;
	CreateDynamicThresholdImage(image, wndSize, dynThres,  DynamicImage);
	
	FBlobSetImage			(m_cvbBlob, DynamicImage, 0);
	FBlobSetObjectFeatureRange	(m_cvbBlob, 0, 128);
	FBlobSetSkipBinarization	(m_cvbBlob, FALSE);
	FBlobSetLimitArea		(m_cvbBlob, minBlobSize, -1);
	FBlobSetLimitWidth		(m_cvbBlob, minBlobWidth, -1);
	FBlobSetLimitHeight		(m_cvbBlob, minBlobHeight, -1);
	FBlobSetObjectTouchBorder	(m_cvbBlob, ignorBorder);
	FBlobExec			(m_cvbBlob);

	long blobCount	= 0;
	FBlobGetNumBlobs(m_cvbBlob, blobCount);

	if(1 == m_dim.bytesPerPixel)
	{
		m_sortObserver.ObserverIMG(SortObserver::MDyn, DynamicImage);
	}
	else
	{
		m_sortObserver.ObserverIMG(SortObserver::CDyn, DynamicImage);
	}
	

	ReleaseImage(DynamicImage);

	return (blobCount == 0);
}
Ejemplo n.º 5
0
bool TRefFilter::Filter(const entry_ref *theRef, BNode *theNode, struct stat_beos *theStat, const char *mimetype)
{
	//	Create BEntry and traverse to get source ref
	BEntry entry(theRef, true);
	if (entry.InitCheck() != B_OK)
	{
		ERROR("TRefFilter::Filter() - Error creating BEntry -\n");
		return false;
	}
		
	//	Create a node from ref
	BNode localNode(theRef);
	if (localNode.InitCheck() != B_OK)
	{
		ERROR("TRefFilter::Filter() - Error creating BNode -\n");
		return false;
	}
		
	//	Get node info
	BNodeInfo nodeInfo(&localNode);	 
	if (nodeInfo.InitCheck() != B_OK)
	{
		ERROR("TRefFilter::Filter() - Error getting BNodeInfo -\n");
		return false;
	}
	
	//	Get stat info
	struct stat st;
	if (entry.GetStat(&st) != B_OK)
	{
		ERROR("TRefFilter::Filter() - Error getting stat info -\n");
		return false;	
	}
	
	switch(m_FilterType)
	{
		case kAudioFilter:
		{
			// Allow directories
			if (S_ISDIR(st.st_mode)) 
				return true;
					
			// Allow audio
			if (IsAudio(nodeInfo))
				return true;
		}
		break;
	
		case kAudioAiffFilter:
		{
			// Allow directories
			if (S_ISDIR(st.st_mode)) 
				return true;
					
			// Allow audio
			if (IsAudioAiff(nodeInfo))
				return true;
		}
		break;
			
		case kImageFilter:
			{
				// Allow directories
				if (S_ISDIR(st.st_mode)) 
					return true;
					
				// Allow images
				if (IsImage(nodeInfo))
					return true;							
			}
			break;
			
		case kTextFilter:
			{
				// Allow directories
				if (S_ISDIR(st.st_mode)) 
					return true;
					
				// Allow text
				if (IsText(nodeInfo))
					return true;
			}
			break;
			
		case kVideoFilter:
			{
				// Allow directories
				if (S_ISDIR(st.st_mode)) 
					return true;
					
				// Allow video
				if (IsVideo(nodeInfo))
					return true;
			}
			break;
			
		case kCueSheetFilter:
			{
				// Allow directories
				if (S_ISDIR(st.st_mode)) 
					return true;
					
				// Allow CueSheets
				if (IsCueSheet(nodeInfo))
					return true;
			}
			break;
		
		case kDirectoryFilter:
		{
			// Allow directories
			if (S_ISDIR(st.st_mode)) 
				return true;					
		}
		break;
		
		default:
			return true;
	}	
	
	// Fail if we get here
	return false;
}
Ejemplo n.º 6
0
BOOL CConflictResolveDlg::OnInitDialog()
{
    CResizableStandAloneDialog::OnInitDialog();
    CAppUtils::MarkWindowAsUnpinnable(m_hWnd);

    ExtendFrameIntoClientArea(0, 0, 0, IDC_GROUP);
    m_aeroControls.SubclassControl(this, IDC_ABORT);
    m_aeroControls.SubclassControl(this, IDHELP);

    // without a conflict description, this dialog is useless.
    ASSERT(m_pConflictDescription);

    CString filepath = CUnicodeUtils::GetUnicode(m_pConflictDescription->local_abspath);
    CString filename = CPathUtils::GetFileNameFromPath(filepath);

    CString sInfoText;
    CString sActionText;
    CString sReasonText;
    switch (m_pConflictDescription->action)
    {
    case svn_wc_conflict_action_edit:
        if (m_pConflictDescription->property_name)
            sActionText.FormatMessage(IDS_EDITCONFLICT_PROP_ACTIONINFO_MODIFY,
                (LPCTSTR)CUnicodeUtils::GetUnicode(m_pConflictDescription->property_name),
                (LPCTSTR)filename);
        else
            sActionText.Format(IDS_EDITCONFLICT_ACTIONINFO_MODIFY, (LPCTSTR)filename);
        break;
    case svn_wc_conflict_action_add:
        if (m_pConflictDescription->property_name)
            sActionText.FormatMessage(IDS_EDITCONFLICT_PROP_ACTIONINFO_ADD,
                (LPCTSTR)CUnicodeUtils::GetUnicode(m_pConflictDescription->property_name),
                (LPCTSTR)filename);
        else
            sActionText.Format(IDS_EDITCONFLICT_ACTIONINFO_ADD, (LPCTSTR)filename);
        break;
    case svn_wc_conflict_action_delete:
        if (m_pConflictDescription->property_name)
            sActionText.FormatMessage(IDS_EDITCONFLICT_PROP_ACTIONINFO_DELETE,
            (LPCTSTR)CUnicodeUtils::GetUnicode(m_pConflictDescription->property_name),
            (LPCTSTR)filename);
        else
            sActionText.Format(IDS_EDITCONFLICT_ACTIONINFO_DELETE, (LPCTSTR)filename);
        break;
    case svn_wc_conflict_action_replace:
        if (m_pConflictDescription->property_name)
            sActionText.FormatMessage(IDS_EDITCONFLICT_PROP_ACTIONINFO_REPLACE,
            (LPCTSTR)CUnicodeUtils::GetUnicode(m_pConflictDescription->property_name),
            (LPCTSTR)filename);
        else
            sActionText.Format(IDS_EDITCONFLICT_ACTIONINFO_REPLACE, (LPCTSTR)filename);
        break;
    default:
        break;
    }

    switch (m_pConflictDescription->reason)
    {
    case svn_wc_conflict_reason_added:  // properties are always added
    case svn_wc_conflict_reason_edited:
        sReasonText.LoadString(IDS_EDITCONFLICT_REASONINFO_EDITED);
        break;
    case svn_wc_conflict_reason_obstructed:
        sReasonText.LoadString(IDS_EDITCONFLICT_REASONINFO_OBSTRUCTED);
        break;
    case svn_wc_conflict_reason_deleted:
        sReasonText.LoadString(IDS_EDITCONFLICT_REASONINFO_DELETED);
        break;
    case svn_wc_conflict_reason_missing:
        sReasonText.LoadString(IDS_EDITCONFLICT_REASONINFO_MISSING);
        break;
    case svn_wc_conflict_reason_unversioned:
        sReasonText.LoadString(IDS_EDITCONFLICT_REASONINFO_UNVERSIONED);
        break;
    default:
        break;
    }

    sInfoText = filepath + L"\r\n" + sActionText + L" " + sReasonText;
    SetDlgItemText(IDC_INFOLABEL, sInfoText);

    // if we deal with a binary file, editing the conflict isn't possible
    // because the 'merged_file' is not used and Subversion therefore can't
    // use it as the result of the edit.
    if (m_pConflictDescription->is_binary)
    {
        // in case the binary file is an image, we can use TortoiseIDiff
        m_bIsImage = false;
        if (m_pConflictDescription->property_name == nullptr)
        {
            if (m_pConflictDescription->base_abspath)
                m_bIsImage |= IsImage(m_pConflictDescription->base_abspath);
            if (m_pConflictDescription->local_abspath)
                m_bIsImage |= IsImage(m_pConflictDescription->local_abspath);
            if (m_pConflictDescription->my_abspath)
                m_bIsImage |= IsImage(m_pConflictDescription->my_abspath);
            if (m_pConflictDescription->their_abspath)
                m_bIsImage |= IsImage(m_pConflictDescription->their_abspath);
        }
        if (!m_bIsImage && m_pConflictDescription->merged_file)
        {
            GetDlgItem(IDC_RESOLVELABEL)->EnableWindow(FALSE);
            GetDlgItem(IDC_EDITCONFLICT)->EnableWindow(FALSE);
            GetDlgItem(IDC_RESOLVED)->EnableWindow(FALSE);
        }
    }

    // the "resolved" button must not be enabled as long as the user hasn't used
    // the "edit" button.
    GetDlgItem(IDC_RESOLVED)->EnableWindow(FALSE);

    m_bCancelled = false;

    AddAnchor(IDC_INFOLABEL, TOP_LEFT, BOTTOM_RIGHT);
    AddAnchor(IDC_GROUP, BOTTOM_LEFT, BOTTOM_RIGHT);
    AddAnchor(IDC_CHOOSELABEL, BOTTOM_LEFT);
    AddAnchor(IDC_USELOCAL, BOTTOM_LEFT);
    AddAnchor(IDC_USEREPO, BOTTOM_RIGHT);
    AddAnchor(IDC_ORLABEL, BOTTOM_LEFT);
    AddAnchor(IDC_RESOLVELABEL, BOTTOM_LEFT);
    AddAnchor(IDC_EDITCONFLICT, BOTTOM_LEFT);
    AddAnchor(IDC_RESOLVED, BOTTOM_RIGHT);
    AddAnchor(IDC_ORLABEL2, BOTTOM_LEFT);
    AddAnchor(IDC_LEAVELABEL, BOTTOM_LEFT);
    AddAnchor(IDCANCEL, BOTTOM_LEFT);
    AddAnchor(IDC_RESOLVEALLLATER, BOTTOM_RIGHT);
    AddAnchor(IDC_ABORT, BOTTOM_RIGHT);
    AddAnchor(IDHELP, BOTTOM_RIGHT);


    return TRUE;
}
Ejemplo n.º 7
0
void MythUIFileBrowser::updateLocalFileList()
{
    QDir d;

    d.setPath(m_subDirectory);
    d.setNameFilters(m_nameFilter);
    d.setFilter(m_typeFilter);
    d.setSorting(QDir::Name | QDir::DirsFirst | QDir::IgnoreCase);

    if (!d.exists())
    {
        LOG(VB_GENERAL, LOG_ERR,
            "MythUIFileBrowser: current directory does not exist!");
        m_locationEdit->SetText("/");
        m_subDirectory = "/";
        d.setPath("/");
    }

    QFileInfoList list = d.entryInfoList();
    bool showBackButton = false;

    if (list.isEmpty())
    {
        MythUIButtonListItem *item = new MythUIButtonListItem(m_fileList,
                                                              tr("Parent Directory"));
        item->DisplayState("upfolder", "nodetype");
    }
    else
    {
        QFileInfoList::const_iterator it = list.begin();
        const QFileInfo *fi;

        while (it != list.end())
        {
            fi = &(*it);
            MFileInfo finfo(fi->filePath());

            if (finfo.fileName() == ".")
            {
                ++it;
                continue;
            }

            QString displayName = finfo.fileName();
            QString type;

            if (displayName == "..")
            {
                if (m_subDirectory.endsWith("/"))
                {
                    ++it;
                    continue;
                }

                displayName = tr("Parent");
                type = "upfolder";
                showBackButton = true;
            }
            else if (finfo.isDir())
            {
                type = "folder";
            }
            else if (finfo.isExecutable())
            {
                type = "executable";
            }
            else if (finfo.isFile())
            {
                type = "file";
            }

            MythUIButtonListItem *item =
                new MythUIButtonListItem(m_fileList, displayName,
                                         qVariantFromValue(finfo));

            if (IsImage(finfo.suffix()))
            {
                item->SetImage(finfo.absoluteFilePath());
                type = "image";
            }

            item->SetText(FormatSize(finfo.size()), "filesize");
            item->SetText(finfo.absoluteFilePath(), "fullpath");
            item->DisplayState(type, "nodetype");

            ++it;
        }
    }

    if (m_backButton)
        m_backButton->SetEnabled(showBackButton);

    m_locationEdit->SetText(m_subDirectory);
}
Ejemplo n.º 8
0
void MythUIFileBrowser::updateRemoteFileList()
{
    QStringList sgdirlist;
    QString     sgdir;
    QStringList slist;

    if (!m_baseDirectory.endsWith("/"))
        m_baseDirectory.append("/");

    QString dirURL = QString("%1%2").arg(m_baseDirectory)
                     .arg(m_subDirectory);

    if (!GetRemoteFileList(m_baseDirectory, sgdir, sgdirlist))
    {
        LOG(VB_GENERAL, LOG_ERR, "GetRemoteFileList failed to get "
            "Storage Group dirs");
        return;
    }

    if ((sgdirlist.size() == 1) &&
        (sgdirlist[0].startsWith("sgdir::")))
    {
        QStringList tokens = sgdirlist[0].split("::");

        m_storageGroupDir = tokens[1];
    }

    if (!GetRemoteFileList(dirURL, m_storageGroupDir, slist))
    {
        LOG(VB_GENERAL, LOG_ERR,
            QString("GetRemoteFileList failed for '%1' in '%2' SG dir")
            .arg(dirURL).arg(m_storageGroupDir));
        return;
    }

    m_locationEdit->SetText(dirURL);

    QString displayName;
    QString dataName;
    QString type;

    if ((sgdirlist.size() > 1 && !m_storageGroupDir.isEmpty()) ||
        (!m_subDirectory.isEmpty()))
    {
        displayName = tr("Parent");
        type = "upfolder";

        m_parentDir = m_baseDirectory;

        if (!m_subDirectory.isEmpty())
        {
            m_parentDir += "/" + m_subDirectory;

            int pos = m_parentDir.lastIndexOf('/');

            if (pos > 0)
                m_parentDir = m_parentDir.left(pos);
        }


        MFileInfo finfo(m_parentDir, m_storageGroupDir, true);
        m_parentSGDir = m_storageGroupDir;

        if (m_subDirectory.isEmpty() && m_parentDir == m_baseDirectory)
        {
            finfo.setSGDir("");
            m_parentSGDir = "";
        }

        MythUIButtonListItem *item = new MythUIButtonListItem(
            m_fileList, displayName,
            qVariantFromValue(finfo));

        item->SetText(QString("0"), "filesize");
        item->SetText(m_parentDir, "fullpath");
        item->DisplayState(type, "nodetype");

        if (m_backButton)
            m_backButton->SetEnabled(true);
    }
    else
    {
        if (m_backButton)
            m_backButton->SetEnabled(false);
    }

    QStringList::const_iterator it = slist.begin();

    while (it != slist.end())
    {
        QStringList tokens = (*it).split("::");

        if (tokens.size() < 2)
        {
            LOG(VB_GENERAL, LOG_ERR, QString("failed to parse '%1'.").arg(*it));
            ++it;
            continue;
        }

        displayName = tokens[1];

        if (tokens[0] == "sgdir")
            dataName = m_baseDirectory;
        else if (m_subDirectory.isEmpty())
            dataName = QString("%1%2").arg(m_baseDirectory)
                       .arg(displayName);
        else
            dataName = QString("%1%2/%3").arg(m_baseDirectory)
                       .arg(m_subDirectory).arg(displayName);

        MFileInfo finfo(dataName, m_storageGroupDir);

        if ((tokens[0] == "dir") &&
            (m_typeFilter & (QDir::Dirs | QDir::AllDirs)))
        {
            type = "folder";
            finfo.setIsDir(true);
            finfo.setSGDir(m_storageGroupDir);
            finfo.setSize(0);
        }
        else if ((tokens[0] == "sgdir") &&
                 (m_typeFilter & (QDir::Dirs | QDir::AllDirs)))
        {
            type = "folder";
            finfo.setIsDir(true);
            finfo.setSGDir(displayName);
            finfo.setSize(0);
        }
        else if ((tokens[0] == "file") &&
                 (m_typeFilter & QDir::Files))
        {
            finfo.setIsDir(false);
            finfo.setSize(tokens[2].toInt());

            if (IsImage(finfo.suffix()))
                type = "image";
            else
                type = "file";
        }
        else
        {
            // unknown type or filtered out
            ++it;
            continue;
        }

        MythUIButtonListItem *item =
            new MythUIButtonListItem(m_fileList, displayName,
                                     qVariantFromValue(finfo));

        if (finfo.size())
            item->SetText(FormatSize(finfo.size()), "filesize");

        if (type == "image")
            item->SetImage(dataName);

        item->SetText(dataName, "fullpath");
        item->DisplayState(type, "nodetype");

        ++it;
    }
}
Ejemplo n.º 9
0
OP_STATUS ContentDetector::DetectContentType()
{
	m_official_content_type = (URLContentType)m_url->GetAttribute(URL::KContentType, TRUE);

	UINT32 port = m_url->GetAttribute(URL::KResolvedPort);
	URLType url_type =  static_cast<URLType>(m_url->GetAttribute(URL::KType));

	if (((url_type == URL_HTTP && port != 80) || (url_type == URL_HTTPS && port != 443)) && !m_url->GetAttribute(URL::KHTTP_10_or_more))
	{
		// Do not sniff content-type for HTTP 0.9 servers on ports other than 80 for HTTP or 443 for HTTPS (CORE-35973).
		if (m_official_content_type == URL_UNDETERMINED_CONTENT)
			RETURN_IF_ERROR(m_url->SetAttribute(URL::KContentType, URL_TEXT_CONTENT));

		return OpStatus::OK;
	}

	RETURN_IF_ERROR(m_url->GetAttribute(URL::KOriginalMIME_Type, m_official_mime_type));
	int mime_length = m_official_mime_type.Length();

	URLContentType sniffed_content_type = m_official_content_type;
	OpStringC8 sniffed_mime_type;

	OpAutoPtr<URL_DataDescriptor> desc(m_url->GetDescriptor(NULL, URL::KFollowRedirect, TRUE));
	if (!desc.get())
	{
		m_octets = NULL;
		m_length = 0;
	}
	else
	{
		BOOL more;
		RETURN_IF_LEAVE(m_length = desc->RetrieveDataL(more));
		m_octets = desc->GetBuffer();
	}

#ifdef NEED_URL_EXTERNAL_GET_MIME_FROM_SAMPLE
	if (CheckExternally())
		return OpStatus::OK;
#endif

	if (m_url->GetAttribute(URL::KMultimedia))
	{
		RETURN_IF_ERROR(IsVideo(sniffed_content_type, sniffed_mime_type));
	}
	else if (m_official_mime_type.CompareI("text/plain") == 0)
	{
		RETURN_IF_ERROR(IsTextOrBinary(sniffed_content_type, sniffed_mime_type));
	}
	else if (m_official_mime_type.IsEmpty() ||
			 m_official_mime_type.CompareI("unknown/unknown") == 0 ||
			 m_official_mime_type.CompareI("application/unknown") == 0 ||
			 m_official_mime_type.CompareI("*/*") == 0)
	{
		RETURN_IF_ERROR(IsUnknownType(sniffed_content_type, sniffed_mime_type));
	}
	else if (m_official_mime_type.FindI("+xml") == mime_length - 4 ||
			 m_official_mime_type.CompareI("text/xml") == 0	||
			 m_official_mime_type.CompareI("application/xml") == 0)
	{
		return OpStatus::OK;
	}
	else if (m_official_mime_type.CompareI("image/", 6) == 0)
	{
		RETURN_IF_ERROR(IsImage(sniffed_content_type, sniffed_mime_type));
	}

	if (m_dont_leave_undetermined && sniffed_content_type == URL_UNDETERMINED_CONTENT)
	{
		sniffed_content_type = URL_UNKNOWN_CONTENT;
		m_url->SetAttribute(URL::KUntrustedContent, TRUE);
		sniffed_mime_type = "application/octet-stream";
	}

	if (sniffed_content_type != m_official_content_type)
	{
		/* CORE-39801: If we sniffed a container format (such as ZIP or GZIP),
		 * check if the URL string suggests a file extension of a known format
		 * using that format as its container. If so, allow it through if we
		 * originally did not get a valid Content-Type. */
		OpString fileext;
		TRAPD(err, m_url->GetAttributeL(URL::KUniNameFileExt_L, fileext, URL::KFollowRedirect));
		if (OpStatus::IsSuccess(err) && !fileext.IsEmpty())
		{
			Viewer *viewer = NULL;
			OP_STATUS rc = g_viewers->FindViewerByExtension(fileext, viewer);
			if (OpStatus::IsSuccess(rc) && viewer && viewer->AllowedContainer()
				&& 0 == op_strcmp(viewer->AllowedContainer(), sniffed_mime_type.CStr()))
			{
				sniffed_content_type = viewer->GetContentType();
				sniffed_mime_type = viewer->GetContentTypeString8();
			}
			else if (OpStatus::IsMemoryError(rc))
			{
				/* Propagate out-of-memory errors only; any other error just
				 * means we didn't find a Viewer object. */
				return rc;
			}
		}

		RETURN_IF_ERROR(m_url->SetAttribute(URL::KContentType, sniffed_content_type));
		RETURN_IF_ERROR(m_url->SetAttribute(URL::KUntrustedContent, TRUE));
		RETURN_IF_ERROR(m_url->SetAttribute(URL::KMIME_Type, sniffed_mime_type));
	}

	return OpStatus::OK;
}