OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
14 #include "base/observer_list_threadsafe.h" | 14 #include "base/observer_list_threadsafe.h" |
15 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
16 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" | 16 #include "chrome/browser/sync_file_system/local/local_file_sync_status.h" |
17 #include "chrome/browser/sync_file_system/sync_status_code.h" | 17 #include "chrome/browser/sync_file_system/sync_status_code.h" |
| 18 #include "chrome/test/base/testing_profile.h" |
18 #include "webkit/browser/fileapi/file_system_operation.h" | 19 #include "webkit/browser/fileapi/file_system_operation.h" |
19 #include "webkit/browser/fileapi/file_system_url.h" | 20 #include "webkit/browser/fileapi/file_system_url.h" |
20 #include "webkit/browser/quota/quota_callbacks.h" | 21 #include "webkit/browser/quota/quota_callbacks.h" |
21 #include "webkit/common/fileapi/file_system_types.h" | 22 #include "webkit/common/fileapi/file_system_types.h" |
22 #include "webkit/common/fileapi/file_system_util.h" | 23 #include "webkit/common/fileapi/file_system_util.h" |
23 #include "webkit/common/quota/quota_types.h" | 24 #include "webkit/common/quota/quota_types.h" |
24 | 25 |
25 namespace base { | 26 namespace base { |
26 class MessageLoopProxy; | 27 class MessageLoopProxy; |
27 class SingleThreadTaskRunner; | 28 class SingleThreadTaskRunner; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 const fileapi::FileSystemURL& url, | 187 const fileapi::FileSystemURL& url, |
187 const GURL& blob_url, | 188 const GURL& blob_url, |
188 const WriteCallback& callback); | 189 const WriteCallback& callback); |
189 void DoWriteString(const fileapi::FileSystemURL& url, | 190 void DoWriteString(const fileapi::FileSystemURL& url, |
190 const std::string& data, | 191 const std::string& data, |
191 const WriteCallback& callback); | 192 const WriteCallback& callback); |
192 void DoGetUsageAndQuota(int64* usage, | 193 void DoGetUsageAndQuota(int64* usage, |
193 int64* quota, | 194 int64* quota, |
194 const quota::StatusCallback& callback); | 195 const quota::StatusCallback& callback); |
195 | 196 |
| 197 Profile* profile() { return &profile_; } |
| 198 |
196 private: | 199 private: |
197 typedef ObserverListThreadSafe<LocalFileSyncStatus::Observer> ObserverList; | 200 typedef ObserverListThreadSafe<LocalFileSyncStatus::Observer> ObserverList; |
198 | 201 |
199 // Callbacks. | 202 // Callbacks. |
200 void DidOpenFileSystem(base::PlatformFileError result, | 203 void DidOpenFileSystem(base::PlatformFileError result, |
201 const std::string& name, | 204 const std::string& name, |
202 const GURL& root); | 205 const GURL& root); |
203 void DidInitializeFileSystemContext(sync_file_system::SyncStatusCode status); | 206 void DidInitializeFileSystemContext(sync_file_system::SyncStatusCode status); |
204 | 207 |
205 void InitializeSyncStatusObserver(); | 208 void InitializeSyncStatusObserver(); |
206 | 209 |
207 base::ScopedTempDir data_dir_; | 210 base::ScopedTempDir data_dir_; |
208 const std::string service_name_; | 211 const std::string service_name_; |
209 | 212 |
210 scoped_refptr<quota::QuotaManager> quota_manager_; | 213 scoped_refptr<quota::QuotaManager> quota_manager_; |
211 scoped_refptr<fileapi::FileSystemContext> file_system_context_; | 214 scoped_refptr<fileapi::FileSystemContext> file_system_context_; |
212 const GURL origin_; | 215 const GURL origin_; |
213 const fileapi::FileSystemType type_; | 216 const fileapi::FileSystemType type_; |
214 GURL root_url_; | 217 GURL root_url_; |
215 base::PlatformFileError result_; | 218 base::PlatformFileError result_; |
216 sync_file_system::SyncStatusCode sync_status_; | 219 sync_file_system::SyncStatusCode sync_status_; |
217 | 220 |
218 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 221 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
219 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | 222 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
220 | 223 |
| 224 TestingProfile profile_; |
| 225 |
221 // Boolean flags mainly for helping debug. | 226 // Boolean flags mainly for helping debug. |
222 bool is_filesystem_set_up_; | 227 bool is_filesystem_set_up_; |
223 bool is_filesystem_opened_; | 228 bool is_filesystem_opened_; |
224 | 229 |
225 scoped_refptr<ObserverList> sync_status_observers_; | 230 scoped_refptr<ObserverList> sync_status_observers_; |
226 | 231 |
227 DISALLOW_COPY_AND_ASSIGN(CannedSyncableFileSystem); | 232 DISALLOW_COPY_AND_ASSIGN(CannedSyncableFileSystem); |
228 }; | 233 }; |
229 | 234 |
230 } // namespace sync_file_system | 235 } // namespace sync_file_system |
231 | 236 |
232 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_ | 237 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_CANNED_SYNCABLE_FILE_SYSTEM_H_ |
OLD | NEW |