OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ | 5 #ifndef WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ |
6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ | 6 #define WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "webkit/dom_storage/dom_storage_context.h" |
11 | 12 |
12 namespace dom_storage { | 13 namespace dom_storage { |
13 | 14 |
14 class DomStorageContext; | |
15 | |
16 // This refcounted class determines the lifetime of a session | 15 // This refcounted class determines the lifetime of a session |
17 // storage namespace and provides an interface to Clone() an | 16 // storage namespace and provides an interface to Clone() an |
18 // existing session storage namespace. It may be used on any thread. | 17 // existing session storage namespace. It may be used on any thread. |
19 // See class comments for DomStorageContext for a larger overview. | 18 // See class comments for DomStorageContext for a larger overview. |
20 class DomStorageSession | 19 class DomStorageSession |
21 : public base::RefCountedThreadSafe<DomStorageSession> { | 20 : public base::RefCountedThreadSafe<DomStorageSession> { |
22 public: | 21 public: |
23 explicit DomStorageSession(DomStorageContext* context); | 22 explicit DomStorageSession(DomStorageContext* context); |
24 int64 namespace_id() const { return namespace_id_; } | 23 int64 namespace_id() const { return namespace_id_; } |
25 DomStorageSession* Clone(); | 24 DomStorageSession* Clone(); |
26 | 25 |
| 26 void AddSessionStorageObserver( |
| 27 int64 namespace_id, |
| 28 DomStorageContext::SessionStorageObserver* observer); |
| 29 void RemoveSessionStorageObserver(int64 namespace_id); |
| 30 |
27 private: | 31 private: |
28 friend class base::RefCountedThreadSafe<DomStorageSession>; | 32 friend class base::RefCountedThreadSafe<DomStorageSession>; |
29 | 33 |
30 DomStorageSession(DomStorageContext* context, int64 namespace_id); | 34 DomStorageSession(DomStorageContext* context, int64 namespace_id); |
31 ~DomStorageSession(); | 35 ~DomStorageSession(); |
32 | 36 |
33 scoped_refptr<DomStorageContext> context_; | 37 scoped_refptr<DomStorageContext> context_; |
34 int64 namespace_id_; | 38 int64 namespace_id_; |
35 | 39 |
| 40 DomStorageContext::SessionStorageObserver* observer_; |
| 41 |
36 DISALLOW_IMPLICIT_CONSTRUCTORS(DomStorageSession); | 42 DISALLOW_IMPLICIT_CONSTRUCTORS(DomStorageSession); |
37 }; | 43 }; |
38 | 44 |
39 } // namespace dom_storage | 45 } // namespace dom_storage |
40 | 46 |
41 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ | 47 #endif // WEBKIT_DOM_STORAGE_DOM_STORAGE_SESSION_H_ |
OLD | NEW |