diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-28 14:29:10 +0000 |
commit | 2aa4a82499d4becd2284cdb482213d541b8804dd (patch) | |
tree | b80bf8bf13c3766139fbacc530efd0dd9d54394c /uriloader/prefetch/OfflineCacheUpdateChild.h | |
parent | Initial commit. (diff) | |
download | firefox-upstream.tar.xz firefox-upstream.zip |
Adding upstream version 86.0.1.upstream/86.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | uriloader/prefetch/OfflineCacheUpdateChild.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/uriloader/prefetch/OfflineCacheUpdateChild.h b/uriloader/prefetch/OfflineCacheUpdateChild.h new file mode 100644 index 0000000000..4099c9dfdb --- /dev/null +++ b/uriloader/prefetch/OfflineCacheUpdateChild.h @@ -0,0 +1,93 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef nsOfflineCacheUpdateChild_h +#define nsOfflineCacheUpdateChild_h + +#include "mozilla/docshell/POfflineCacheUpdateChild.h" +#include "nsIOfflineCacheUpdate.h" + +#include "nsCOMArray.h" +#include "nsCOMPtr.h" +#include "nsIObserver.h" +#include "nsIObserverService.h" +#include "nsIURI.h" +#include "nsIWeakReference.h" +#include "nsString.h" + +class nsPIDOMWindowInner; + +namespace mozilla { +namespace dom { +class Document; +} + +namespace docshell { + +class OfflineCacheUpdateChild : public nsIOfflineCacheUpdate, + public POfflineCacheUpdateChild { + public: + NS_DECL_ISUPPORTS + NS_DECL_NSIOFFLINECACHEUPDATE + + mozilla::ipc::IPCResult RecvNotifyStateEvent(const uint32_t& stateEvent, + const uint64_t& byteProgress); + + mozilla::ipc::IPCResult RecvAssociateDocuments( + const nsCString& cacheGroupId, const nsCString& cacheClientId); + + mozilla::ipc::IPCResult RecvFinish(const bool& succeeded, + const bool& isUpgrade); + + explicit OfflineCacheUpdateChild(nsPIDOMWindowInner* aWindow); + + void SetDocument(dom::Document* aDocument); + + private: + ~OfflineCacheUpdateChild(); + + nsresult AssociateDocument(dom::Document* aDocument, + nsIApplicationCache* aApplicationCache); + void GatherObservers(nsCOMArray<nsIOfflineCacheUpdateObserver>& aObservers); + nsresult Finish(); + + enum { + STATE_UNINITIALIZED, + STATE_INITIALIZED, + STATE_CHECKING, + STATE_DOWNLOADING, + STATE_CANCELLED, + STATE_FINISHED + } mState; + + bool mIsUpgrade; + bool mSucceeded; + + nsCString mUpdateDomain; + nsCOMPtr<nsIURI> mManifestURI; + nsCOMPtr<nsIURI> mDocumentURI; + nsCOMPtr<nsIPrincipal> mLoadingPrincipal; + nsCOMPtr<nsICookieJarSettings> mCookieJarSettings; + + nsCOMPtr<nsIObserverService> mObserverService; + + /* Clients watching this update for changes */ + nsCOMArray<nsIWeakReference> mWeakObservers; + nsCOMArray<nsIOfflineCacheUpdateObserver> mObservers; + + /* Document that requested this update */ + nsCOMPtr<dom::Document> mDocument; + + /* Keep reference to the window that owns this update to call the + parent offline cache update construcor */ + nsCOMPtr<nsPIDOMWindowInner> mWindow; + + uint64_t mByteProgress; +}; + +} // namespace docshell +} // namespace mozilla + +#endif |