コード例 #1
0
ファイル: Main.cpp プロジェクト: chinnurtb/adblockplusie
std::auto_ptr<AdblockPlus::FilterEngine> CreateFilterEngine(const std::wstring& locale)
{
  AdblockPlus::AppInfo appInfo;
  appInfo.version = ToUtf8String(IEPLUGIN_VERSION);
  appInfo.name = "adblockplusie";
#ifdef _WIN64
  appInfo.application = "msie64";
#else
  appInfo.application = "msie32";
#endif
  // TODO: Set applicationVersion parameter
  appInfo.locale = ToUtf8String(locale);
#ifdef ADBLOCK_PLUS_TEST_MODE
  appInfo.developmentBuild = true;
#else
  appInfo.developmentBuild = false;
#endif

  AdblockPlus::JsEnginePtr jsEngine = AdblockPlus::JsEngine::New(appInfo);
  jsEngine->SetEventCallback("updateAvailable", &OnUpdateAvailable);

  std::string dataPath = ToUtf8String(GetAppDataPath());
  dynamic_cast<AdblockPlus::DefaultFileSystem*>(jsEngine->GetFileSystem().get())->SetBasePath(dataPath);
  std::auto_ptr<AdblockPlus::FilterEngine> filterEngine(new AdblockPlus::FilterEngine(jsEngine));
  return filterEngine;
}
コード例 #2
0
AdblockPlus::JsValuePtr AdblockPlus::ConsoleJsObject::Setup(
    AdblockPlus::JsEnginePtr jsEngine, AdblockPlus::JsValuePtr obj)
{
  obj->SetProperty("log", jsEngine->NewCallback(::LogCallback));
  obj->SetProperty("debug", jsEngine->NewCallback(::DebugCallback));
  obj->SetProperty("info", jsEngine->NewCallback(::InfoCallback));
  obj->SetProperty("warn", jsEngine->NewCallback(::WarnCallback));
  obj->SetProperty("error", jsEngine->NewCallback(::ErrorCallback));
  obj->SetProperty("trace", jsEngine->NewCallback(::TraceCallback));
  return obj;
}
コード例 #3
0
JNIEXPORT void JNICALL Java_org_adblockplus_android_ABPEngine_release(JNIEnv *pEnv, jobject)
{
    D(D_WARN, "nativeRelease()");
    try
    {
        AdblockPlus::JsEnginePtr jsEngine = filterEngine->GetJsEngine();
        jsEngine->RemoveEventCallback("updateAvailable");
        filterEngine->RemoveFilterChangeCallback();
        delete filterEngine;
        pEnv->DeleteGlobalRef(jniObject);
        jniObject = NULL;
        globalJvm = NULL;
    }
    catch (const std::exception& e)
    {
        ThrowJavaException(pEnv, e);
    }
    catch (...)
    {
        ThrowJavaException(pEnv);
    }
}
コード例 #4
0
AdblockPlus::JsValuePtr AdblockPlus::WebRequestJsObject::Setup(
    AdblockPlus::JsEnginePtr jsEngine, AdblockPlus::JsValuePtr obj)
{
  obj->SetProperty("GET", jsEngine->NewCallback(::GETCallback));
  return obj;
}
コード例 #5
0
AdblockPlus::JsValue::JsValue(AdblockPlus::JsEnginePtr jsEngine,
      v8::Handle<v8::Value> value)
    : jsEngine(jsEngine),
	value(new v8::UniquePersistent<v8::Value>(jsEngine->GetIsolate(), value))
{
}