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_SYNC_FILE_SYSTEM_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ |
6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ | 6 #define CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/singleton.h" | 13 #include "base/memory/singleton.h" |
14 #include "chrome/browser/profiles/profile_keyed_service.h" | 14 #include "chrome/browser/profiles/profile_keyed_service.h" |
15 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 15 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
16 #include "webkit/fileapi/syncable/sync_status_code.h" | 16 #include "webkit/fileapi/syncable/sync_status_code.h" |
17 | 17 |
18 class GURL; | 18 class GURL; |
19 | 19 |
20 namespace fileapi { | 20 namespace fileapi { |
21 class FileSystemContext; | 21 class FileSystemContext; |
22 } | 22 } |
23 | 23 |
24 namespace sync_file_system { | 24 namespace sync_file_system { |
25 | 25 |
26 class LocalFileSyncService; | 26 class LocalFileSyncService; |
| 27 class RemoteFileSyncService; |
27 | 28 |
28 class SyncFileSystemService : public ProfileKeyedService { | 29 class SyncFileSystemService : public ProfileKeyedService { |
29 public: | 30 public: |
30 typedef base::Callback<void(fileapi::SyncStatusCode status)> StatusCallback; | 31 typedef base::Callback<void(fileapi::SyncStatusCode status)> StatusCallback; |
31 | 32 |
32 // ProfileKeyedService overrides. | 33 // ProfileKeyedService overrides. |
33 virtual void Shutdown() OVERRIDE; | 34 virtual void Shutdown() OVERRIDE; |
34 | 35 |
35 void InitializeForApp( | 36 void InitializeForApp( |
36 fileapi::FileSystemContext* file_system_context, | 37 fileapi::FileSystemContext* file_system_context, |
37 const std::string& service_name, | 38 const std::string& service_name, |
38 const GURL& app_url, | 39 const GURL& app_url, |
39 const StatusCallback& callback); | 40 const StatusCallback& callback); |
40 | 41 |
41 private: | 42 private: |
42 friend class SyncFileSystemServiceFactory; | 43 friend class SyncFileSystemServiceFactory; |
43 | 44 |
44 explicit SyncFileSystemService(Profile* profile); | 45 explicit SyncFileSystemService(Profile* profile); |
45 virtual ~SyncFileSystemService(); | 46 virtual ~SyncFileSystemService(); |
46 | 47 |
47 void Initialize(scoped_ptr<LocalFileSyncService> local_file_service); | 48 void Initialize(scoped_ptr<LocalFileSyncService> local_file_service, |
| 49 scoped_ptr<RemoteFileSyncService> remote_file_service); |
48 | 50 |
49 Profile* profile_; | 51 Profile* profile_; |
50 | 52 |
51 scoped_ptr<LocalFileSyncService> local_file_service_; | 53 scoped_ptr<LocalFileSyncService> local_file_service_; |
| 54 scoped_ptr<RemoteFileSyncService> remote_file_service_; |
52 | 55 |
53 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemService); | 56 DISALLOW_COPY_AND_ASSIGN(SyncFileSystemService); |
54 }; | 57 }; |
55 | 58 |
56 class SyncFileSystemServiceFactory : public ProfileKeyedServiceFactory { | 59 class SyncFileSystemServiceFactory : public ProfileKeyedServiceFactory { |
57 public: | 60 public: |
58 static SyncFileSystemService* GetForProfile(Profile* profile); | 61 static SyncFileSystemService* GetForProfile(Profile* profile); |
59 static SyncFileSystemService* FindForProfile(Profile* profile); | 62 static SyncFileSystemService* FindForProfile(Profile* profile); |
60 static SyncFileSystemServiceFactory* GetInstance(); | 63 static SyncFileSystemServiceFactory* GetInstance(); |
61 | 64 |
62 private: | 65 private: |
63 friend struct DefaultSingletonTraits<SyncFileSystemServiceFactory>; | 66 friend struct DefaultSingletonTraits<SyncFileSystemServiceFactory>; |
64 SyncFileSystemServiceFactory(); | 67 SyncFileSystemServiceFactory(); |
65 virtual ~SyncFileSystemServiceFactory(); | 68 virtual ~SyncFileSystemServiceFactory(); |
66 | 69 |
67 // ProfileKeyedServiceFactory overrides. | 70 // ProfileKeyedServiceFactory overrides. |
68 virtual ProfileKeyedService* BuildServiceInstanceFor( | 71 virtual ProfileKeyedService* BuildServiceInstanceFor( |
69 Profile* profile) const OVERRIDE; | 72 Profile* profile) const OVERRIDE; |
70 }; | 73 }; |
71 | 74 |
72 } // namespace sync_file_system | 75 } // namespace sync_file_system |
73 | 76 |
74 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ | 77 #endif // CHROME_BROWSER_SYNC_FILE_SYSTEM_SYNC_FILE_SYSTEM_SERVICE_H_ |
OLD | NEW |