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 nsOfflineCacheUpdateGlue_h |
michael@0 | 7 | #define nsOfflineCacheUpdateGlue_h |
michael@0 | 8 | |
michael@0 | 9 | #include "nsIOfflineCacheUpdate.h" |
michael@0 | 10 | |
michael@0 | 11 | #include "nsCOMPtr.h" |
michael@0 | 12 | #include "nsAutoPtr.h" |
michael@0 | 13 | #include "nsString.h" |
michael@0 | 14 | #include "nsWeakReference.h" |
michael@0 | 15 | #include "mozilla/Attributes.h" |
michael@0 | 16 | |
michael@0 | 17 | class nsOfflineCacheUpdate; |
michael@0 | 18 | |
michael@0 | 19 | namespace mozilla { |
michael@0 | 20 | namespace docshell { |
michael@0 | 21 | |
michael@0 | 22 | // Like FORWARD_SAFE except methods: |
michael@0 | 23 | // Schedule |
michael@0 | 24 | // Init |
michael@0 | 25 | #define NS_ADJUSTED_FORWARD_NSIOFFLINECACHEUPDATE(_to) \ |
michael@0 | 26 | NS_IMETHOD GetStatus(uint16_t *aStatus) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetStatus(aStatus); } \ |
michael@0 | 27 | NS_IMETHOD GetPartial(bool *aPartial) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetPartial(aPartial); } \ |
michael@0 | 28 | NS_IMETHOD GetIsUpgrade(bool *aIsUpgrade) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetIsUpgrade(aIsUpgrade); } \ |
michael@0 | 29 | NS_IMETHOD GetUpdateDomain(nsACString & aUpdateDomain) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetUpdateDomain(aUpdateDomain); } \ |
michael@0 | 30 | NS_IMETHOD GetManifestURI(nsIURI **aManifestURI) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetManifestURI(aManifestURI); } \ |
michael@0 | 31 | NS_IMETHOD GetSucceeded(bool *aSucceeded) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetSucceeded(aSucceeded); } \ |
michael@0 | 32 | NS_IMETHOD InitPartial(nsIURI *aManifestURI, const nsACString & aClientID, nsIURI *aDocumentURI) { return !_to ? NS_ERROR_NULL_POINTER : _to->InitPartial(aManifestURI, aClientID, aDocumentURI); } \ |
michael@0 | 33 | NS_IMETHOD InitForUpdateCheck(nsIURI *aManifestURI, uint32_t aAppID, bool aInBrowser, nsIObserver *aObserver) { return !_to ? NS_ERROR_NULL_POINTER : _to->InitForUpdateCheck(aManifestURI, aAppID, aInBrowser, aObserver); } \ |
michael@0 | 34 | NS_IMETHOD AddDynamicURI(nsIURI *aURI) { return !_to ? NS_ERROR_NULL_POINTER : _to->AddDynamicURI(aURI); } \ |
michael@0 | 35 | NS_IMETHOD AddObserver(nsIOfflineCacheUpdateObserver *aObserver, bool aHoldWeak) { return !_to ? NS_ERROR_NULL_POINTER : _to->AddObserver(aObserver, aHoldWeak); } \ |
michael@0 | 36 | NS_IMETHOD RemoveObserver(nsIOfflineCacheUpdateObserver *aObserver) { return !_to ? NS_ERROR_NULL_POINTER : _to->RemoveObserver(aObserver); } \ |
michael@0 | 37 | NS_IMETHOD GetByteProgress(uint64_t * _result) { return !_to ? NS_ERROR_NULL_POINTER : _to->GetByteProgress(_result); } \ |
michael@0 | 38 | NS_IMETHOD Cancel() { return !_to ? NS_ERROR_NULL_POINTER : _to->Cancel(); } |
michael@0 | 39 | |
michael@0 | 40 | class OfflineCacheUpdateGlue MOZ_FINAL : public nsSupportsWeakReference |
michael@0 | 41 | , public nsIOfflineCacheUpdate |
michael@0 | 42 | , public nsIOfflineCacheUpdateObserver |
michael@0 | 43 | { |
michael@0 | 44 | public: |
michael@0 | 45 | NS_DECL_ISUPPORTS |
michael@0 | 46 | |
michael@0 | 47 | private: |
michael@0 | 48 | nsIOfflineCacheUpdate* EnsureUpdate(); |
michael@0 | 49 | |
michael@0 | 50 | public: |
michael@0 | 51 | NS_ADJUSTED_FORWARD_NSIOFFLINECACHEUPDATE(EnsureUpdate()) |
michael@0 | 52 | NS_IMETHOD Schedule(void); |
michael@0 | 53 | NS_IMETHOD Init(nsIURI *aManifestURI, |
michael@0 | 54 | nsIURI *aDocumentURI, |
michael@0 | 55 | nsIDOMDocument *aDocument, |
michael@0 | 56 | nsIFile *aCustomProfileDir, |
michael@0 | 57 | uint32_t aAppID, |
michael@0 | 58 | bool aInBrowser); |
michael@0 | 59 | |
michael@0 | 60 | NS_DECL_NSIOFFLINECACHEUPDATEOBSERVER |
michael@0 | 61 | |
michael@0 | 62 | OfflineCacheUpdateGlue(); |
michael@0 | 63 | ~OfflineCacheUpdateGlue(); |
michael@0 | 64 | |
michael@0 | 65 | void SetDocument(nsIDOMDocument *aDocument); |
michael@0 | 66 | |
michael@0 | 67 | private: |
michael@0 | 68 | nsRefPtr<nsOfflineCacheUpdate> mUpdate; |
michael@0 | 69 | |
michael@0 | 70 | /* Document that requested this update */ |
michael@0 | 71 | nsCOMPtr<nsIDOMDocument> mDocument; |
michael@0 | 72 | nsCOMPtr<nsIURI> mDocumentURI; |
michael@0 | 73 | }; |
michael@0 | 74 | |
michael@0 | 75 | } |
michael@0 | 76 | } |
michael@0 | 77 | |
michael@0 | 78 | #endif |