| 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 CONTENT_PUBLIC_BROWSER_SESSION_STORAGE_NAMESPACE_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_SESSION_STORAGE_NAMESPACE_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_SESSION_STORAGE_NAMESPACE_H_ | 6 #define CONTENT_PUBLIC_BROWSER_SESSION_STORAGE_NAMESPACE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "content/common/content_export.h" |
| 12 | 13 |
| 13 namespace content { | 14 namespace content { |
| 14 | 15 |
| 16 class DOMStorageContext; |
| 17 |
| 15 // This is a ref-counted class that represents a SessionStorageNamespace. | 18 // This is a ref-counted class that represents a SessionStorageNamespace. |
| 16 // On destruction it ensures that the storage namespace is destroyed. | 19 // On destruction it ensures that the storage namespace is destroyed. |
| 17 class SessionStorageNamespace | 20 class SessionStorageNamespace |
| 18 : public base::RefCountedThreadSafe<SessionStorageNamespace> { | 21 : public base::RefCountedThreadSafe<SessionStorageNamespace> { |
| 19 public: | 22 public: |
| 23 // Constructs a SessionStorageNamespace by cloning |namespace_to_clone|. |
| 24 // |namespace_to_clone| must belong to |context|. |
| 25 CONTENT_EXPORT static SessionStorageNamespace* Clone( |
| 26 DOMStorageContext* context, |
| 27 SessionStorageNamespace* namespace_to_clone); |
| 28 |
| 20 // Returns the ID of the |SessionStorageNamespace|. The ID is unique among all | 29 // Returns the ID of the |SessionStorageNamespace|. The ID is unique among all |
| 21 // SessionStorageNamespace objects, but not unique across browser runs. | 30 // SessionStorageNamespace objects, but not unique across browser runs. |
| 22 virtual int64 id() const = 0; | 31 virtual int64 id() const = 0; |
| 23 | 32 |
| 24 // Returns the persistent ID for the |SessionStorageNamespace|. The ID is | 33 // Returns the persistent ID for the |SessionStorageNamespace|. The ID is |
| 25 // unique across browser runs. | 34 // unique across browser runs. |
| 26 virtual const std::string& persistent_id() const = 0; | 35 virtual const std::string& persistent_id() const = 0; |
| 27 | 36 |
| 28 // For marking that the sessionStorage will be needed or won't be needed by | 37 // For marking that the sessionStorage will be needed or won't be needed by |
| 29 // session restore. | 38 // session restore. |
| 30 virtual void SetShouldPersist(bool should_persist) = 0; | 39 virtual void SetShouldPersist(bool should_persist) = 0; |
| 31 | 40 |
| 32 virtual bool should_persist() const = 0; | 41 virtual bool should_persist() const = 0; |
| 33 | 42 |
| 34 protected: | 43 protected: |
| 35 friend class base::RefCountedThreadSafe<SessionStorageNamespace>; | 44 friend class base::RefCountedThreadSafe<SessionStorageNamespace>; |
| 36 virtual ~SessionStorageNamespace() {} | 45 virtual ~SessionStorageNamespace() {} |
| 37 }; | 46 }; |
| 38 | 47 |
| 39 } // namespace content | 48 } // namespace content |
| 40 | 49 |
| 41 #endif // CONTENT_PUBLIC_BROWSER_SESSION_STORAGE_NAMESPACE_H_ | 50 #endif // CONTENT_PUBLIC_BROWSER_SESSION_STORAGE_NAMESPACE_H_ |
| OLD | NEW |