| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ | 5 #ifndef CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ |
| 6 #define CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ | 6 #define CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 void SetDatabaseForTesting(leveldb::mojom::LevelDBDatabasePtr database); | 36 void SetDatabaseForTesting(leveldb::mojom::LevelDBDatabasePtr database); |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 void OnLevelDBWrapperHasNoBindings(const url::Origin& origin); | 39 void OnLevelDBWrapperHasNoBindings(const url::Origin& origin); |
| 40 void OnUserServiceConnectionComplete(); | 40 void OnUserServiceConnectionComplete(); |
| 41 void OnUserServiceConnectionError(); | 41 void OnUserServiceConnectionError(); |
| 42 | 42 |
| 43 // Part of our asynchronous directory opening called from OpenLocalStorage(). | 43 // Part of our asynchronous directory opening called from OpenLocalStorage(). |
| 44 void OnDirectoryOpened(filesystem::mojom::FileError err); | 44 void OnDirectoryOpened(filesystem::mojom::FileError err); |
| 45 void OnDatabaseOpened(leveldb::mojom::DatabaseError status); | 45 void OnDatabaseOpened(leveldb::mojom::DatabaseError status); |
| 46 void OnGotDatabaseVersion(leveldb::mojom::DatabaseError status, |
| 47 const std::vector<uint8_t>& value); |
| 46 | 48 |
| 47 // The (possibly delayed) implementation of OpenLocalStorage(). Can be called | 49 // The (possibly delayed) implementation of OpenLocalStorage(). Can be called |
| 48 // directly from that function, or through |on_database_open_callbacks_|. | 50 // directly from that function, or through |on_database_open_callbacks_|. |
| 49 void BindLocalStorage(const url::Origin& origin, | 51 void BindLocalStorage(const url::Origin& origin, |
| 50 mojom::LevelDBWrapperRequest request); | 52 mojom::LevelDBWrapperRequest request); |
| 51 | 53 |
| 52 service_manager::Connector* const connector_; | 54 service_manager::Connector* const connector_; |
| 53 const base::FilePath subdirectory_; | 55 const base::FilePath subdirectory_; |
| 54 | 56 |
| 55 enum ConnectionState { | 57 enum ConnectionState { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 70 | 72 |
| 71 // Maps between an origin and its prefixed LevelDB view. | 73 // Maps between an origin and its prefixed LevelDB view. |
| 72 std::map<url::Origin, std::unique_ptr<LevelDBWrapperImpl>> level_db_wrappers_; | 74 std::map<url::Origin, std::unique_ptr<LevelDBWrapperImpl>> level_db_wrappers_; |
| 73 | 75 |
| 74 base::WeakPtrFactory<LocalStorageContextMojo> weak_ptr_factory_; | 76 base::WeakPtrFactory<LocalStorageContextMojo> weak_ptr_factory_; |
| 75 }; | 77 }; |
| 76 | 78 |
| 77 } // namespace content | 79 } // namespace content |
| 78 | 80 |
| 79 #endif // CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ | 81 #endif // CONTENT_BROWSER_DOM_STORAGE_LOCAL_STORAGE_CONTEXT_MOJO_H_ |
| OLD | NEW |