• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ NPVARIANT_IS_OBJECT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中NPVARIANT_IS_OBJECT函数的典型用法代码示例。如果您正苦于以下问题:C++ NPVARIANT_IS_OBJECT函数的具体用法?C++ NPVARIANT_IS_OBJECT怎么用?C++ NPVARIANT_IS_OBJECT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: return

// This method is also called before the JS engine attempts to add a new
// property, most likely it's trying to check that the key is supported.
// It only returns false if the string name was not found, or does not
// hold a callable object
bool GenericNPObject::HasProperty(NPIdentifier name) {

	if (invalid) return false;

	if (NPNFuncs.identifierisstring(name)) {

		char *key = NPNFuncs.utf8fromidentifier(name);
		if (immutables.count(key) > 0) {

			if (NPVARIANT_IS_OBJECT(immutables[key])) {

				return (NULL == immutables[key].value.objectValue->_class->invokeDefault);
			}
		}
		else if (alpha_mapper.count(key) > 0) {

			if (NPVARIANT_IS_OBJECT(alpha_mapper[key])) {

				return (NULL == alpha_mapper[key].value.objectValue->_class->invokeDefault);
			}
		}

		return false;
	}

	return true;
}
开发者ID:airm008,项目名称:ff-activex-host,代码行数:31,代码来源:GenericNPObject.cpp


示例2: if

bool GenericNPObject::Invoke(NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result) {

	if (invalid) return false;

	if (NPNFuncs.identifierisstring(name)) {

		char *key = NPNFuncs.utf8fromidentifier(name);
		if (immutables.count(key) > 0) {

			if (   NPVARIANT_IS_OBJECT(immutables[key]) 
				&& immutables[key].value.objectValue->_class->invokeDefault) {

				return immutables[key].value.objectValue->_class->invokeDefault(immutables[key].value.objectValue, args, argCount, result);
			}
		}
		else if (alpha_mapper.count(key) > 0) {

			if (   NPVARIANT_IS_OBJECT(alpha_mapper[key])
				&& alpha_mapper[key].value.objectValue->_class->invokeDefault) {

				return alpha_mapper[key].value.objectValue->_class->invokeDefault(alpha_mapper[key].value.objectValue, args, argCount, result);
			}
		}
	}

	return true;
}
开发者ID:airm008,项目名称:ff-activex-host,代码行数:27,代码来源:GenericNPObject.cpp


示例3: DeleteInstance

bool nsScriptableObjectRawInput::DeleteInstance(
	NPIdentifier name,
	const NPVariant *args,
	uint32_t argCount,
	NPVariant *result) {
	if (argCount != 2 ||
		!NPVARIANT_IS_DOUBLE(args[0]) ||
		!NPVARIANT_IS_OBJECT(args[1])) {
		NPN_SetException(this, "(DeleteInstance) invalid params passed to function");
		return true;
	}
	int32_t id = (int32_t)(int)floor(NPVARIANT_TO_DOUBLE(args[0]) + 0.5);	// all numbers come in as double in chrome...

	bool foundAndDeleted = PluginMethodKeyCapture::DeleteInstance(id);

	NPVariant out_args[2];
	NPVariant ret_val;

	BOOLEAN_TO_NPVARIANT(foundAndDeleted, out_args[0]);
	INT32_TO_NPVARIANT(id, out_args[1]);

	// fire callback
	NPN_InvokeDefault(
		__super::npp_,
		NPVARIANT_TO_OBJECT(args[1]),
		out_args,
		2,
		&ret_val);

	NPN_ReleaseVariantValue(&ret_val);
	return true;
}
开发者ID:o4kapuk,项目名称:overwolf-plugin-rawinput,代码行数:32,代码来源:nsScriptableObjectRawInput.cpp


示例4: plugin_object_set_property

static bool
plugin_object_set_property (NPObject        *npobj,
			    NPIdentifier     name,
			    const NPVariant *value)
{
  PluginObject *obj;

  g_return_val_if_fail (plugin_object_has_property (npobj, name), FALSE);

  obj = (PluginObject*) npobj;
  if (obj->listener)
    funcs.releaseobject (obj->listener);

  obj->listener = NULL;
  if (NPVARIANT_IS_OBJECT (*value))
    {
      obj->listener = NPVARIANT_TO_OBJECT (*value);
      funcs.retainobject (obj->listener);
      return TRUE;
    }
  else if (NPVARIANT_IS_NULL (*value))
    return TRUE;

  return FALSE;
}
开发者ID:gcampax,项目名称:sweettooth-plugin,代码行数:25,代码来源:sweettooth-plugin.c


示例5: Add

bool nsScriptableObjectOverwolfSample::Add(
  NPIdentifier name, 
  const NPVariant *args, 
  uint32_t argCount, 
  NPVariant *result) {

  if (argCount < 3 ||
      !NPVARIANT_IS_DOUBLE(args[0]) ||
      !NPVARIANT_IS_DOUBLE(args[1]) ||
      !NPVARIANT_IS_OBJECT(args[2])) {
    NPN_SetException(this, "invalid params passed to function");
    return true;
  }

  // add ref count to callback object so it won't delete
  NPN_RetainObject(NPVARIANT_TO_OBJECT(args[2]));

  // post to separate thread so that we are responsive
  return thread_->PostTask(
    std::bind(
      &nsScriptableObjectOverwolfSample::AddTask, 
      this, 
      NPVARIANT_TO_DOUBLE(args[0]), 
      NPVARIANT_TO_DOUBLE(args[1]), 
      NPVARIANT_TO_OBJECT(args[2])));
}
开发者ID:Capibara-,项目名称:overwolf-sample-plugin,代码行数:26,代码来源:nsScriptableObjectOverwolfSample.cpp


示例6: doSign

bool doSign(PluginInstance *obj, NPVariant *args, unsigned argCount, NPVariant *result) {
	EstEID_log("obj=%p, name=sign argCount=%u", obj, argCount);

	FAIL_IF_NOT_ALLOWED_SITE;

	if (argCount < 2) {
		browserFunctions->setexception(&obj->header, "Missing arguments");
		return false;
	}
	
	if(argCount > 2 && NPVARIANT_IS_OBJECT(args[2])){
		strncpy(pluginLanguage, getLanguageFromOptions(obj, args[2]), 2);
	}
	EstEID_setLocale(pluginLanguage);

	void* wnd = getNativeWindowHandle(obj);

	EstEID_PINPromptData pinPromptData = {promptForPIN, showAlert, wnd};
	NPUTF8* certId = createStringFromNPVariant(&args[0]);
	NPUTF8* hash = createStringFromNPVariant(&args[1]);
	char *signature = NULL;

#ifdef _WIN32
	DialogData dialogData;
	dialogData.pin2[0] = '\0';
	dialogData.minPin2Length = 5;
	dialogData.certId = certId;
	dialogData.hash = hash;
	dialogData.signature[0] = '\0';

	CK_SLOT_ID slotId;	
	if(EstEID_getSlotId(certId, &slotId)){
		if(EstEID_isPinPad(slotId)) {
			signature = EstEID_sign(certId, hash, pinPromptData);
		}
		else {
			DialogBoxParam(pluginInstance, MAKEINTRESOURCEW(IDD_PIN_DIALOG), (HWND)wnd, Pin2DialogProc, (LPARAM)&dialogData);
			LOG_LOCATION;
			signature = (char*)malloc(SIGNATURE_BUFFER_SIZE); // check?
			strcpy(signature, dialogData.signature);
		}
	}
	else {
		return false;
	}
#else
	signature = EstEID_sign(certId, hash, pinPromptData);
#endif
	LOG_LOCATION
	if (signature) {
		copyStringToNPVariant(signature, result);
		free(signature);
		return true;
	}
	else {
		EstEID_log("EstEID_error=%s", EstEID_error);
		browserFunctions->setexception(&obj->header, EstEID_error);
		return false;
	}
}
开发者ID:Krabi,项目名称:idkaart_public,代码行数:60,代码来源:plugin-class.c


