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