summaryrefslogtreecommitdiffstats
path: root/content/renderer/dom_storage/dom_storage_proxy.h
blob: 118aab34da3ffb04ba5ba6d9b9249b07eb871936 (plain)
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
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_PROXY_H_
#define CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_PROXY_H_

#include "base/bind.h"
#include "base/memory/ref_counted.h"
#include "base/strings/nullable_string16.h"
#include "base/strings/string16.h"
#include "content/common/dom_storage/dom_storage_types.h"
#include "url/gurl.h"

namespace content {

// Abstract interface for cached area, renderer to browser communications.
class DOMStorageProxy : public base::RefCounted<DOMStorageProxy> {
 public:
  typedef base::Callback<void(bool)> CompletionCallback;

  virtual void LoadArea(int connection_id,
                        DOMStorageValuesMap* values,
                        bool* send_log_get_messages,
                        const CompletionCallback& callback) = 0;

  virtual void SetItem(int connection_id,
                       const base::string16& key,
                       const base::string16& value,
                       const GURL& page_url,
                       const CompletionCallback& callback) = 0;

  virtual void LogGetItem(int connection_id,
                          const base::string16& key,
                          const base::NullableString16& value) = 0;

  virtual void RemoveItem(int connection_id,
                          const base::string16& key,
                          const GURL& page_url,
                          const CompletionCallback& callback) = 0;

  virtual void ClearArea(int connection_id,
                         const GURL& page_url,
                         const CompletionCallback& callback) = 0;

 protected:
  friend class base::RefCounted<DOMStorageProxy>;
  virtual ~DOMStorageProxy() {}
};

}  // namespace content

#endif  // CONTENT_RENDERER_DOM_STORAGE_DOM_STORAGE_PROXY_H_