OLD | NEW |
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 <string> | 10 #include <string> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 IndexedDBFactory* GetIDBFactory(); | 60 IndexedDBFactory* GetIDBFactory(); |
61 | 61 |
62 // Disables the exit-time deletion of session-only data. | 62 // Disables the exit-time deletion of session-only data. |
63 void SetForceKeepSessionState() { force_keep_session_state_ = true; } | 63 void SetForceKeepSessionState() { force_keep_session_state_ = true; } |
64 | 64 |
65 // IndexedDBContext implementation: | 65 // IndexedDBContext implementation: |
66 base::SequencedTaskRunner* TaskRunner() const override; | 66 base::SequencedTaskRunner* TaskRunner() const override; |
67 std::vector<IndexedDBInfo> GetAllOriginsInfo() override; | 67 std::vector<IndexedDBInfo> GetAllOriginsInfo() override; |
68 int64 GetOriginDiskUsage(const GURL& origin_url) override; | 68 int64 GetOriginDiskUsage(const GURL& origin_url) override; |
69 void DeleteForOrigin(const GURL& origin_url) override; | 69 void DeleteForOrigin(const GURL& origin_url) override; |
70 base::FilePath GetFilePathForTesting( | 70 base::FilePath GetFilePath(const GURL& origin_url) const override; |
71 const std::string& origin_id) const override; | |
72 void SetTaskRunnerForTesting(base::SequencedTaskRunner* task_runner) override; | 71 void SetTaskRunnerForTesting(base::SequencedTaskRunner* task_runner) override; |
73 | 72 |
74 // Methods called by IndexedDBDispatcherHost for quota support. | 73 // Methods called by IndexedDBDispatcherHost for quota support. |
75 void ConnectionOpened(const GURL& origin_url, IndexedDBConnection* db); | 74 void ConnectionOpened(const GURL& origin_url, IndexedDBConnection* db); |
76 void ConnectionClosed(const GURL& origin_url, IndexedDBConnection* db); | 75 void ConnectionClosed(const GURL& origin_url, IndexedDBConnection* db); |
77 void TransactionComplete(const GURL& origin_url); | 76 void TransactionComplete(const GURL& origin_url); |
78 void DatabaseDeleted(const GURL& origin_url); | 77 void DatabaseDeleted(const GURL& origin_url); |
79 bool WouldBeOverQuota(const GURL& origin_url, int64 additional_bytes); | 78 bool WouldBeOverQuota(const GURL& origin_url, int64 additional_bytes); |
80 bool IsOverQuota(const GURL& origin_url); | 79 bool IsOverQuota(const GURL& origin_url); |
81 | 80 |
82 storage::QuotaManagerProxy* quota_manager_proxy(); | 81 storage::QuotaManagerProxy* quota_manager_proxy(); |
83 | 82 |
84 std::vector<GURL> GetAllOrigins(); | 83 std::vector<GURL> GetAllOrigins(); |
85 base::Time GetOriginLastModified(const GURL& origin_url); | 84 base::Time GetOriginLastModified(const GURL& origin_url); |
86 base::ListValue* GetAllOriginsDetails(); | 85 base::ListValue* GetAllOriginsDetails(); |
87 | 86 |
88 // ForceClose takes a value rather than a reference since it may release the | 87 // ForceClose takes a value rather than a reference since it may release the |
89 // owning object. | 88 // owning object. |
90 void ForceClose(const GURL origin_url, ForceCloseReason reason); | 89 void ForceClose(const GURL origin_url, ForceCloseReason reason); |
91 | 90 |
92 base::FilePath GetFilePath(const GURL& origin_url) const; | |
93 base::FilePath data_path() const { return data_path_; } | 91 base::FilePath data_path() const { return data_path_; } |
94 bool IsInOriginSet(const GURL& origin_url) { | 92 bool IsInOriginSet(const GURL& origin_url) { |
95 std::set<GURL>* set = GetOriginSet(); | 93 std::set<GURL>* set = GetOriginSet(); |
96 return set->find(origin_url) != set->end(); | 94 return set->find(origin_url) != set->end(); |
97 } | 95 } |
98 size_t GetConnectionCount(const GURL& origin_url); | 96 size_t GetConnectionCount(const GURL& origin_url); |
99 | 97 |
100 // For unit tests allow to override the |data_path_|. | 98 // For unit tests allow to override the |data_path_|. |
101 void set_data_path_for_testing(const base::FilePath& data_path) { | 99 void set_data_path_for_testing(const base::FilePath& data_path) { |
102 data_path_ = data_path; | 100 data_path_ = data_path; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 scoped_ptr<std::set<GURL> > origin_set_; | 147 scoped_ptr<std::set<GURL> > origin_set_; |
150 OriginToSizeMap origin_size_map_; | 148 OriginToSizeMap origin_size_map_; |
151 OriginToSizeMap space_available_map_; | 149 OriginToSizeMap space_available_map_; |
152 | 150 |
153 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); | 151 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); |
154 }; | 152 }; |
155 | 153 |
156 } // namespace content | 154 } // namespace content |
157 | 155 |
158 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ | 156 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ |
OLD | NEW |