Bug 1688832: part 5) Add `static` `AccessibleCaretManager::GetSelection`, `::GetFrame...
[gecko.git] / netwerk / cache / nsCacheSession.h
blob59bb74823126dfe24c2fcf86fb12f9834dd66191
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
3 * This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef _nsCacheSession_h_
8 #define _nsCacheSession_h_
10 #include "nspr.h"
11 #include "nsError.h"
12 #include "nsCOMPtr.h"
13 #include "nsICacheSession.h"
14 #include "nsIFile.h"
15 #include "nsString.h"
17 class nsCacheSession : public nsICacheSession {
18 virtual ~nsCacheSession();
20 public:
21 NS_DECL_ISUPPORTS
22 NS_DECL_NSICACHESESSION
24 nsCacheSession(const char* clientID, nsCacheStoragePolicy storagePolicy,
25 bool streamBased);
27 nsCString* ClientID() { return &mClientID; }
29 enum SessionInfo {
30 eStoragePolicyMask = 0x000000FF,
31 eStreamBasedMask = 0x00000100,
32 eDoomEntriesIfExpiredMask = 0x00001000,
33 ePrivateMask = 0x00010000
36 void MarkStreamBased() { mInfo |= eStreamBasedMask; }
37 void ClearStreamBased() { mInfo &= ~eStreamBasedMask; }
38 bool IsStreamBased() { return (mInfo & eStreamBasedMask) != 0; }
40 void MarkDoomEntriesIfExpired() { mInfo |= eDoomEntriesIfExpiredMask; }
41 void ClearDoomEntriesIfExpired() { mInfo &= ~eDoomEntriesIfExpiredMask; }
42 bool WillDoomEntriesIfExpired() {
43 return (0 != (mInfo & eDoomEntriesIfExpiredMask));
46 void MarkPrivate() { mInfo |= ePrivateMask; }
47 void MarkPublic() { mInfo &= ~ePrivateMask; }
48 bool IsPrivate() { return (mInfo & ePrivateMask) != 0; }
49 nsCacheStoragePolicy StoragePolicy() {
50 return (nsCacheStoragePolicy)(mInfo & eStoragePolicyMask);
53 void SetStoragePolicy(nsCacheStoragePolicy policy) {
54 NS_ASSERTION(policy <= 0xFF, "too many bits in nsCacheStoragePolicy");
55 mInfo &= ~eStoragePolicyMask; // clear storage policy bits
56 mInfo |= policy;
59 nsIFile* ProfileDir() { return mProfileDir; }
61 private:
62 nsCString mClientID;
63 uint32_t mInfo;
64 nsCOMPtr<nsIFile> mProfileDir;
67 #endif // _nsCacheSession_h_