forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdom_storage_agent.h
More file actions
68 lines (58 loc) · 2.49 KB
/
Copy pathdom_storage_agent.h
File metadata and controls
68 lines (58 loc) · 2.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef SRC_INSPECTOR_DOM_STORAGE_AGENT_H_
#define SRC_INSPECTOR_DOM_STORAGE_AGENT_H_
#include <optional>
#include <string>
#include "env.h"
#include "node/inspector/protocol/DOMStorage.h"
#include "node_webstorage.h"
#include "notification_emitter.h"
#include "v8.h"
namespace node {
namespace inspector {
class DOMStorageAgent : public protocol::DOMStorage::Backend,
public NotificationEmitter {
public:
explicit DOMStorageAgent(Environment* env);
~DOMStorageAgent() override;
void Wire(protocol::UberDispatcher* dispatcher);
protocol::DispatchResponse enable() override;
protocol::DispatchResponse disable() override;
protocol::DispatchResponse getDOMStorageItems(
std::unique_ptr<protocol::DOMStorage::StorageId> storageId,
std::unique_ptr<protocol::Array<protocol::Array<protocol::String>>>*
items) override;
protocol::DispatchResponse setDOMStorageItem(
std::unique_ptr<protocol::DOMStorage::StorageId> storageId,
const std::string& key,
const std::string& value) override;
protocol::DispatchResponse removeDOMStorageItem(
std::unique_ptr<protocol::DOMStorage::StorageId> storageId,
const std::string& key) override;
protocol::DispatchResponse clear(
std::unique_ptr<protocol::DOMStorage::StorageId> storageId) override;
void domStorageItemAdded(v8::Local<v8::Context> context,
v8::Local<v8::Object> params);
void domStorageItemRemoved(v8::Local<v8::Context> context,
v8::Local<v8::Object> params);
void domStorageItemUpdated(v8::Local<v8::Context> context,
v8::Local<v8::Object> params);
void domStorageItemsCleared(v8::Local<v8::Context> context,
v8::Local<v8::Object> params);
void registerStorage(v8::Local<v8::Context> context,
v8::Local<v8::Object> params);
bool canEmit(const std::string& domain) override;
DOMStorageAgent(const DOMStorageAgent&) = delete;
DOMStorageAgent& operator=(const DOMStorageAgent&) = delete;
private:
typedef std::unordered_map<std::u16string, std::u16string> StorageMap;
std::optional<node::webstorage::Storage*> getWebStorage(
bool is_local_storage);
std::unique_ptr<protocol::DOMStorage::Frontend> frontend_;
StorageMap local_storage_map_ = {};
StorageMap session_storage_map_ = {};
bool enabled_ = false;
Environment* env_;
};
} // namespace inspector
} // namespace node
#endif // SRC_INSPECTOR_DOM_STORAGE_AGENT_H_