summaryrefslogtreecommitdiff
path: root/indra/viewer_components/updater/llupdaterservice.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/viewer_components/updater/llupdaterservice.cpp')
-rw-r--r--indra/viewer_components/updater/llupdaterservice.cpp120
1 files changed, 119 insertions, 1 deletions
diff --git a/indra/viewer_components/updater/llupdaterservice.cpp b/indra/viewer_components/updater/llupdaterservice.cpp
index 14906bcef8..6c7619a2b9 100644
--- a/indra/viewer_components/updater/llupdaterservice.cpp
+++ b/indra/viewer_components/updater/llupdaterservice.cpp
@@ -25,6 +25,118 @@
#include "linden_common.h"
+#include "llupdaterservice.h"
+
+#include "llsingleton.h"
+#include "llpluginprocessparent.h"
+#include <boost/scoped_ptr.hpp>
+
+class LLUpdaterServiceImpl : public LLPluginProcessParentOwner,
+ public LLSingleton<LLUpdaterServiceImpl>
+{
+ std::string mUrl;
+ std::string mChannel;
+ std::string mVersion;
+
+ unsigned int mUpdateCheckPeriod;
+ bool mIsChecking;
+ boost::scoped_ptr<LLPluginProcessParent> mPlugin;
+
+public:
+ LLUpdaterServiceImpl();
+ virtual ~LLUpdaterServiceImpl() {}
+
+ // LLPluginProcessParentOwner interfaces
+ virtual void receivePluginMessage(const LLPluginMessage &message);
+ virtual bool receivePluginMessageEarly(const LLPluginMessage &message);
+ virtual void pluginLaunchFailed();
+ virtual void pluginDied();
+
+ void setURL(const std::string& url);
+ void setChannel(const std::string& channel);
+ void setVersion(const std::string& version);
+ void setUpdateCheckPeriod(unsigned int seconds);
+ void startChecking();
+ void stopChecking();
+};
+
+LLUpdaterServiceImpl::LLUpdaterServiceImpl() :
+ mIsChecking(false),
+ mUpdateCheckPeriod(0),
+ mPlugin(0)
+{
+ // Create the plugin parent, this is the owner.
+ mPlugin.reset(new LLPluginProcessParent(this));
+}
+
+// LLPluginProcessParentOwner interfaces
+void LLUpdaterServiceImpl::receivePluginMessage(const LLPluginMessage &message)
+{
+}
+
+bool LLUpdaterServiceImpl::receivePluginMessageEarly(const LLPluginMessage &message)
+{
+ return false;
+};
+
+void LLUpdaterServiceImpl::pluginLaunchFailed()
+{
+};
+
+void LLUpdaterServiceImpl::pluginDied()
+{
+};
+
+void LLUpdaterServiceImpl::setURL(const std::string& url)
+{
+ if(mUrl != url)
+ {
+ mUrl = url;
+ }
+}
+
+void LLUpdaterServiceImpl::setChannel(const std::string& channel)
+{
+ if(mChannel != channel)
+ {
+ mChannel = channel;
+ }
+}
+
+void LLUpdaterServiceImpl::setVersion(const std::string& version)
+{
+ if(mVersion != version)
+ {
+ mVersion = version;
+ }
+}
+
+void LLUpdaterServiceImpl::setUpdateCheckPeriod(unsigned int seconds)
+{
+ if(mUpdateCheckPeriod != seconds)
+ {
+ mUpdateCheckPeriod = seconds;
+ }
+}
+
+void LLUpdaterServiceImpl::startChecking()
+{
+ if(!mIsChecking)
+ {
+ mIsChecking = true;
+ }
+}
+
+void LLUpdaterServiceImpl::stopChecking()
+{
+ if(mIsChecking)
+ {
+ mIsChecking = false;
+ }
+}
+
+//-----------------------------------------------------------------------
+// Facade interface
LLUpdaterService::LLUpdaterService()
{
}
@@ -35,24 +147,30 @@ LLUpdaterService::~LLUpdaterService()
void LLUpdaterService::setURL(const std::string& url)
{
+ LLUpdaterServiceImpl::getInstance()->setURL(url);
}
void LLUpdaterService::setChannel(const std::string& channel)
{
+ LLUpdaterServiceImpl::getInstance()->setChannel(channel);
}
void LLUpdaterService::setVersion(const std::string& version)
{
+ LLUpdaterServiceImpl::getInstance()->setVersion(version);
}
-void LLUpdaterService::setUpdateCheckFrequency(unsigned int seconds)
+void LLUpdaterService::setUpdateCheckPeriod(unsigned int seconds)
{
+ LLUpdaterServiceImpl::getInstance()->setUpdateCheckPeriod(seconds);
}
void LLUpdaterService::startChecking()
{
+ LLUpdaterServiceImpl::getInstance()->startChecking();
}
void LLUpdaterService::stopChecking()
{
+ LLUpdaterServiceImpl::getInstance()->stopChecking();
}