示例7: debug

static NPObject *get_scroller_mojo(NPP instance, NPObject *scroller)
	{
	if(!scroller)
		{
		debug(DBG_MAIN, "get_scroller_mojo: no scroller");
		return 0;
		}
	//debug(DBG_MAIN, "get_scroller_mojo");
	NPIdentifier mojoID = NPNFuncs.getstringidentifier("mojo");
	//debug(DBG_MAIN, "get_scroller_mojo npp:%p, scroller:%p, id:%p", instance, scroller, mojoID);
	if(!NPNFuncs.hasproperty(instance, scroller, mojoID) && !NPNFuncs.hasmethod(instance, scroller, mojoID))
		{
		debug(DBG_MAIN, "get_scroller_mojo: no property/method mojo");
		return 0;
		}
	NPVariant var;
	int ok = NPNFuncs.getproperty(instance, scroller, mojoID, &var);
	if(!ok || !NPVARIANT_IS_OBJECT(var))
		{
		debug(DBG_MAIN, "get_scroller_mojo: ok:%d, mojo - var.type:%d (not object)", ok, var.type);
		return 0;
		}
	//debug(DBG_MAIN, "get_scroller_mojo");
	NPObject *mojoObj = NPVARIANT_TO_OBJECT(var);
	return mojoObj;
	}
开发者ID:wosigh,项目名称:terminal,代码行数:26,代码来源:api.c


示例8: getScrollPosition

int getScrollPosition(NPP instance, NPObject *scroller)
	{
	NPVariant var;
	//var.type = NPVariantType_Void;
	scrollCommon(instance, scroller, "getScrollPosition", 0, 0, &var);
	NPObject *obj = NPVARIANT_TO_OBJECT(var);
	if(!NPVARIANT_IS_OBJECT(var) || !obj)
		{
		debug(DBG_MAIN, "getScrollPosition() expected obj, got %d (obj:%p)", var.type, obj);
		return -1;
		}
	//	Get the current position of the scroller. Returns {left: nnn px, top: nnn px}
	NPIdentifier id = NPNFuncs.getstringidentifier("top");
	//debug(DBG_MAIN, "getScrollPosition()");

	if(!NPNFuncs.hasproperty(instance, obj, id) && !NPNFuncs.hasmethod(instance, obj, id))
		{
		debug(DBG_MAIN, "getScrollPosition: no property/method: top, obj:%p", obj);
		return -2;
		}

#ifdef DEBUG_OUTPUT
	bool ok =
#endif
		NPNFuncs.getproperty(instance, obj, id, &var);
	int val = IntValue(&var);
	debug(DBG_MAIN, "getScrollPosition() %s val:%d, type:%d", ok ? "OK" : "ERROR", val, var.type);
	//if(NPVARIANT_IS_DOUBLE(var))
	//	debug(DBG_MAIN, "+++++ getScrollPosition() = double:%g", NPVARIANT_TO_DOUBLE(var));
	//else if(NPVARIANT_IS_INT32(var))
	//	debug(DBG_MAIN, "----- getScrollPosition() = int:%d", NPVARIANT_TO_INT32(var));
	return val;
	}
开发者ID:wosigh,项目名称:terminal,代码行数:33,代码来源:api.c


示例9: CopyNPVariant

