Popular sites on the NTP: Try to keep the ordering constant
[chromium-blink-merge.git] / content / public / browser / session_storage_namespace.h
blob78110af9caf1a3c55f923744f881750afed1d751
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_SESSION_STORAGE_NAMESPACE_H_
6 #define CONTENT_PUBLIC_BROWSER_SESSION_STORAGE_NAMESPACE_H_
8 #include <map>
9 #include <string>
11 #include "base/basictypes.h"
12 #include "base/memory/ref_counted.h"
14 namespace content {
16 // This is a ref-counted class that represents a SessionStorageNamespace.
17 // On destruction it ensures that the storage namespace is destroyed.
18 class SessionStorageNamespace
19 : public base::RefCountedThreadSafe<SessionStorageNamespace> {
20 public:
21 // Returns the ID of the |SessionStorageNamespace|. The ID is unique among all
22 // SessionStorageNamespace objects, but not unique across browser runs.
23 virtual int64 id() const = 0;
25 // Returns the persistent ID for the |SessionStorageNamespace|. The ID is
26 // unique across browser runs.
27 virtual const std::string& persistent_id() const = 0;
29 // For marking that the sessionStorage will be needed or won't be needed by
30 // session restore.
31 virtual void SetShouldPersist(bool should_persist) = 0;
33 virtual bool should_persist() const = 0;
35 protected:
36 friend class base::RefCountedThreadSafe<SessionStorageNamespace>;
37 virtual ~SessionStorageNamespace() {}
40 // Used to store mappings of StoragePartition id to SessionStorageNamespace.
41 typedef std::map<std::string, scoped_refptr<SessionStorageNamespace> >
42 SessionStorageNamespaceMap;
44 } // namespace content
46 #endif // CONTENT_PUBLIC_BROWSER_SESSION_STORAGE_NAMESPACE_H_