当前位置: 首页>>代码示例>>C++>>正文


C++ Window::GetGadget方法代码示例

本文整理汇总了C++中Window::GetGadget方法的典型用法代码示例。如果您正苦于以下问题:C++ Window::GetGadget方法的具体用法?C++ Window::GetGadget怎么用?C++ Window::GetGadget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Window的用法示例。


在下文中一共展示了Window::GetGadget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

OP_STATUS
OpSecurityManager_DOM::CheckExtensionSecurity(const OpSecurityContext& source, const OpSecurityContext& target, BOOL& allowed)
{
    OpGadget *owner = target.GetGadget();

    if (owner)
    {
        RETURN_IF_ERROR(g_secman_instance->CheckGadgetExtensionSecurity(source, target, allowed));
        if (!allowed)
            return OpStatus::OK;
    }

    FramesDocument *frames_doc = source.GetFramesDocument();
    Window *window = frames_doc->GetWindow();

    // Do not run on gadgets, dialogs, or devtools.
    if (window->GetGadget() || window->GetType() == WIN_TYPE_DIALOG || window->GetType() == WIN_TYPE_DEVTOOLS)
        allowed = FALSE;
    // Extension JS not allowed run in javascript: or opera: content.
    else if (target.GetURL().Type() == URL_OPERA || target.GetURL().Type() == URL_JAVASCRIPT)
        allowed = FALSE;
    else
        allowed = TRUE;

    return OpStatus::OK;
}
开发者ID:prestocore,项目名称:browser,代码行数:26,代码来源:security_dom.cpp

示例2: CheckInlineSecurity

OP_STATUS OpSecurityManager_DOC::CheckInlineSecurity(const OpSecurityContext& source, const OpSecurityContext& target, BOOL& allowed, OpSecurityState& state)
{
	allowed = FALSE;
	state.suspended = FALSE;
	state.host_resolving_comm = NULL;

#ifdef GADGET_SUPPORT
	if (source.IsGadget())
		return g_secman_instance->CheckGadgetUrlLoadSecurity(source, target, allowed, state);
#endif // GADGET_SUPPORT

	FramesDocument* doc = source.GetDoc();
	BOOL from_user_css = target.IsFromUserCss();
	URL inline_url = target.GetURL();

	URLType inline_url_type = inline_url.Type(), doc_url_type = doc->GetSecurityContext().Type();

	/* Disallow javascript: URLs for all inline types. */
	if (inline_url.Type() == URL_JAVASCRIPT)
		return OpStatus::OK;

	if (doc->GetSuppress(inline_url_type))
		return OpStatus::OK;

	if (inline_url_type == URL_FILE && doc_url_type != URL_FILE && doc_url_type != URL_EMAIL)
	{
		BOOL reject_file = TRUE;

		if (from_user_css)
			/* We're allowed to load file url resources from user stylesheets. */
			reject_file = FALSE;

#ifdef _LOCALHOST_SUPPORT_
		else if (doc->GetLogicalDocument() && doc->GetLogicalDocument()->IsXmlParsingFailed() && target.inline_type == CSS_INLINE)
		{
			/* The document is a generated XML parsing error document that links in
			   a stylesheet from a local file. Allow it (and its assumed import) only. */
			OP_BOOLEAN result = IsAllowedStyleFileImport(target.GetURL());
			RETURN_IF_ERROR(result);
			if (result == OpBoolean::IS_TRUE)
				reject_file = FALSE;
		}
#endif // _LOCALHOST_SUPPORT_

		else if (doc->IsGeneratedByOpera())
			reject_file = FALSE;

		else if (inline_url.GetAttribute(URL::KIsGeneratedByOpera))
			reject_file = FALSE;

#ifdef WEBFEEDS_DISPLAY_SUPPORT
		if (doc->IsInlineFeed())
			/* The document is a generated HTML document that might link in
			   local stylesheets */
			reject_file = FALSE;
#endif // WEBFEEDS_DISPLAY_SUPPORT

#ifdef GADGET_SUPPORT
#ifdef DOM_JIL_API_SUPPORT
		if (doc->GetWindow()->GetGadget() &&
			doc->GetWindow()->GetGadget()->GetClass()->HasJILFilesystemAccess())
			/* This is JIL widget which has access to the filesystem */
			reject_file = FALSE;
#endif // DOM_JIL_API_SUPPORT
#endif // GADGET_SUPPORT

		if (reject_file)
			return OpStatus::OK;
	}

	if (inline_url_type == URL_OPERA && doc_url_type != URL_OPERA)
	{
		BOOL reject_opera = TRUE;

		if (doc->GetURL().IsImage() && inline_url.GetAttribute(URL::KPath).Compare("style/image.css") == 0)
			/* The document is a generated HTML document that links in a
			   stylesheet from 'opera:style/image.css'. */
			reject_opera = FALSE;

#ifdef MEDIA_HTML_SUPPORT
		if (g_media_module.IsMediaPlayableUrl(doc->GetURL()) &&
			inline_url.GetAttribute(URL::KPath).Compare("style/media.css") == 0)
			reject_opera = FALSE;
#endif // MEDIA_HTML_SUPPORT

		if (IsAboutBlankURL(inline_url))
			reject_opera = FALSE;

		if (reject_opera)
			return OpStatus::OK;
	}

#ifdef GADGET_SUPPORT
	Window* window = doc->GetWindow();
	if (inline_url_type == URL_WIDGET)
	{
		RETURN_IF_ERROR(g_secman_instance->CheckHasGadgetManagerAccess(source, allowed));
		if (allowed)
			return OpStatus::OK;
	}
//.........这里部分代码省略.........
开发者ID:prestocore,项目名称:browser,代码行数:101,代码来源:security_doc.cpp


注:本文中的Window::GetGadget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。