Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Side by Side Diff: content/browser/indexed_db/indexed_db_context_impl.h

Issue 16573003: Remove content/browser dependency on WebKit::WebIDBCallbacks and WebKit::WebIDBDatabaseCallbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ 5 #ifndef CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_
6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ 6 #define CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "content/browser/indexed_db/webidbfactory_impl.h"
16 #include "content/public/browser/indexed_db_context.h" 17 #include "content/public/browser/indexed_db_context.h"
17 #include "googleurl/src/gurl.h" 18 #include "googleurl/src/gurl.h"
18 #include "webkit/common/quota/quota_types.h" 19 #include "webkit/common/quota/quota_types.h"
19 20
20 class GURL; 21 class GURL;
21 22
22 namespace WebKit { 23 namespace WebKit {
23 class WebIDBDatabase;
24 class WebIDBFactory; 24 class WebIDBFactory;
25 } 25 }
26 26
27 namespace base { 27 namespace base {
28 class FilePath; 28 class FilePath;
29 class MessageLoopProxy; 29 class MessageLoopProxy;
30 } 30 }
31 31
32 namespace quota { 32 namespace quota {
33 class QuotaManagerProxy; 33 class QuotaManagerProxy;
34 class SpecialStoragePolicy; 34 class SpecialStoragePolicy;
35 } 35 }
36 36
37 namespace content { 37 namespace content {
38 38
39 class WebIDBDatabaseImpl;
40
39 class CONTENT_EXPORT IndexedDBContextImpl 41 class CONTENT_EXPORT IndexedDBContextImpl
40 : NON_EXPORTED_BASE(public IndexedDBContext) { 42 : NON_EXPORTED_BASE(public IndexedDBContext) {
41 public: 43 public:
42 // If |data_path| is empty, nothing will be saved to disk. 44 // If |data_path| is empty, nothing will be saved to disk.
43 IndexedDBContextImpl(const base::FilePath& data_path, 45 IndexedDBContextImpl(const base::FilePath& data_path,
44 quota::SpecialStoragePolicy* special_storage_policy, 46 quota::SpecialStoragePolicy* special_storage_policy,
45 quota::QuotaManagerProxy* quota_manager_proxy, 47 quota::QuotaManagerProxy* quota_manager_proxy,
46 base::MessageLoopProxy* webkit_thread_loop); 48 base::MessageLoopProxy* webkit_thread_loop);
47 49
48 WebKit::WebIDBFactory* GetIDBFactory(); 50 WebIDBFactoryImpl* GetIDBFactory();
49 51
50 // The indexed db directory. 52 // The indexed db directory.
51 static const base::FilePath::CharType kIndexedDBDirectory[]; 53 static const base::FilePath::CharType kIndexedDBDirectory[];
52 54
53 // The indexed db file extension. 55 // The indexed db file extension.
54 static const base::FilePath::CharType kIndexedDBExtension[]; 56 static const base::FilePath::CharType kIndexedDBExtension[];
55 57
56 // Disables the exit-time deletion of session-only data. 58 // Disables the exit-time deletion of session-only data.
57 void SetForceKeepSessionState() { force_keep_session_state_ = true; } 59 void SetForceKeepSessionState() { force_keep_session_state_ = true; }
58 60
59 // IndexedDBContext implementation: 61 // IndexedDBContext implementation:
60 virtual std::vector<GURL> GetAllOrigins() OVERRIDE; 62 virtual std::vector<GURL> GetAllOrigins() OVERRIDE;
61 virtual std::vector<IndexedDBInfo> GetAllOriginsInfo() OVERRIDE; 63 virtual std::vector<IndexedDBInfo> GetAllOriginsInfo() OVERRIDE;
62 virtual int64 GetOriginDiskUsage(const GURL& origin_url) OVERRIDE; 64 virtual int64 GetOriginDiskUsage(const GURL& origin_url) OVERRIDE;
63 virtual base::Time GetOriginLastModified(const GURL& origin_url) OVERRIDE; 65 virtual base::Time GetOriginLastModified(const GURL& origin_url) OVERRIDE;
64 virtual void DeleteForOrigin(const GURL& origin_url) OVERRIDE; 66 virtual void DeleteForOrigin(const GURL& origin_url) OVERRIDE;
65 virtual base::FilePath GetFilePathForTesting(const string16& origin_id) const 67 virtual base::FilePath GetFilePathForTesting(const string16& origin_id) const
66 OVERRIDE; 68 OVERRIDE;
67 69
68 // Methods called by IndexedDBDispatcherHost for quota support. 70 // Methods called by IndexedDBDispatcherHost for quota support.
69 void ConnectionOpened(const GURL& origin_url, WebKit::WebIDBDatabase* db); 71 void ConnectionOpened(const GURL& origin_url, WebIDBDatabaseImpl* db);
70 void ConnectionClosed(const GURL& origin_url, WebKit::WebIDBDatabase* db); 72 void ConnectionClosed(const GURL& origin_url, WebIDBDatabaseImpl* db);
71 void TransactionComplete(const GURL& origin_url); 73 void TransactionComplete(const GURL& origin_url);
72 bool WouldBeOverQuota(const GURL& origin_url, int64 additional_bytes); 74 bool WouldBeOverQuota(const GURL& origin_url, int64 additional_bytes);
73 bool IsOverQuota(const GURL& origin_url); 75 bool IsOverQuota(const GURL& origin_url);
74 76
75 quota::QuotaManagerProxy* quota_manager_proxy(); 77 quota::QuotaManagerProxy* quota_manager_proxy();
76 78
77 void ForceClose(const GURL& origin_url); 79 void ForceClose(const GURL& origin_url);
78 base::FilePath GetFilePath(const GURL& origin_url); 80 base::FilePath GetFilePath(const GURL& origin_url);
79 base::FilePath data_path() const { return data_path_; } 81 base::FilePath data_path() const { return data_path_; }
80 bool IsInOriginSet(const GURL& origin_url) { 82 bool IsInOriginSet(const GURL& origin_url) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 std::set<GURL>* GetOriginSet(); 116 std::set<GURL>* GetOriginSet();
115 bool AddToOriginSet(const GURL& origin_url) { 117 bool AddToOriginSet(const GURL& origin_url) {
116 return GetOriginSet()->insert(origin_url).second; 118 return GetOriginSet()->insert(origin_url).second;
117 } 119 }
118 void RemoveFromOriginSet(const GURL& origin_url) { 120 void RemoveFromOriginSet(const GURL& origin_url) {
119 GetOriginSet()->erase(origin_url); 121 GetOriginSet()->erase(origin_url);
120 } 122 }
121 // Only for testing. 123 // Only for testing.
122 void ResetCaches(); 124 void ResetCaches();
123 125
124 scoped_ptr<WebKit::WebIDBFactory> idb_factory_; 126 scoped_ptr<WebIDBFactoryImpl> idb_factory_;
125 base::FilePath data_path_; 127 base::FilePath data_path_;
126 // If true, nothing (not even session-only data) should be deleted on exit. 128 // If true, nothing (not even session-only data) should be deleted on exit.
127 bool force_keep_session_state_; 129 bool force_keep_session_state_;
128 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; 130 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
129 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; 131 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
130 scoped_ptr<std::set<GURL> > origin_set_; 132 scoped_ptr<std::set<GURL> > origin_set_;
131 OriginToSizeMap origin_size_map_; 133 OriginToSizeMap origin_size_map_;
132 OriginToSizeMap space_available_map_; 134 OriginToSizeMap space_available_map_;
133 typedef std::set<WebKit::WebIDBDatabase*> ConnectionSet; 135 typedef std::set<WebIDBDatabaseImpl*> ConnectionSet;
134 std::map<GURL, ConnectionSet> connections_; 136 std::map<GURL, ConnectionSet> connections_;
135 137
136 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); 138 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl);
137 }; 139 };
138 140
139 } // namespace content 141 } // namespace content
140 142
141 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ 143 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698