Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(863)

Side by Side Diff: chrome/browser/sync_file_system/local/sync_file_system_backend.h

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_SYNC_FILE_SYSTEM_BACKEND_H_ 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_ 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_
7 7
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/sync_file_system/sync_callbacks.h" 9 #include "chrome/browser/sync_file_system/sync_callbacks.h"
10 #include "chrome/browser/sync_file_system/sync_status_code.h" 10 #include "chrome/browser/sync_file_system/sync_status_code.h"
11 #include "content/public/browser/notification_observer.h" 11 #include "content/public/browser/notification_observer.h"
12 #include "content/public/browser/notification_registrar.h" 12 #include "content/public/browser/notification_registrar.h"
13 #include "webkit/browser/fileapi/file_system_backend.h" 13 #include "webkit/browser/fileapi/file_system_backend.h"
14 #include "webkit/browser/fileapi/file_system_quota_util.h" 14 #include "webkit/browser/fileapi/file_system_quota_util.h"
15 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h" 15 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h"
16 16
17 namespace sync_file_system { 17 namespace sync_file_system {
18 18
19 class LocalFileChangeTracker; 19 class LocalFileChangeTracker;
20 class LocalFileSyncContext; 20 class LocalFileSyncContext;
21 21
22 class SyncFileSystemBackend 22 class SyncFileSystemBackend : public storage::FileSystemBackend {
23 : public fileapi::FileSystemBackend {
24 public: 23 public:
25 explicit SyncFileSystemBackend(Profile* profile); 24 explicit SyncFileSystemBackend(Profile* profile);
26 virtual ~SyncFileSystemBackend(); 25 virtual ~SyncFileSystemBackend();
27 26
28 static SyncFileSystemBackend* CreateForTesting(); 27 static SyncFileSystemBackend* CreateForTesting();
29 28
30 // FileSystemBackend overrides. 29 // FileSystemBackend overrides.
31 virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE; 30 virtual bool CanHandleType(storage::FileSystemType type) const OVERRIDE;
32 virtual void Initialize(fileapi::FileSystemContext* context) OVERRIDE; 31 virtual void Initialize(storage::FileSystemContext* context) OVERRIDE;
33 virtual void ResolveURL(const fileapi::FileSystemURL& url, 32 virtual void ResolveURL(const storage::FileSystemURL& url,
34 fileapi::OpenFileSystemMode mode, 33 storage::OpenFileSystemMode mode,
35 const OpenFileSystemCallback& callback) OVERRIDE; 34 const OpenFileSystemCallback& callback) OVERRIDE;
36 virtual fileapi::AsyncFileUtil* GetAsyncFileUtil( 35 virtual storage::AsyncFileUtil* GetAsyncFileUtil(
37 fileapi::FileSystemType type) OVERRIDE; 36 storage::FileSystemType type) OVERRIDE;
38 virtual fileapi::CopyOrMoveFileValidatorFactory* 37 virtual storage::CopyOrMoveFileValidatorFactory*
39 GetCopyOrMoveFileValidatorFactory( 38 GetCopyOrMoveFileValidatorFactory(storage::FileSystemType type,
40 fileapi::FileSystemType type, 39 base::File::Error* error_code) OVERRIDE;
41 base::File::Error* error_code) OVERRIDE; 40 virtual storage::FileSystemOperation* CreateFileSystemOperation(
42 virtual fileapi::FileSystemOperation* CreateFileSystemOperation( 41 const storage::FileSystemURL& url,
43 const fileapi::FileSystemURL& url, 42 storage::FileSystemContext* context,
44 fileapi::FileSystemContext* context,
45 base::File::Error* error_code) const OVERRIDE; 43 base::File::Error* error_code) const OVERRIDE;
46 virtual bool SupportsStreaming( 44 virtual bool SupportsStreaming(
47 const fileapi::FileSystemURL& url) const OVERRIDE; 45 const storage::FileSystemURL& url) const OVERRIDE;
48 virtual bool HasInplaceCopyImplementation( 46 virtual bool HasInplaceCopyImplementation(
49 fileapi::FileSystemType type) const OVERRIDE; 47 storage::FileSystemType type) const OVERRIDE;
50 virtual scoped_ptr<webkit_blob::FileStreamReader> CreateFileStreamReader( 48 virtual scoped_ptr<storage::FileStreamReader> CreateFileStreamReader(
51 const fileapi::FileSystemURL& url, 49 const storage::FileSystemURL& url,
52 int64 offset, 50 int64 offset,
53 const base::Time& expected_modification_time, 51 const base::Time& expected_modification_time,
54 fileapi::FileSystemContext* context) const OVERRIDE; 52 storage::FileSystemContext* context) const OVERRIDE;
55 virtual scoped_ptr<fileapi::FileStreamWriter> CreateFileStreamWriter( 53 virtual scoped_ptr<storage::FileStreamWriter> CreateFileStreamWriter(
56 const fileapi::FileSystemURL& url, 54 const storage::FileSystemURL& url,
57 int64 offset, 55 int64 offset,
58 fileapi::FileSystemContext* context) const OVERRIDE; 56 storage::FileSystemContext* context) const OVERRIDE;
59 virtual fileapi::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE; 57 virtual storage::FileSystemQuotaUtil* GetQuotaUtil() OVERRIDE;
60 58
61 static SyncFileSystemBackend* GetBackend( 59 static SyncFileSystemBackend* GetBackend(
62 const fileapi::FileSystemContext* context); 60 const storage::FileSystemContext* context);
63 61
64 LocalFileChangeTracker* change_tracker() { return change_tracker_.get(); } 62 LocalFileChangeTracker* change_tracker() { return change_tracker_.get(); }
65 void SetLocalFileChangeTracker(scoped_ptr<LocalFileChangeTracker> tracker); 63 void SetLocalFileChangeTracker(scoped_ptr<LocalFileChangeTracker> tracker);
66 64
67 LocalFileSyncContext* sync_context() { return sync_context_.get(); } 65 LocalFileSyncContext* sync_context() { return sync_context_.get(); }
68 void set_sync_context(LocalFileSyncContext* sync_context); 66 void set_sync_context(LocalFileSyncContext* sync_context);
69 67
70 private: 68 private:
71 class ProfileHolder : public content::NotificationObserver { 69 class ProfileHolder : public content::NotificationObserver {
72 public: 70 public:
73 explicit ProfileHolder(Profile* profile); 71 explicit ProfileHolder(Profile* profile);
74 72
75 // NotificationObserver override. 73 // NotificationObserver override.
76 virtual void Observe(int type, 74 virtual void Observe(int type,
77 const content::NotificationSource& source, 75 const content::NotificationSource& source,
78 const content::NotificationDetails& details) OVERRIDE; 76 const content::NotificationDetails& details) OVERRIDE;
79 77
80 Profile* GetProfile(); 78 Profile* GetProfile();
81 79
82 private: 80 private:
83 content::NotificationRegistrar registrar_; 81 content::NotificationRegistrar registrar_;
84 Profile* profile_; 82 Profile* profile_;
85 }; 83 };
86 84
87 // Not owned. 85 // Not owned.
88 fileapi::FileSystemContext* context_; 86 storage::FileSystemContext* context_;
89 87
90 scoped_ptr<LocalFileChangeTracker> change_tracker_; 88 scoped_ptr<LocalFileChangeTracker> change_tracker_;
91 scoped_refptr<LocalFileSyncContext> sync_context_; 89 scoped_refptr<LocalFileSyncContext> sync_context_;
92 90
93 // Should be accessed on the UI thread. 91 // Should be accessed on the UI thread.
94 scoped_ptr<ProfileHolder> profile_holder_; 92 scoped_ptr<ProfileHolder> profile_holder_;
95 93
96 // A flag to skip the initialization sequence of SyncFileSystemService for 94 // A flag to skip the initialization sequence of SyncFileSystemService for
97 // testing. 95 // testing.
98 bool skip_initialize_syncfs_service_for_testing_; 96 bool skip_initialize_syncfs_service_for_testing_;
99 97
100 fileapi::SandboxFileSystemBackendDelegate* GetDelegate() const; 98 storage::SandboxFileSystemBackendDelegate* GetDelegate() const;
101 99
102 void InitializeSyncFileSystemService( 100 void InitializeSyncFileSystemService(
103 const GURL& origin_url, 101 const GURL& origin_url,
104 const SyncStatusCallback& callback); 102 const SyncStatusCallback& callback);
105 void DidInitializeSyncFileSystemService( 103 void DidInitializeSyncFileSystemService(
106 fileapi::FileSystemContext* context, 104 storage::FileSystemContext* context,
107 const GURL& origin_url, 105 const GURL& origin_url,
108 fileapi::FileSystemType type, 106 storage::FileSystemType type,
109 fileapi::OpenFileSystemMode mode, 107 storage::OpenFileSystemMode mode,
110 const OpenFileSystemCallback& callback, 108 const OpenFileSystemCallback& callback,
111 SyncStatusCode status); 109 SyncStatusCode status);
112 110
113 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemBackend); 111 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemBackend);
114 }; 112 };
115 113
116 } // namespace sync_file_system 114 } // namespace sync_file_system
117 115
118 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_ 116 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698