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 CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_STORE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_STORE_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_STORE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_STORE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | 11 #include <vector> |
12 | 12 |
13 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/logging.h" | 15 #include "base/logging.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
18 #include "base/threading/non_thread_safe.h" | 18 #include "base/threading/non_thread_safe.h" |
19 #include "webkit/browser/fileapi/file_system_url.h" | 19 #include "webkit/browser/fileapi/file_system_url.h" |
20 #include "webkit/browser/fileapi/syncable/sync_callbacks.h" | 20 #include "webkit/browser/fileapi/syncable/sync_callbacks.h" |
21 #include "webkit/browser/fileapi/syncable/sync_status_code.h" | 21 #include "webkit/browser/fileapi/syncable/sync_status_code.h" |
22 | 22 |
23 namespace base { | 23 namespace base { |
24 class SequencedTaskRunner; | 24 class SequencedTaskRunner; |
25 } | 25 } |
26 | 26 |
27 namespace leveldb { | 27 namespace leveldb { |
28 class DB; | 28 class DB; |
| 29 class WriteBatch; |
29 } | 30 } |
30 | 31 |
31 class GURL; | 32 class GURL; |
32 | 33 |
33 namespace sync_file_system { | 34 namespace sync_file_system { |
34 | 35 |
35 class DriveMetadata; | 36 class DriveMetadata; |
36 class DriveMetadataDB; | 37 class DriveMetadataDB; |
37 struct DriveMetadataDBContents; | 38 struct DriveMetadataDBContents; |
38 | 39 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 143 |
143 // Maps |resource_id| to corresponding |origin|. | 144 // Maps |resource_id| to corresponding |origin|. |
144 // Returns true if the directory indicated by |resource_id| is not an origin | 145 // Returns true if the directory indicated by |resource_id| is not an origin |
145 // root directory. | 146 // root directory. |
146 bool GetOriginByOriginRootDirectoryId(const std::string& resource_id, | 147 bool GetOriginByOriginRootDirectoryId(const std::string& resource_id, |
147 GURL* origin); | 148 GURL* origin); |
148 | 149 |
149 private: | 150 private: |
150 friend class DriveMetadataStoreTest; | 151 friend class DriveMetadataStoreTest; |
151 | 152 |
| 153 void WriteToDB(scoped_ptr<leveldb::WriteBatch> batch, |
| 154 const SyncStatusCallback& callback); |
| 155 |
152 void UpdateDBStatus(SyncStatusCode status); | 156 void UpdateDBStatus(SyncStatusCode status); |
153 void UpdateDBStatusAndInvokeCallback(const SyncStatusCallback& callback, | 157 void UpdateDBStatusAndInvokeCallback(const SyncStatusCallback& callback, |
154 SyncStatusCode status); | 158 SyncStatusCode status); |
155 void DidInitialize(const InitializationCallback& callback, | 159 void DidInitialize(const InitializationCallback& callback, |
156 DriveMetadataDBContents* contents, | 160 DriveMetadataDBContents* contents, |
157 SyncStatusCode error); | 161 SyncStatusCode error); |
158 void DidUpdateOrigin(const SyncStatusCallback& callback, | 162 void DidUpdateOrigin(const SyncStatusCallback& callback, |
159 SyncStatusCode status); | 163 SyncStatusCode status); |
160 | 164 |
161 // These are only for testing. | 165 // These are only for testing. |
(...skipping 20 matching lines...) Expand all Loading... |
182 ResourceIdByOrigin disabled_origins_; | 186 ResourceIdByOrigin disabled_origins_; |
183 | 187 |
184 OriginByResourceId origin_by_resource_id_; | 188 OriginByResourceId origin_by_resource_id_; |
185 | 189 |
186 DISALLOW_COPY_AND_ASSIGN(DriveMetadataStore); | 190 DISALLOW_COPY_AND_ASSIGN(DriveMetadataStore); |
187 }; | 191 }; |
188 | 192 |
189 } // namespace sync_file_system | 193 } // namespace sync_file_system |
190 | 194 |
191 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_STORE_H_ | 195 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_DRIVE_METADATA_STORE_H_ |
OLD | NEW |