summaryrefslogtreecommitdiffstats
path: root/content/public/browser/dom_storage_context.h
blob: 06c36e303cbf55699d624799ed7c999db4ead2ea (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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) 2011 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 CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_
#define CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_
#pragma once

#include <vector>

#include "base/callback.h"
#include "base/string16.h"
#include "content/common/content_export.h"

class FilePath;

namespace base {
class Time;
}

namespace content {

class BrowserContext;

// Represents the per-BrowserContext Local Storage data.
class DOMStorageContext {
 public:
  typedef base::Callback<void(const std::vector<FilePath>&)>
      GetAllStorageFilesCallback;

  // Returns all the file paths of local storage files to the given callback.
  virtual void GetAllStorageFiles(
      const GetAllStorageFilesCallback& callback) = 0;

  // Get the file name of the local storage file for the given origin.
  virtual FilePath GetFilePath(const string16& origin_id) const = 0;

  // Deletes the local storage file for the given origin.
  virtual void DeleteForOrigin(const string16& origin_id) = 0;

  // Deletes a single local storage file.
  virtual void DeleteLocalStorageFile(const FilePath& file_path) = 0;

  // Delete any local storage files that have been touched since the cutoff
  // date that's supplied. Protected origins, per the SpecialStoragePolicy,
  // are not deleted by this method.
  virtual void DeleteDataModifiedSince(const base::Time& cutoff) = 0;

 protected:
  virtual ~DOMStorageContext() {}
};

}  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_DOM_STORAGE_CONTEXT_H_