2017-05-17 08:01:14 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* 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 mozilla_dom_SessionStorageManager_h
|
|
|
|
#define mozilla_dom_SessionStorageManager_h
|
|
|
|
|
|
|
|
#include "nsIDOMStorageManager.h"
|
|
|
|
#include "nsClassHashtable.h"
|
|
|
|
#include "nsRefPtrHashtable.h"
|
2017-05-17 08:01:14 +03:00
|
|
|
#include "StorageObserver.h"
|
2017-05-17 08:01:14 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
class SessionStorageCache;
|
|
|
|
|
|
|
|
class SessionStorageManager final : public nsIDOMStorageManager
|
2017-05-17 08:01:14 +03:00
|
|
|
, public StorageObserverSink
|
2017-05-17 08:01:14 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
SessionStorageManager();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIDOMSTORAGEMANAGER
|
|
|
|
|
|
|
|
private:
|
|
|
|
~SessionStorageManager();
|
|
|
|
|
2017-05-17 08:01:14 +03:00
|
|
|
// StorageObserverSink, handler to various chrome clearing notification
|
|
|
|
nsresult
|
|
|
|
Observe(const char* aTopic,
|
|
|
|
const nsAString& aOriginAttributesPattern,
|
|
|
|
const nsACString& aOriginScope) override;
|
|
|
|
|
2017-05-17 08:01:15 +03:00
|
|
|
enum ClearStorageType {
|
|
|
|
eAll,
|
|
|
|
eSessionOnly,
|
|
|
|
};
|
|
|
|
|
2017-05-17 08:01:14 +03:00
|
|
|
void
|
2017-05-17 08:01:15 +03:00
|
|
|
ClearStorages(ClearStorageType aType,
|
|
|
|
const OriginAttributesPattern& aPattern,
|
2017-05-17 08:01:14 +03:00
|
|
|
const nsACString& aOriginScope);
|
|
|
|
|
2017-05-17 08:01:14 +03:00
|
|
|
typedef nsRefPtrHashtable<nsCStringHashKey, SessionStorageCache> OriginKeyHashTable;
|
|
|
|
nsClassHashtable<nsCStringHashKey, OriginKeyHashTable> mOATable;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // dom namespace
|
|
|
|
} // mozilla namespace
|
|
|
|
|
|
|
|
#endif // mozilla_dom_SessionStorageManager_h
|