static bool CopyNPVariant(NPVariant *dst, const NPVariant *src)
{
	dst->type = src->type;
	if (NPVARIANT_IS_STRING(*src)) {

		NPUTF8 *str = (NPUTF8 *)NPNFuncs.memalloc((src->value.stringValue.UTF8Length + 1) * sizeof(NPUTF8));
		if (NULL == str) {

			return false;
		}
		dst->value.stringValue.UTF8Length = src->value.stringValue.UTF8Length;

		memcpy(str, src->value.stringValue.UTF8Characters, src->value.stringValue.UTF8Length);
		str[dst->value.stringValue.UTF8Length] = 0;

		dst->value.stringValue.UTF8Characters = str;
	}
	else if (NPVARIANT_IS_OBJECT(*src)) {

		NPNFuncs.retainobject(NPVARIANT_TO_OBJECT(*src));
		dst->value.objectValue = src->value.objectValue;
	}
	else {

		dst->value = src->value;
	}

	return true;
}
开发者ID:airm008,项目名称:ff-activex-host,代码行数:29,代码来源:GenericNPObject.cpp


示例10: Echo

bool nsScriptableObjectOverwolfSample::Echo(
  NPIdentifier name, 
  const NPVariant *args, 
  uint32_t argCount, 
  NPVariant *result) {

  if (argCount < 2 ||
    !NPVARIANT_IS_STRING(args[0]) ||
    !NPVARIANT_IS_OBJECT(args[1])) {
      NPN_SetException(this, "invalid params passed to function");
      return true;
  }

  // add ref count to callback object so it won't delete
  NPN_RetainObject(NPVARIANT_TO_OBJECT(args[1]));

  // convert into std::string
  std::string message;
  message.append(
    NPVARIANT_TO_STRING(args[0]).UTF8Characters,
    NPVARIANT_TO_STRING(args[0]).UTF8Length);

  // post to separate thread so that we are responsive
  return thread_->PostTask(
    std::bind(
      &nsScriptableObjectOverwolfSample::EchoTask, 
      this, 
      message, 
      NPVARIANT_TO_OBJECT(args[1])));
}
开发者ID:Capibara-,项目名称:overwolf-sample-plugin,代码行数:30,代码来源:nsScriptableObjectOverwolfSample.cpp


示例11: CallJSMethod

bool CJSMethods::GetLanguage(ChromeTrayIconLanguage &language)
{
	if(m_pScriptableObject == NULL)
	{
		return false;
	}

	NPP pluginInstance				= m_pScriptableObject->GetPluginInstance();
	NPNetscapeFuncs *pBrowserFuncs	= m_pScriptableObject->GetBrowserFuncs();

	if(pluginInstance == NULL || pBrowserFuncs == NULL)
	{
		return false;
	}

	NPVariant varResults;
	NPVariant varArgs;

	bool bResult = CallJSMethod(pBrowserFuncs, pluginInstance, "getLanguage", &varArgs, 0, varResults);

	if(bResult)
	{
		if(NPVARIANT_IS_OBJECT(varResults))
		{
			NPObject *pArray = NPVARIANT_TO_OBJECT(varResults);

			if(pArray != NULL)
			{
				wstring strValue;

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "lngOptions", strValue))
				{
					language.strOptions = strValue;
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "lngNewTab", strValue))
				{
					language.strNewTab = strValue;
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "lngNewWindow", strValue))
				{
					language.strNewWindow = strValue;
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "lngFavorites", strValue))
				{
					language.strFavorites = strValue;
				}
			}
		}
	}

	pBrowserFuncs->releasevariantvalue(&varArgs);
	pBrowserFuncs->releasevariantvalue(&varResults);

	return bResult;
}
开发者ID:Chrismiqui,项目名称:minimizetotray,代码行数:58,代码来源:JSMethods.cpp


示例12: DeferNPVariantLastRelease

void DeferNPVariantLastRelease(const NPNetscapeFuncs* f, NPVariant* v)
{
  if (!NPVARIANT_IS_OBJECT(*v)) {
    f->releasevariantvalue(v);
    return;
  }
  DeferNPObjectLastRelease(f, v->value.objectValue);
  VOID_TO_NPVARIANT(*v);
}
开发者ID:Ajunboys,项目名称:mozilla-os2,代码行数:9,代码来源:PluginMessageUtils.cpp


示例13: getInterfaceName

