Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | #ifndef nsOfflineCacheUpdateChild_h |
michael@0 | 7 | #define nsOfflineCacheUpdateChild_h |
michael@0 | 8 | |
michael@0 | 9 | #include "mozilla/docshell/POfflineCacheUpdateChild.h" |
michael@0 | 10 | #include "nsIOfflineCacheUpdate.h" |
michael@0 | 11 | |
michael@0 | 12 | #include "nsCOMArray.h" |
michael@0 | 13 | #include "nsCOMPtr.h" |
michael@0 | 14 | #include "nsICacheService.h" |
michael@0 | 15 | #include "nsIDOMDocument.h" |
michael@0 | 16 | #include "nsIObserver.h" |
michael@0 | 17 | #include "nsIObserverService.h" |
michael@0 | 18 | #include "nsIURI.h" |
michael@0 | 19 | #include "nsString.h" |
michael@0 | 20 | #include "nsWeakReference.h" |
michael@0 | 21 | |
michael@0 | 22 | namespace mozilla { |
michael@0 | 23 | namespace docshell { |
michael@0 | 24 | |
michael@0 | 25 | class OfflineCacheUpdateChild : public nsIOfflineCacheUpdate |
michael@0 | 26 | , public POfflineCacheUpdateChild |
michael@0 | 27 | { |
michael@0 | 28 | public: |
michael@0 | 29 | NS_DECL_ISUPPORTS |
michael@0 | 30 | NS_DECL_NSIOFFLINECACHEUPDATE |
michael@0 | 31 | |
michael@0 | 32 | virtual bool |
michael@0 | 33 | RecvNotifyStateEvent(const uint32_t& stateEvent, |
michael@0 | 34 | const uint64_t& byteProgress) MOZ_OVERRIDE; |
michael@0 | 35 | |
michael@0 | 36 | virtual bool |
michael@0 | 37 | RecvAssociateDocuments( |
michael@0 | 38 | const nsCString& cacheGroupId, |
michael@0 | 39 | const nsCString& cacheClientId) MOZ_OVERRIDE; |
michael@0 | 40 | |
michael@0 | 41 | virtual bool |
michael@0 | 42 | RecvFinish(const bool& succeeded, |
michael@0 | 43 | const bool& isUpgrade) MOZ_OVERRIDE; |
michael@0 | 44 | |
michael@0 | 45 | OfflineCacheUpdateChild(nsIDOMWindow* aWindow); |
michael@0 | 46 | ~OfflineCacheUpdateChild(); |
michael@0 | 47 | |
michael@0 | 48 | void SetDocument(nsIDOMDocument *aDocument); |
michael@0 | 49 | |
michael@0 | 50 | private: |
michael@0 | 51 | nsresult AssociateDocument(nsIDOMDocument *aDocument, |
michael@0 | 52 | nsIApplicationCache *aApplicationCache); |
michael@0 | 53 | void GatherObservers(nsCOMArray<nsIOfflineCacheUpdateObserver> &aObservers); |
michael@0 | 54 | nsresult Finish(); |
michael@0 | 55 | |
michael@0 | 56 | enum { |
michael@0 | 57 | STATE_UNINITIALIZED, |
michael@0 | 58 | STATE_INITIALIZED, |
michael@0 | 59 | STATE_CHECKING, |
michael@0 | 60 | STATE_DOWNLOADING, |
michael@0 | 61 | STATE_CANCELLED, |
michael@0 | 62 | STATE_FINISHED |
michael@0 | 63 | } mState; |
michael@0 | 64 | |
michael@0 | 65 | bool mIsUpgrade; |
michael@0 | 66 | bool mSucceeded; |
michael@0 | 67 | |
michael@0 | 68 | nsCString mUpdateDomain; |
michael@0 | 69 | nsCOMPtr<nsIURI> mManifestURI; |
michael@0 | 70 | nsCOMPtr<nsIURI> mDocumentURI; |
michael@0 | 71 | |
michael@0 | 72 | nsCOMPtr<nsIObserverService> mObserverService; |
michael@0 | 73 | |
michael@0 | 74 | uint32_t mAppID; |
michael@0 | 75 | bool mInBrowser; |
michael@0 | 76 | |
michael@0 | 77 | /* Clients watching this update for changes */ |
michael@0 | 78 | nsCOMArray<nsIWeakReference> mWeakObservers; |
michael@0 | 79 | nsCOMArray<nsIOfflineCacheUpdateObserver> mObservers; |
michael@0 | 80 | |
michael@0 | 81 | /* Document that requested this update */ |
michael@0 | 82 | nsCOMPtr<nsIDOMDocument> mDocument; |
michael@0 | 83 | |
michael@0 | 84 | /* Keep reference to the window that owns this update to call the |
michael@0 | 85 | parent offline cache update construcor */ |
michael@0 | 86 | nsCOMPtr<nsIDOMWindow> mWindow; |
michael@0 | 87 | |
michael@0 | 88 | uint64_t mByteProgress; |
michael@0 | 89 | }; |
michael@0 | 90 | |
michael@0 | 91 | } |
michael@0 | 92 | } |
michael@0 | 93 | |
michael@0 | 94 | #endif |