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

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

Issue 22810002: SyncFS: Reorder initialization sequence of SyncFileSystemService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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"
9 #include "chrome/browser/sync_file_system/sync_callbacks.h"
10 #include "chrome/browser/sync_file_system/sync_status_code.h"
8 #include "webkit/browser/fileapi/file_system_backend.h" 11 #include "webkit/browser/fileapi/file_system_backend.h"
9 #include "webkit/browser/fileapi/file_system_quota_util.h" 12 #include "webkit/browser/fileapi/file_system_quota_util.h"
10 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h" 13 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h"
11 14
12 namespace sync_file_system { 15 namespace sync_file_system {
13 16
14 class LocalFileChangeTracker; 17 class LocalFileChangeTracker;
15 class LocalFileSyncContext; 18 class LocalFileSyncContext;
16 19
17 class SyncFileSystemBackend 20 class SyncFileSystemBackend
18 : public fileapi::FileSystemBackend { 21 : public fileapi::FileSystemBackend {
19 public: 22 public:
20 SyncFileSystemBackend(); 23 explicit SyncFileSystemBackend(Profile* profile);
21 virtual ~SyncFileSystemBackend(); 24 virtual ~SyncFileSystemBackend();
22 25
23 // FileSystemBackend overrides. 26 // FileSystemBackend overrides.
24 virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE; 27 virtual bool CanHandleType(fileapi::FileSystemType type) const OVERRIDE;
25 virtual void Initialize(fileapi::FileSystemContext* context) OVERRIDE; 28 virtual void Initialize(fileapi::FileSystemContext* context) OVERRIDE;
26 virtual void OpenFileSystem( 29 virtual void OpenFileSystem(
27 const GURL& origin_url, 30 const GURL& origin_url,
28 fileapi::FileSystemType type, 31 fileapi::FileSystemType type,
29 fileapi::OpenFileSystemMode mode, 32 fileapi::OpenFileSystemMode mode,
30 const OpenFileSystemCallback& callback) OVERRIDE; 33 const OpenFileSystemCallback& callback) OVERRIDE;
(...skipping 27 matching lines...) Expand all
58 return change_tracker_.get(); 61 return change_tracker_.get();
59 } 62 }
60 void SetLocalFileChangeTracker( 63 void SetLocalFileChangeTracker(
61 scoped_ptr<sync_file_system::LocalFileChangeTracker> tracker); 64 scoped_ptr<sync_file_system::LocalFileChangeTracker> tracker);
62 65
63 sync_file_system::LocalFileSyncContext* sync_context() { 66 sync_file_system::LocalFileSyncContext* sync_context() {
64 return sync_context_.get(); 67 return sync_context_.get();
65 } 68 }
66 void set_sync_context(sync_file_system::LocalFileSyncContext* sync_context); 69 void set_sync_context(sync_file_system::LocalFileSyncContext* sync_context);
67 70
71 // This should be used only for testing.
72 void set_skip_initialize_syncfs_service_for_testing(bool flag) {
73 skip_initialize_syncfs_service_for_testing_ = flag;
74 }
75
68 private: 76 private:
69 // Owned by FileSystemContext. 77 // Owned by FileSystemContext.
70 fileapi::SandboxFileSystemBackendDelegate* delegate_; 78 fileapi::SandboxFileSystemBackendDelegate* delegate_;
71 79
80 // Not owned.
81 fileapi::FileSystemContext* context_;
82 Profile* profile_;
83
72 scoped_ptr<sync_file_system::LocalFileChangeTracker> change_tracker_; 84 scoped_ptr<sync_file_system::LocalFileChangeTracker> change_tracker_;
73 scoped_refptr<sync_file_system::LocalFileSyncContext> sync_context_; 85 scoped_refptr<sync_file_system::LocalFileSyncContext> sync_context_;
74 86
87 // A flag to skip the initialization sequence of SyncFileSystemService for
88 // testing.
89 bool skip_initialize_syncfs_service_for_testing_;
90
91 fileapi::SandboxFileSystemBackendDelegate* GetDelegate() const;
92
93 void InitializeSyncFileSystemService(
94 const GURL& origin_url,
95 const SyncStatusCallback& callback);
96 void DidInitializeSyncFileSystemService(
97 const GURL& origin_url,
98 fileapi::FileSystemType type,
99 fileapi::OpenFileSystemMode mode,
100 const OpenFileSystemCallback& callback,
101 SyncStatusCode status);
102
75 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemBackend); 103 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemBackend);
76 }; 104 };
77 105
78 } // namespace sync_file_system 106 } // namespace sync_file_system
79 107
80 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_ 108 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNC_FILE_SYSTEM_BACKEND_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698