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


C++ NPNetscapeFuncs::releasevariantvalue方法代码示例

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


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

示例1: SelectWindowTab

bool CJSMethods::SelectWindowTab(int nTabId)
{
	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;
	INT32_TO_NPVARIANT(nTabId, varArgs);

	bool bResult = CallJSMethod(pBrowserFuncs, pluginInstance, "selectWindowTab", &varArgs, 1, varResults);

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

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

示例2: NewWindow

bool CJSMethods::NewWindow()
{
	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, "newWindow", &varArgs, 0, varResults);

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

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

示例3: GetLanguage

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

示例4:

static inline gchar *
get_string_property (NPP         instance,
                     NPObject   *obj,
                     const char *name)
{
  NPVariant result = { NPVariantType_Void };
  NPString result_str;
  gchar *result_copy;

  result_copy = NULL;

  if (!funcs.getproperty (instance, obj,
                          funcs.getstringidentifier (name),
                          &result))
    goto out;

  if (!NPVARIANT_IS_STRING (result))
    goto out;

  result_str = NPVARIANT_TO_STRING (result);
  result_copy = g_strndup (result_str.UTF8Characters, result_str.UTF8Length);

 out:
  funcs.releasevariantvalue (&result);
  return result_copy;
}
开发者ID:PeterDaveHello,项目名称:deepin-gnome-shell,代码行数:26,代码来源:browser-plugin.c

示例5:

static void
cloud_spy_log (const gchar * log_domain, GLogLevelFlags log_level, const gchar * message, gpointer user_data)
{
  NPNetscapeFuncs * browser = cloud_spy_nsfuncs;
  NPP instance = static_cast<NPP> (user_data);
  NPObject * window = NULL, * console = NULL;
  NPVariant variant, result;
  NPError error;

  (void) log_domain;
  (void) log_level;

  error = browser->getvalue (instance, NPNVWindowNPObject, &window);
  if (error != NPERR_NO_ERROR)
    goto beach;

  VOID_TO_NPVARIANT (variant);
  if (!browser->getproperty (instance, window, browser->getstringidentifier ("console"), &variant))
    goto beach;
  console = NPVARIANT_TO_OBJECT (variant);

  STRINGZ_TO_NPVARIANT (message, variant);
  VOID_TO_NPVARIANT (result);
  if (!browser->invoke (instance, console, browser->getstringidentifier ("log"), &variant, 1, &result))
    goto beach;
  browser->releasevariantvalue (&result);

beach:
  if (console != NULL)
    browser->releaseobject (console);
  if (window != NULL)
    browser->releaseobject (window);
}
开发者ID:key2,项目名称:frida-ire,代码行数:33,代码来源:cloud-spy-plugin.cpp

示例6:

static void
on_shell_signal (GDBusProxy *proxy,
		 gchar      *sender_name,
		 gchar      *signal_name,
		 GVariant   *parameters,
		 gpointer    user_data)
{
  PluginObject *obj = user_data;

  if (strcmp (signal_name, "ExtensionStatusChanged") == 0)
    {
      gchar *uuid;
      gint32 status;
      gchar *error;
      NPVariant args[3];
      NPVariant result;

      g_variant_get (parameters, "(sis)", &uuid, &status, &error);
      STRINGZ_TO_NPVARIANT (uuid, args[0]);
      INT32_TO_NPVARIANT (status, args[1]);
      STRINGZ_TO_NPVARIANT (error, args[2]);

      funcs.invokeDefault (obj->instance, obj->listener,
			   args, 3, &result);

      funcs.releasevariantvalue (&result);
      g_free (uuid);
      g_free (error);
    }
}
开发者ID:gcampax,项目名称:sweettooth-plugin,代码行数:30,代码来源:sweettooth-plugin.c

示例7: NPN_ReleaseVariantValue

void NPN_ReleaseVariantValue(NPVariant*variant)
{
    char msg[1024];
    sprintf(msg, "NPN_ReleaseVariantValue");
    logger->logMessage(msg);

    NPNFuncs.releasevariantvalue(variant);

    sprintf(msg, "--Return.");
    logger->logMessage(msg);
}
开发者ID:bluebellzhy,项目名称:chromium,代码行数:11,代码来源:npn_gate.cpp

示例8: if

void
NPN_ReleaseVariantValue(NPVariant *variant)
{
    if (NPNFuncs.releasevariantvalue) {
        NPNFuncs.releasevariantvalue(variant);
    } else {
        if (variant->type == NPVariantType_String) {
           NPString& strVar = NPVARIANT_TO_STRING(*variant);   
           NPUTF8* buffer = const_cast<NPUTF8*>(gnash::GetNPStringChars(strVar));
           NPN_MemFree(buffer);
        } else if (variant->type == NPVariantType_Object) {
           NPN_ReleaseObject(NPVARIANT_TO_OBJECT(*variant));
        }
        VOID_TO_NPVARIANT(*variant);
    }
}
开发者ID:ascendancy721,项目名称:gnash,代码行数:16,代码来源:npn_gate.cpp

示例9: R_NPAPI_GetProperty

SEXP R_NPAPI_GetProperty(SEXP plug, SEXP Robj, SEXP Rname, SEXP RconvRet)
{
 
  NPP inst = (NPP) R_ExternalPtrAddr(GET_SLOT( plug , Rf_install( "ref" ) ) );
  NPNetscapeFuncs *funcs = (NPNetscapeFuncs *) R_ExternalPtrAddr(GET_SLOT( GET_SLOT(plug, Rf_install("funcs")), Rf_install("ref")));

  NPVariant *obj = (NPVariant *) R_ExternalPtrAddr(GET_SLOT( Robj , Rf_install( "ref" ) ) );
  
  if(!NPVARIANT_IS_OBJECT(*obj))
    {
      //What should we return in this case?
      Rf_error("Robj is not an NPVariant containing an NPObject.");
      return R_NilValue;
    }
  convert_t convRet = (convert_t) INTEGER(RconvRet)[0];


  NPVariant *ret = (NPVariant *) funcs->memalloc(sizeof(NPVariant)); 
  
  const char *ccname = CHAR(STRING_ELT(Rname, 0));

  bool success = funcs->getproperty(inst, obj->value.objectValue, funcs->getstringidentifier(ccname), ret);
 
  if(!success)
    {
      Rf_error("Invoke failed.");
      return R_NilValue;
    }
    
  SEXP ans;
  PROTECT(ans = R_NilValue);
  //ConvertNPToR returns a bool which indicates whether it is safe to release the converted object.
  bool canfree = ConvertNPToR(ret, inst, funcs, convRet, &ans);

  if(canfree)
    funcs->releasevariantvalue(ret);
  
  UNPROTECT(1);
  
  return ans ;
}
开发者ID:gmbecker,项目名称:RBrowserPlugin,代码行数:41,代码来源:NPAPI.cpp

示例10: R_NPAPI_SetProperty

SEXP R_NPAPI_SetProperty(SEXP plug, SEXP Robj, SEXP Rname, SEXP Rval, SEXP RconvValue)
{
 
  NPP inst = (NPP) R_ExternalPtrAddr(GET_SLOT( plug , Rf_install( "ref" ) ) );
  NPNetscapeFuncs *funcs = (NPNetscapeFuncs *) R_ExternalPtrAddr(GET_SLOT( GET_SLOT(plug, Rf_install("funcs")), Rf_install("ref")));

  NPVariant *obj = (NPVariant *) R_ExternalPtrAddr(GET_SLOT( Robj , Rf_install( "ref" ) ) );
  
  if(!NPVARIANT_IS_OBJECT(*obj))
    {
      //What should we return in this case?
      Rf_error("Robj is not an NPVariant containing an NPObject.");
      return R_NilValue;
    }
  convert_t convVal = (convert_t) INTEGER(RconvValue)[0];

  
  //NPVariant *val = (NPVariant *) funcs->memalloc(sizeof(NPVariant)); 
  NPVariant val;
  ConvertRToNP(Rval, inst, funcs, &val, convVal);
  const char *ccname = CHAR(STRING_ELT(Rname, 0));

  bool success = funcs->setproperty(inst, obj->value.objectValue, funcs->getstringidentifier(ccname), &val);
 
  if(!success)
    {
      //funcs->memfree(val);
      Rf_error("SetProperty failed.");
      return R_NilValue;
    }
  else {
    funcs->releasevariantvalue(&val);
    //funcs->memfree(val);
  }
  return ScalarLogical(success) ;
}
开发者ID:gmbecker,项目名称:RBrowserPlugin,代码行数:36,代码来源:NPAPI.cpp

示例11: OpenUrl

bool CJSMethods::OpenUrl(wstring strUrl)
{
	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;

	char *pszUrl = new char[strUrl.size() + 4];
	int nConverted = WideCharToMultiByte(CP_ACP, 0, strUrl.c_str(), strUrl.size(), pszUrl, strUrl.size() + 1, NULL, NULL);
	pszUrl[nConverted] = '\0';
	
	NPVariant varArgs;
	STRINGN_TO_NPVARIANT(pszUrl, strlen(pszUrl), varArgs);

	bool bResult = CallJSMethod(pBrowserFuncs, pluginInstance, "openUrl", &varArgs, 1, varResults);

	// Dll will be crashed if you uncomment next line.
	// I don't know why, yet.
	//pBrowserFuncs->releasevariantvalue(&varArgs);

	pBrowserFuncs->releasevariantvalue(&varResults);

	delete [] pszUrl;

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

示例12: NPN_ReleaseVariantValue

void NPN_ReleaseVariantValue(NPVariant *variant)
{
  NPNFuncs.releasevariantvalue(variant);
}
开发者ID:gfunkmonk2,项目名称:mate-movie-player,代码行数:4,代码来源:idolNPNGlue.cpp

示例13: GetOptions


//.........这里部分代码省略.........
			if(pArray != NULL)
			{
				wstring strValue;

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "minimizeOnLeftButton", strValue))
				{
					options.bMinimizeOnLeftButton = (strValue == _T("true"));
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "minimizeOnRightButton", strValue))
				{
					options.bMinimizeOnRightButton = (strValue == _T("true"));
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "trayHide", strValue))
				{
					options.bHideTray = (strValue == _T("true"));
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "actLClick", strValue))
				{
					options.actLClick = (TrayAction)_wtoi(strValue.c_str());
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "actRClick", strValue))
				{
					options.actRClick = (TrayAction)_wtoi(strValue.c_str());
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "actLDblClick", strValue))
				{
					options.actLDblClick = (TrayAction)_wtoi(strValue.c_str());
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "displayOptions", strValue))
				{
					options.bShowOptions = (strValue == _T("true"));
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "displayNewWindow", strValue))
				{
					options.bShowNewWindow = (strValue == _T("true"));
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "displayNewTab", strValue))
				{
					options.bShowNewTab = (strValue == _T("true"));
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "displayFavorites", strValue))
				{
					options.bShowFavorites = (strValue == _T("true"));
				}

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

				//////////////////////////////////////////////////////////////////////////
				// Boss key
				//////////////////////////////////////////////////////////////////////////

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "enableBossKey", strValue))
				{
					options.bEnableBossKey = (strValue == _T("true"));
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "bossMod1", strValue))
				{
					options.wBossModifier = StringToKey(strValue.c_str());
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "bossMod2", strValue))
				{
					options.wBossModifier |= StringToKey(strValue.c_str());
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "bossKey", strValue))
				{
					if(strValue.empty() == FALSE)
					{
						transform(strValue.begin(), strValue.end(), strValue.begin(), toupper);
						options.wBossKey = (WORD)strValue[0];
					}
				}

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "bossHideTrayIcon", strValue))
				{
					options.bBossHideTrayIcon = (strValue == _T("true"));
				}
			}
		}
	}

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

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

