michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsOfflineCacheUpdateChild_h michael@0: #define nsOfflineCacheUpdateChild_h michael@0: michael@0: #include "mozilla/docshell/POfflineCacheUpdateChild.h" michael@0: #include "nsIOfflineCacheUpdate.h" michael@0: michael@0: #include "nsCOMArray.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsICacheService.h" michael@0: #include "nsIDOMDocument.h" michael@0: #include "nsIObserver.h" michael@0: #include "nsIObserverService.h" michael@0: #include "nsIURI.h" michael@0: #include "nsString.h" michael@0: #include "nsWeakReference.h" michael@0: michael@0: namespace mozilla { michael@0: namespace docshell { michael@0: michael@0: class OfflineCacheUpdateChild : public nsIOfflineCacheUpdate michael@0: , public POfflineCacheUpdateChild michael@0: { michael@0: public: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIOFFLINECACHEUPDATE michael@0: michael@0: virtual bool michael@0: RecvNotifyStateEvent(const uint32_t& stateEvent, michael@0: const uint64_t& byteProgress) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: RecvAssociateDocuments( michael@0: const nsCString& cacheGroupId, michael@0: const nsCString& cacheClientId) MOZ_OVERRIDE; michael@0: michael@0: virtual bool michael@0: RecvFinish(const bool& succeeded, michael@0: const bool& isUpgrade) MOZ_OVERRIDE; michael@0: michael@0: OfflineCacheUpdateChild(nsIDOMWindow* aWindow); michael@0: ~OfflineCacheUpdateChild(); michael@0: michael@0: void SetDocument(nsIDOMDocument *aDocument); michael@0: michael@0: private: michael@0: nsresult AssociateDocument(nsIDOMDocument *aDocument, michael@0: nsIApplicationCache *aApplicationCache); michael@0: void GatherObservers(nsCOMArray &aObservers); michael@0: nsresult Finish(); michael@0: michael@0: enum { michael@0: STATE_UNINITIALIZED, michael@0: STATE_INITIALIZED, michael@0: STATE_CHECKING, michael@0: STATE_DOWNLOADING, michael@0: STATE_CANCELLED, michael@0: STATE_FINISHED michael@0: } mState; michael@0: michael@0: bool mIsUpgrade; michael@0: bool mSucceeded; michael@0: michael@0: nsCString mUpdateDomain; michael@0: nsCOMPtr mManifestURI; michael@0: nsCOMPtr mDocumentURI; michael@0: michael@0: nsCOMPtr mObserverService; michael@0: michael@0: uint32_t mAppID; michael@0: bool mInBrowser; michael@0: michael@0: /* Clients watching this update for changes */ michael@0: nsCOMArray mWeakObservers; michael@0: nsCOMArray mObservers; michael@0: michael@0: /* Document that requested this update */ michael@0: nsCOMPtr mDocument; michael@0: michael@0: /* Keep reference to the window that owns this update to call the michael@0: parent offline cache update construcor */ michael@0: nsCOMPtr mWindow; michael@0: michael@0: uint64_t mByteProgress; michael@0: }; michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif