summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/renderer_webstoragenamespace_impl.h
blob: c5a6dfb791113dfbe533f45cd8e678257009f109 (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
// Copyright (c) 2009 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 CHROME_RENDERER_RENDERER_WEBSTORAGENAMESPACE_IMPL_H_
#define CHROME_RENDERER_RENDERER_WEBSTORAGENAMESPACE_IMPL_H_

#include "base/basictypes.h"
#include "chrome/common/dom_storage_type.h"
#include "webkit/api/public/WebStorageNamespace.h"

class RendererWebStorageNamespaceImpl : public WebKit::WebStorageNamespace {
 public:
  explicit RendererWebStorageNamespaceImpl(DOMStorageType storage_type);
  RendererWebStorageNamespaceImpl(
      DOMStorageType storage_type, int64 namespace_id);

  // See WebStorageNamespace.h for documentation on these functions.
  virtual ~RendererWebStorageNamespaceImpl();
  virtual WebKit::WebStorageArea* createStorageArea(
      const WebKit::WebString& origin);
  virtual WebKit::WebStorageNamespace* copy();
  virtual void close();

 private:
  // Used during lazy initialization of namespace_id_.
  const DOMStorageType storage_type_;

  // Our namespace ID.  Lazily initialized.
  int64 namespace_id_;

  // namespace_id_ should equal this iff its unitialized.
  static const int64 kUninitializedNamespaceId = -1;
};

#endif  // CHROME_RENDERER_WEBSTORAGENAMESPACE_IMPL_H_