std::string getInterfaceName(NPP npp, NPObject* object)
{
    std::string className;
    NPVariant result;
    bool asConstructor = true;  // true if object can be a constructor

    VOID_TO_NPVARIANT(result);
    NPN_Invoke(npp, object, NPN_GetStringIdentifier("toString"), 0, 0, &result);
    for (;;)
    {
        if (NPVARIANT_IS_STRING(result))
        {
            className = std::string(NPVARIANT_TO_STRING(result).utf8characters,
                                    NPVARIANT_TO_STRING(result).utf8length);
        }
        NPN_ReleaseVariantValue(&result);
        if (className.compare(0, 9, "function ") == 0)
        {
            // In Chrome, a [Constructor] object is represented as a 'Function'.
            className = className.substr(9);
            size_t pos = className.find('(');
            if (pos != std::string::npos)
            {
                className = className.substr(0, pos);
                break;
            }
            return "Function";
        }
        if (className.compare(0, 8, "[object ", 8) == 0 && className[className.length() - 1] == ']')
        {
            className = className.substr(8, className.length() - 9);
            break;
        }
        // This object is likely to have a stringifier. Check the constructor name directly.
        NPVariant constructor;
        VOID_TO_NPVARIANT(constructor);
        if (asConstructor && NPN_GetProperty(npp, object, NPN_GetStringIdentifier("constructor"), &constructor))
        {
            if (NPVARIANT_IS_OBJECT(constructor) &&
                NPN_Invoke(npp, NPVARIANT_TO_OBJECT(constructor), NPN_GetStringIdentifier("toString"), 0, 0, &result))
            {
                NPN_ReleaseVariantValue(&constructor);
                asConstructor = false;
                continue;
            }
            NPN_ReleaseVariantValue(&constructor);
        }
        return "Object";
    }
    // In Firefox, the constructor and an instance object cannot be distinguished by toString().
    // Check if object has a 'prototype' to see if it is a constructor.
    if (asConstructor && NPN_HasProperty(npp, object, NPN_GetStringIdentifier("prototype")))
    {
        className += "_Constructor";
    }
    return className;
}
开发者ID:giobeatle1794,项目名称:es-operating-system,代码行数:57,代码来源:bridge.cpp


示例14: ExecuteListenOnFile

bool PluginMethodListenOnFile::ExecuteListenOnFile(
  const NPVariant *args,
  uint32_t argCount,
  NPVariant *result) {
  std::string filename;
  bool skip_to_end = false;

  try {
    if (argCount < 3 ||
      !NPVARIANT_IS_STRING(args[0]) ||
      !NPVARIANT_IS_BOOLEAN(args[1]) ||
      !NPVARIANT_IS_OBJECT(args[2])) {
      NPN_SetException(
        object_, 
        "invalid or missing params passed to function - expecting 3 params: "
        "filename, skipToEnd, callback(status, data)");
      return false;
    }

    callback_ = NPVARIANT_TO_OBJECT(args[2]);
    skip_to_end = NPVARIANT_TO_BOOLEAN(args[1]);

    // add ref count to callback object so it won't delete
    NPN_RetainObject(callback_);

    filename.append(
      NPVARIANT_TO_STRING(args[0]).UTF8Characters,
      NPVARIANT_TO_STRING(args[0]).UTF8Length);  
  } catch(...) {

  }

  if (nullptr == thread_.get()) {
    thread_.reset(new utils::Thread);
    if (!thread_->Start()) {
      NPN_SetException(
        __super::object_,
        "an unexpected error occurred - couldn't start file listening thread");
      return false;
    }
  }

  std::wstring wide_filename = utils::Encoders::utf8_decode(filename);

  if (!file_stream_.Initialize(wide_filename.c_str(), this, skip_to_end)) {
    NPN_SetException(
      __super::object_,
      "an unexpected error occurred - couldn't open the file for read access");
    return false;
  }

  return thread_->PostTask(
    std::bind(
    &PluginMethodListenOnFile::StartListening,
    this));
}
开发者ID:Ridrog,项目名称:overwolf-simple-io-plugin,代码行数:56,代码来源:plugin_method_listen_on_file.cpp


