| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 storage::SpecialStoragePolicy* special_storage_policy, | 56 storage::SpecialStoragePolicy* special_storage_policy, |
| 57 storage::QuotaManagerProxy* quota_manager_proxy, | 57 storage::QuotaManagerProxy* quota_manager_proxy, |
| 58 base::SequencedTaskRunner* task_runner); | 58 base::SequencedTaskRunner* task_runner); |
| 59 | 59 |
| 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 virtual base::SequencedTaskRunner* TaskRunner() const override; | 66 base::SequencedTaskRunner* TaskRunner() const override; |
| 67 virtual std::vector<IndexedDBInfo> GetAllOriginsInfo() override; | 67 std::vector<IndexedDBInfo> GetAllOriginsInfo() override; |
| 68 virtual int64 GetOriginDiskUsage(const GURL& origin_url) override; | 68 int64 GetOriginDiskUsage(const GURL& origin_url) override; |
| 69 virtual void DeleteForOrigin(const GURL& origin_url) override; | 69 void DeleteForOrigin(const GURL& origin_url) override; |
| 70 virtual base::FilePath GetFilePathForTesting( | 70 base::FilePath GetFilePathForTesting( |
| 71 const std::string& origin_id) const override; | 71 const std::string& origin_id) const override; |
| 72 virtual void SetTaskRunnerForTesting(base::SequencedTaskRunner* task_runner) | 72 void SetTaskRunnerForTesting(base::SequencedTaskRunner* task_runner) override; |
| 73 override; | |
| 74 | 73 |
| 75 // Methods called by IndexedDBDispatcherHost for quota support. | 74 // Methods called by IndexedDBDispatcherHost for quota support. |
| 76 void ConnectionOpened(const GURL& origin_url, IndexedDBConnection* db); | 75 void ConnectionOpened(const GURL& origin_url, IndexedDBConnection* db); |
| 77 void ConnectionClosed(const GURL& origin_url, IndexedDBConnection* db); | 76 void ConnectionClosed(const GURL& origin_url, IndexedDBConnection* db); |
| 78 void TransactionComplete(const GURL& origin_url); | 77 void TransactionComplete(const GURL& origin_url); |
| 79 void DatabaseDeleted(const GURL& origin_url); | 78 void DatabaseDeleted(const GURL& origin_url); |
| 80 bool WouldBeOverQuota(const GURL& origin_url, int64 additional_bytes); | 79 bool WouldBeOverQuota(const GURL& origin_url, int64 additional_bytes); |
| 81 bool IsOverQuota(const GURL& origin_url); | 80 bool IsOverQuota(const GURL& origin_url); |
| 82 | 81 |
| 83 storage::QuotaManagerProxy* quota_manager_proxy(); | 82 storage::QuotaManagerProxy* quota_manager_proxy(); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 99 size_t GetConnectionCount(const GURL& origin_url); | 98 size_t GetConnectionCount(const GURL& origin_url); |
| 100 | 99 |
| 101 // For unit tests allow to override the |data_path_|. | 100 // For unit tests allow to override the |data_path_|. |
| 102 void set_data_path_for_testing(const base::FilePath& data_path) { | 101 void set_data_path_for_testing(const base::FilePath& data_path) { |
| 103 data_path_ = data_path; | 102 data_path_ = data_path; |
| 104 } | 103 } |
| 105 | 104 |
| 106 bool is_incognito() const { return data_path_.empty(); } | 105 bool is_incognito() const { return data_path_.empty(); } |
| 107 | 106 |
| 108 protected: | 107 protected: |
| 109 virtual ~IndexedDBContextImpl(); | 108 ~IndexedDBContextImpl() override; |
| 110 | 109 |
| 111 private: | 110 private: |
| 112 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearLocalState); | 111 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearLocalState); |
| 113 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearSessionOnlyDatabases); | 112 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ClearSessionOnlyDatabases); |
| 114 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, SetForceKeepSessionState); | 113 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, SetForceKeepSessionState); |
| 115 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ForceCloseOpenDatabasesOnDelete); | 114 FRIEND_TEST_ALL_PREFIXES(IndexedDBTest, ForceCloseOpenDatabasesOnDelete); |
| 116 friend class IndexedDBQuotaClientTest; | 115 friend class IndexedDBQuotaClientTest; |
| 117 | 116 |
| 118 typedef std::map<GURL, int64> OriginToSizeMap; | 117 typedef std::map<GURL, int64> OriginToSizeMap; |
| 119 class IndexedDBGetUsageAndQuotaCallback; | 118 class IndexedDBGetUsageAndQuotaCallback; |
| (...skipping 30 matching lines...) Expand all Loading... |
| 150 scoped_ptr<std::set<GURL> > origin_set_; | 149 scoped_ptr<std::set<GURL> > origin_set_; |
| 151 OriginToSizeMap origin_size_map_; | 150 OriginToSizeMap origin_size_map_; |
| 152 OriginToSizeMap space_available_map_; | 151 OriginToSizeMap space_available_map_; |
| 153 | 152 |
| 154 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); | 153 DISALLOW_COPY_AND_ASSIGN(IndexedDBContextImpl); |
| 155 }; | 154 }; |
| 156 | 155 |
| 157 } // namespace content | 156 } // namespace content |
| 158 | 157 |
| 159 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ | 158 #endif // CONTENT_BROWSER_INDEXED_DB_INDEXED_DB_CONTEXT_IMPL_H_ |
| OLD | NEW |