示例14: R_NPAPI_Invoke

SEXP R_NPAPI_Invoke(SEXP plug, SEXP Robj, SEXP Rname, SEXP Rargs, SEXP RconvArgsEnum, SEXP RconvArgsFuns, SEXP RconvRet, SEXP RkeepRes )
{
 
  NPP inst = (NPP) R_ExternalPtrAddr(GET_SLOT( plug , Rf_install( "ref" ) ) );
  NPNetscapeFuncs *funcs = (NPNetscapeFuncs *) R_ExternalPtrAddr(GET_SLOT( GET_SLOT(plug, Rf_install("funcs")), Rf_install("ref")));

  NPVariant *obj = (NPVariant *) R_ExternalPtrAddr(GET_SLOT( Robj , Rf_install( "ref" ) ) );
  
  if(!NPVARIANT_IS_OBJECT(*obj))
    {
      //What should we return in this case?
      Rf_error("Robj is not an NPVariant containing an NPObject.");
      return R_NilValue;
    }
  //custom conversion functions are applied on R side for return value.
  convert_t convRet = (convert_t) INTEGER(RconvRet)[0];
  convert_t curConvArg;
 
  int nargs = LENGTH(Rargs);
  NPVariant *args = (NPVariant *) funcs->memalloc(nargs*sizeof(NPVariant));
  
  for(int i = 0; i < nargs; i++)
    {
      curConvArg = (convert_t) INTEGER(RconvArgsEnum)[i];
      ConvertRToNP(VECTOR_ELT(Rargs, i), inst, funcs, &(args[i]), curConvArg);
      //If we have a custom converter we invoke it with here
      if(curConvArg == CONV_CUSTOM)
	{
	  fprintf(stderr, "Custom argument converter detected. Attempting to call JS Conversion function.");fflush(stderr);
	  funcs->invokeDefault(inst, ((NPVariant *) R_ExternalPtrAddr(GET_SLOT( VECTOR_ELT(RconvArgsFuns, i), Rf_install( "ref" ) ) ) ) -> value.objectValue, &args[i], 1, &args[i]) ;
	}
    }

  NPVariant *ret = (NPVariant *) funcs->memalloc(sizeof(NPVariant)); 
  
  const char *ccname = CHAR(STRING_ELT(Rname, 0));
  bool hasMethod = funcs->hasmethod(inst, obj->value.objectValue,  funcs->getstringidentifier(ccname));
  if(!hasMethod)
    {
      char msg[200];
      sprintf(msg, "Object has no %s method.", ccname);
      Rf_error(msg);
      return R_NilValue;
    }    
  bool success = funcs->invoke(inst, obj->value.objectValue, funcs->getstringidentifier(ccname), args, nargs, ret);
  if(!success)
    {
      fprintf(stderr, "\nInvocation of JS method %s failed.", ccname);fflush(stderr);
    }
  for(int j=0; j<nargs; j++)
    {
            if (NPVARIANT_IS_OBJECT(args[j]))
	      funcs->releaseobject(args[j].value.objectValue);
	    //funcs->releasevariantvalue(&args[j]);
    }
  funcs->memfree(args);
  
  if(!success)
    {
      char msg2[200];
      sprintf(msg2, "Invoke failed for %s method.", ccname);
      Rf_error(msg2);
      return R_NilValue;
    }
    
  SEXP ans;
  //PROTECT(ans = R_NilValue);
  PROTECT(ans = NEW_INTEGER(1));
  bool canfree = ConvertNPToR(ret, inst, funcs, convRet, &ans);
  bool keepRes = LOGICAL(RkeepRes)[0];
  if(canfree || !keepRes)
    funcs->releasevariantvalue(ret);
  
  UNPROTECT(1);
  if(keepRes)
    return ans ;
  else
    return R_NilValue;
}
开发者ID:gmbecker,项目名称:RBrowserPlugin,代码行数:79,代码来源:NPAPI.cpp

示例15: GetWindowTabs

bool CJSMethods::GetWindowTabs(int nWindowId, vector<ChromeTab> &tabs)
{
	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;
	INT32_TO_NPVARIANT(nWindowId, varArgs);

	bool bResult = CallJSMethod(pBrowserFuncs, pluginInstance, "getWindowTabs", &varArgs, 1, varResults);

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

			if(pArray != NULL)
			{
				int			nLength = 0;
				NPVariant	varTab;

				if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, "length", nLength))
				{
					for(size_t i = 0; i < (size_t)nLength; ++i)
					{
						if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pArray, i, varTab))
						{
							if(NPVARIANT_IS_OBJECT(varTab))
							{
								NPObject *pTab = NPVARIANT_TO_OBJECT(varTab);

								ChromeTab newTab;
								
								if(CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pTab, "title", newTab.strTitle) &&
								   CJSValue::GetProperty(pBrowserFuncs, pluginInstance, pTab, "id", newTab.nId))
								{
									tabs.push_back(newTab);
								}
							}
						}

						pBrowserFuncs->releasevariantvalue(&varTab);
					}
				}
			}
			
		}
	}

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

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


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