blob: ef9d61f441b0621320594688cbf3d133921bbb15 (
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
56
57
58
|
// Copyright (c) 2012 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_INDEXED_DB_CONTEXT_H_
#define CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_
#include <stdint.h>
#include <string>
#include <vector>
#include "base/files/file_path.h"
#include "base/memory/ref_counted.h"
#include "content/common/content_export.h"
#include "content/public/browser/indexed_db_info.h"
namespace base {
class SequencedTaskRunner;
}
namespace content {
// Represents the per-BrowserContext IndexedDB data.
// Call these methods only via the exposed TaskRunner.
class IndexedDBContext : public base::RefCountedThreadSafe<IndexedDBContext> {
public:
// Only call the below methods by posting to this TaskRunner.
virtual base::SequencedTaskRunner* TaskRunner() const = 0;
// Methods used in response to QuotaManager requests.
virtual std::vector<IndexedDBInfo> GetAllOriginsInfo() = 0;
virtual int64_t GetOriginDiskUsage(const GURL& origin_url) = 0;
// Deletes all indexed db files for the given origin.
virtual void DeleteForOrigin(const GURL& origin_url) = 0;
// Copies the indexed db files from this context to another. The
// indexed db directory in the destination context needs to be empty.
virtual void CopyOriginData(const GURL& origin_url,
IndexedDBContext* dest_context) = 0;
// Get the file name of the local storage file for the given origin.
virtual base::FilePath GetFilePathForTesting(
const GURL& origin_url) const = 0;
// Set the task runner for tests if browser main loop is not initialized.
virtual void SetTaskRunnerForTesting(
base::SequencedTaskRunner* task_runner) = 0;
protected:
friend class base::RefCountedThreadSafe<IndexedDBContext>;
virtual ~IndexedDBContext() {}
};
} // namespace content
#endif // CONTENT_PUBLIC_BROWSER_INDEXED_DB_CONTEXT_H_
|