示例15: plugin_object_set_callback

static bool
plugin_object_set_callback (NPObject        **listener,
                            const NPVariant  *value)
{
  if (!NPVARIANT_IS_OBJECT (*value) && !NPVARIANT_IS_NULL (*value))
    return FALSE;

  if (*listener)
    funcs.releaseobject (*listener);
  *listener = NULL;

  if (NPVARIANT_IS_OBJECT (*value))
    {
      *listener = NPVARIANT_TO_OBJECT (*value);
      funcs.retainobject (*listener);
    }

  return TRUE;
}
开发者ID:PeterDaveHello,项目名称:deepin-gnome-shell,代码行数:19,代码来源:browser-plugin.c


示例16: onLoad

bool JsAgent::onLoad(const NPVariant* args, unsigned argCount) {
	Debug::println("JsAgent::onLoad");

	if(argCount != 4) {
		Debug::println("JsAgent::onLoad> argCount != 4");
		return false;
	}

	if( !NPVARIANT_IS_OBJECT(args[0]) ||
		!NPVARIANT_IS_STRING(args[1]) ||
		!NPVARIANT_IS_INT32(args[2]) ||
		!NPVARIANT_IS_STRING(args[3]) ) {
		Debug::println("JsAgent::onLoad> arg types wrong");
		return false;
	}

	NPObject* pObject = NPVARIANT_TO_OBJECT(args[0]);
	m_helper = NPN_RetainObject(pObject);

	NPObject* pDebug = NPN_CreateObject(getNPP(), GetNPClass<JsDebug>());
	NPN_RetainObject(pDebug);
	Variant var;
	var.set(pDebug);

	if(!NPN_SetProperty(getNPP(), m_window, methods.debug, var.ptr())) {
		Debug::println("JsAgent::onLoad> set property failed");
		return false;
	}

	NPString npstr = NPVARIANT_TO_STRING(args[1]);
	std::string host(npstr.UTF8Characters, npstr.UTF8Length);

	int port = NPVARIANT_TO_INT32(args[2]);

	npstr = NPVARIANT_TO_STRING(args[3]);
	std::string typeName(npstr.UTF8Characters, npstr.UTF8Length);

	if(!m_channel->connect(host.c_str(), port)) {
		Debug::println("JsAgent::onLoad> could not connect");
		return false;
	}

	LoadMessage msg;
	msg.typeName = typeName;

	ArchiveWriter<Channel> ar(*m_channel);
	if(!Message::send(msg, ar)) {
		Debug::println("JsAgent::onLoad> send failed");
		return false;
	}

	JsValue ret;
	return dispatchAndReturn(ret);
}
开发者ID:JimmyJune,项目名称:DotWeb,代码行数:54,代码来源:JsAgent.cpp


示例17: doSign

bool doSign(PluginInstance *obj, NPVariant *args, unsigned argCount, NPVariant *result) {
	EstEID_log("obj=%p, name=sign argCount=%u", obj, argCount);

	FAIL_IF_NOT_ALLOWED_SITE;

	if (argCount < 2) {
		browserFunctions->setexception(&obj->header, "Missing arguments");
		return false;
	}
	
	if(argCount > 2 && NPVARIANT_IS_OBJECT(args[2])){
		strncpy(pluginLanguage, getLanguageFromOptions(obj, args[2]), 2);
	}
	EstEID_setLocale(pluginLanguage);

	if(argCount > 3 && NPVARIANT_IS_OBJECT(args[3])){
		strcpy(promptMessage, createStringFromNPVariant(args[3]));
	}

	void* wnd = getNativeWindowHandle(obj);

	EstEID_PINPromptData pinPromptData = {promptForPIN, showAlert, wnd, promptMessage, NULL};
	NPUTF8* certId = createStringFromNPVariant(&args[0]);
	NPUTF8* hash = createStringFromNPVariant(&args[1]);
	char *signature = NULL;

	signature = EstEID_sign(certId, hash, pinPromptData);

	LOG_LOCATION
	if (signature) {
		copyStringToNPVariant(signature, result);
		free(signature);
		return true;
	}
	else {
		EstEID_log("EstEID_error=%s", EstEID_error);
		browserFunctions->setexception(&obj->header, EstEID_error);
		return false;
	}
}
开发者ID:Pablo-Merino,项目名称:browser-token-signing,代码行数:40,代码来源:plugin-class.c


