Example #1
0
bool
GMPChild::SetMacSandboxInfo(MacSandboxPluginType aPluginType)
{
  if (!mGMPLoader) {
    return false;
  }
  nsAutoCString pluginDirectoryPath, pluginFilePath;
  if (!GetPluginPaths(mPluginPath, pluginDirectoryPath, pluginFilePath)) {
    return false;
  }
  nsAutoCString appPath, appBinaryPath;
  if (!GetAppPaths(appPath, appBinaryPath)) {
    return false;
  }

  MacSandboxInfo info;
  info.type = MacSandboxType_Plugin;
  info.shouldLog = Preferences::GetBool("security.sandbox.logging.enabled", true);
  info.pluginInfo.type = aPluginType;
  info.pluginInfo.pluginPath.assign(pluginDirectoryPath.get());
  info.pluginInfo.pluginBinaryPath.assign(pluginFilePath.get());
  info.appPath.assign(appPath.get());
  info.appBinaryPath.assign(appBinaryPath.get());

  mGMPLoader->SetSandboxInfo(&info);
  return true;
}
Example #2
0
bool
GMPChild::GetUTF8LibPath(nsACString& aOutLibPath)
{
#if defined(XP_MACOSX) && defined(MOZ_GMP_SANDBOX)
  nsAutoCString pluginDirectoryPath, pluginFilePath;
  if (!GetPluginPaths(mPluginPath, pluginDirectoryPath, pluginFilePath)) {
    MOZ_CRASH("Error scanning plugin path");
  }
  aOutLibPath.Assign(pluginFilePath);
  return true;
#else
  nsCOMPtr<nsIFile> libFile;
  if (!GetPluginFile(mPluginPath, libFile)) {
    return false;
  }

  if (!FileExists(libFile)) {
    NS_WARNING("Can't find GMP library file!");
    return false;
  }

  nsAutoString path;
  libFile->GetPath(path);
  aOutLibPath = NS_ConvertUTF16toUTF8(path);

  return true;
#endif
}
Example #3
0
bool
GMPChild::SetMacSandboxInfo(MacSandboxPluginType aPluginType)
{
  if (!mGMPLoader) {
    return false;
  }
  nsAutoCString pluginDirectoryPath, pluginFilePath;
  if (!GetPluginPaths(mPluginPath, pluginDirectoryPath, pluginFilePath)) {
    return false;
  }
  nsAutoCString appPath, appBinaryPath;
  if (!GetAppPaths(appPath, appBinaryPath)) {
    return false;
  }

  MacSandboxInfo info;
  info.type = MacSandboxType_Plugin;
  info.pluginInfo.type = aPluginType;
  info.pluginInfo.pluginPath.assign(pluginDirectoryPath.get());
  info.pluginInfo.pluginBinaryPath.assign(pluginFilePath.get());
  info.appPath.assign(appPath.get());
  info.appBinaryPath.assign(appBinaryPath.get());

  mGMPLoader->SetSandboxInfo(&info);
  return true;
}
Example #4
0
int main(int argc, char *argv[]) {
   Botan::LibraryInitializer Init;

#ifdef Q_WS_X11
   // QML is unusable with the xlib backend
   QApplication::setGraphicsSystem("raster");
#endif

   SharedTools::TSingleApplication app((QLatin1String(APP_NAME)), argc, argv);
   QCoreApplication::setApplicationName(QLatin1String(APP_NAME));
   QCoreApplication::setOrganizationName(QLatin1String("MIPT"));
   /*qDebug() << "main() app.IsRunning() =" << app.IsRunning();
      if(app.IsRunning()) {
            qDebug() << "We are not the first instance of the app, so sending message to the first..."
            << app.SendMessage("Activate");
            return 0;
         }*/

   // ------------------------------------------ Parse command line options ------------------------------------------
   QCommandLineParser CommandLineOptsParser;
   CommandLineOptsParser.setApplicationDescription(app.applicationName());
   CommandLineOptsParser.addHelpOption();
   CommandLineOptsParser.addVersionOption();
   QCommandLineOption HomeOption("config", "Path to config", "directory");
   CommandLineOptsParser.addOption(HomeOption);

   // Process the actual command line arguments given by the user
   CommandLineOptsParser.process(app);

   const QString HomeDir = CommandLineOptsParser.value(HomeOption);


   // --------------------------------------------------- Settings ---------------------------------------------------
   QSettings::setDefaultFormat(QSettings::IniFormat);
   QSettings *Settings;
   if(HomeDir.isEmpty())
      Settings = new QSettings(QSettings::IniFormat, QSettings::UserScope, app.organizationName(), APP_NAME);
   else
      Settings = new QSettings(HomeDir + "/EventManager.ini", QSettings::IniFormat);




   // ----------------------------------------- PluginManager, load plugins  -----------------------------------------
   QScopedPointer<ExtSys::TPluginManager> PluginManager(ExtSys::TPluginManager::Instance());
   PluginManager->SetSettings(Settings);
   PluginManager->SetSpecFileExtension("pluginspec");
   const QStringList &PluginPaths = GetPluginPaths();
   PluginManager->SetPluginPaths(PluginPaths);

   const ExtSys::TPluginSpecList &Plugins = PluginManager->PluginSpecs();
   ExtSys::TPluginSpec *CorePlugin = nullptr;
   foreach (ExtSys::TPluginSpec *Spec, Plugins) {
      if(Spec->Name() == QLatin1String(CorePluginName)) {
         CorePlugin = Spec;
         break;
      }
   }
   if(!CorePlugin) {
      const QString &NativePaths = QDir::toNativeSeparators(PluginPaths.join(QLatin1String(",")));
      const QString &Reason = (QString("Application: Could not find '") + CorePluginName + "' in %1").arg(NativePaths);
      qCritical() << Reason;
      return 1;
   }
   if(CorePlugin->HasError()) {
      qCritical() << CorePlugin->ErrorString();
      return 1;
   }

   PluginManager->LoadPlugins();
   if(CorePlugin->HasError()) {
      qCritical() << CorePlugin->ErrorString();
      return 1;
   }
   {
      QStringList Errors;
      foreach(ExtSys::TPluginSpec *p, PluginManager->PluginSpecs())
         if(p->HasError())
            Errors << p->ErrorString();

      if(!Errors.isEmpty())
         QMessageBox::warning(nullptr, "Qt Creator - Plugin loader messages", Errors.join(QString::fromLatin1("\n\n")));
   }

   QObject::connect(&app, SIGNAL(aboutToQuit()), PluginManager.data(), SLOT(Shutdown()));

   return app.exec();
}