blob: 408cccc737a15a2a863092a8093bbbcdeeb3e9a9 (
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
// 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_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_
#define CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_
#pragma once
#include "base/basictypes.h"
#include "base/file_path.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "content/browser/browser_thread.h"
class GURL;
class FilePath;
class WebKitContext;
namespace WebKit {
class WebIDBFactory;
}
namespace base {
class MessageLoopProxy;
}
namespace quota {
class QuotaManagerProxy;
class SpecialStoragePolicy;
}
class IndexedDBContext : public base::RefCountedThreadSafe<IndexedDBContext> {
public:
IndexedDBContext(WebKitContext* webkit_context,
quota::SpecialStoragePolicy* special_storage_policy,
quota::QuotaManagerProxy* quota_manager_proxy,
base::MessageLoopProxy* webkit_thread_loop);
~IndexedDBContext();
WebKit::WebIDBFactory* GetIDBFactory();
// The indexed db directory.
static const FilePath::CharType kIndexedDBDirectory[];
// The indexed db file extension.
static const FilePath::CharType kIndexedDBExtension[];
// Get the file name of the indexed db file for the given origin.
FilePath GetIndexedDBFilePath(const string16& origin_id) const;
void set_clear_local_state_on_exit(bool clear_local_state) {
clear_local_state_on_exit_ = clear_local_state;
}
// Deletes a single indexed db file.
void DeleteIndexedDBFile(const FilePath& file_path);
// Deletes all indexed db files for the given origin.
void DeleteIndexedDBForOrigin(const string16& origin_id);
// Does a particular origin get unlimited storage?
bool IsUnlimitedStorageGranted(const GURL& origin) const;
void GetAllOriginIdentifiers(std::vector<string16>* origin_ids);
quota::QuotaManagerProxy* quota_manager_proxy();
#ifdef UNIT_TEST
// For unit tests allow to override the |data_path_|.
void set_data_path(const FilePath& data_path) { data_path_ = data_path; }
#endif
private:
scoped_ptr<WebKit::WebIDBFactory> idb_factory_;
// Path where the indexed db data is stored
FilePath data_path_;
// True if the destructor should delete its files.
bool clear_local_state_on_exit_;
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
DISALLOW_COPY_AND_ASSIGN(IndexedDBContext);
};
#endif // CONTENT_BROWSER_IN_PROCESS_WEBKIT_INDEXED_DB_CONTEXT_H_
|