示例18: get_element_property_object

static gboolean
get_element_property_object (NPP npp, NPObject *object, NPIdentifier property, NPVariant *child)
{
	VOID_TO_NPVARIANT (*child);

	if (!NPN_GetProperty (npp, object, property, child) ||
		!NPVARIANT_IS_OBJECT (*child)) {
		NPN_ReleaseVariantValue (child);
		return FALSE;
	}

	return TRUE;
}
开发者ID:deejay1,项目名称:moonshine,代码行数:13,代码来源:mmp-script.c


示例19: topmost_rect_ptac

static
void
topmost_rect_ptac(void *param)
{
    struct topmost_rect_param_s *p = param;
    struct pp_instance_s *pp_i = tables_get_pp_instance(p->instance);
    if (!pp_i) {
        trace_error("%s, no instance\n", __func__);
        goto err_1;
    }

    p->result = PP_FALSE;

    NPString topmost_func_src = NPString_literal(
        "(function(elem, x, y) {"
            "var r = elem.getBoundingClientRect();"
            "return document.elementFromPoint(x + r.left, y + r.top) == elem;"
        "})");
    NPVariant topmost_func;

    if (!npn.evaluate(pp_i->npp, pp_i->np_window_obj, &topmost_func_src, &topmost_func))
        goto err_1;

    if (!NPVARIANT_IS_OBJECT(topmost_func))
        goto err_1;

    NPObject *topmost_func_obj = NPVARIANT_TO_OBJECT(topmost_func);

    NPVariant is_topmost;
    NPVariant args[3];

    OBJECT_TO_NPVARIANT(pp_i->np_plugin_element_obj, args[0]);
    INT32_TO_NPVARIANT(p->rect.point.x + p->rect.size.width / 2, args[1]);
    INT32_TO_NPVARIANT(p->rect.point.y + p->rect.size.height / 2, args[2]);

    if (!npn.invokeDefault(pp_i->npp, topmost_func_obj, args, 3, &is_topmost))
        goto err_2;

    if (!NPVARIANT_IS_BOOLEAN(is_topmost))
        goto err_3;

    p->result = NPVARIANT_TO_BOOLEAN(is_topmost);

err_3:
    npn.releasevariantvalue(&is_topmost);
err_2:
    npn.releasevariantvalue(&topmost_func);
err_1:
    ppb_message_loop_post_quit_depth(p->m_loop, PP_FALSE, p->depth);
}
开发者ID:Happy-Ferret,项目名称:freshplayerplugin,代码行数:50,代码来源:ppb_flash.c


示例20: invoke_in_s_out_o

static gboolean
invoke_in_s_out_o (NPP npp, NPVariant *object, NPIdentifier method, const gchar *in_s, NPVariant *out_o)
{
	NPVariant string;
	STRINGZ_TO_NPVARIANT (in_s, string);
	VOID_TO_NPVARIANT (*out_o);

	if (!NPN_Invoke (npp, NPVARIANT_TO_OBJECT (*object), method, &string, 1, out_o) ||
		!NPVARIANT_IS_OBJECT (*out_o)) {
		NPN_ReleaseVariantValue (out_o);
		return FALSE;
	}

	return TRUE;
}
开发者ID:deejay1,项目名称:moonshine,代码行数:15,代码来源:mmp-script.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ NPVARIANT_IS_STRING函数代码示例发布时间:2022-05-30
下一篇:
C++ NPT_SUCCEEDED函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap