diff options
author | Mark Palange (Mani) <palange@lindenlab.com> | 2010-11-18 15:36:11 -0800 |
---|---|---|
committer | Mark Palange (Mani) <palange@lindenlab.com> | 2010-11-18 15:36:11 -0800 |
commit | 6802775bc4952874e26f320e1ec7ce9f7ed2e2fb (patch) | |
tree | fb5b9b355214fe5ab949ff62ad5146d49557c2e0 /indra/viewer_components/updater/llupdatedownloader.h | |
parent | 327a922dc9cda771077826ecf7521464ebd281c0 (diff) | |
parent | 0e52564f0a36365c2ce5f5263d15778394741fde (diff) |
Merge with viewer-development
Diffstat (limited to 'indra/viewer_components/updater/llupdatedownloader.h')
-rw-r--r-- | indra/viewer_components/updater/llupdatedownloader.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/indra/viewer_components/updater/llupdatedownloader.h b/indra/viewer_components/updater/llupdatedownloader.h new file mode 100644 index 0000000000..1b3d7480fd --- /dev/null +++ b/indra/viewer_components/updater/llupdatedownloader.h @@ -0,0 +1,87 @@ +/** + * @file llupdatedownloader.h + * + * $LicenseInfo:firstyear=2010&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_UPDATE_DOWNLOADER_H +#define LL_UPDATE_DOWNLOADER_H + + +#include <string> +#include <boost/shared_ptr.hpp> +#include "lluri.h" + + +// +// An asynchronous download service for fetching updates. +// +class LLUpdateDownloader +{ +public: + class Client; + class Implementation; + + // Returns the path to the download marker file containing details of the + // latest download. + static std::string downloadMarkerPath(void); + + LLUpdateDownloader(Client & client); + + // Cancel any in progress download; a no op if none is in progress. The + // client will not receive a complete or error callback. + void cancel(void); + + // Start a new download. + void download(LLURI const & uri, std::string const & hash); + + // Returns true if a download is in progress. + bool isDownloading(void); + + // Resume a partial download. + void resume(void); + +private: + boost::shared_ptr<Implementation> mImplementation; +}; + + +// +// An interface to be implemented by clients initiating a update download. +// +class LLUpdateDownloader::Client { +public: + + // The download has completed successfully. + // data is a map containing the following items: + // url - source (remote) location + // hash - the md5 sum that should match the installer file. + // path - destination (local) location + // size - the size of the installer in bytes + virtual void downloadComplete(LLSD const & data) = 0; + + // The download failed. + virtual void downloadError(std::string const & message) = 0; +}; + + +#endif |