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_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/memory/singleton.h" | 9 #include "base/memory/singleton.h" |
10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
11 #include "chrome/browser/profiles/profile_keyed_service.h" | 11 #include "chrome/browser/profiles/profile_keyed_service.h" |
12 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 12 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
13 | 13 |
14 class FilePath; | 14 class FilePath; |
15 | 15 |
16 namespace gdata { | 16 namespace gdata { |
17 | 17 |
18 class DocumentsServiceInterface; | 18 class DocumentsServiceInterface; |
19 class DriveWebAppsRegistry; | 19 class DriveWebAppsRegistry; |
20 class GDataCache; | 20 class GDataCache; |
| 21 class GDataContactsService; |
21 class GDataDownloadObserver; | 22 class GDataDownloadObserver; |
22 class GDataFileSystemInterface; | 23 class GDataFileSystemInterface; |
23 class GDataSyncClient; | 24 class GDataSyncClient; |
24 class GDataUploader; | 25 class GDataUploader; |
25 | 26 |
26 // GDataSystemService runs the GData system, including the GData file system | 27 // GDataSystemService runs the GData system, including the GData file system |
27 // implementation for the file manager, and some other sub systems. | 28 // implementation for the file manager, and some other sub systems. |
28 // | 29 // |
29 // The class is essentially a container that manages lifetime of the objects | 30 // The class is essentially a container that manages lifetime of the objects |
30 // that are used to run the GData system. The GDataSystemService object is | 31 // that are used to run the GData system. The GDataSystemService object is |
31 // created per-profile. | 32 // created per-profile. |
32 class GDataSystemService : public ProfileKeyedService { | 33 class GDataSystemService : public ProfileKeyedService { |
33 public: | 34 public: |
34 // Returns the documents service instance. | |
35 DocumentsServiceInterface* docs_service() { return documents_service_.get(); } | 35 DocumentsServiceInterface* docs_service() { return documents_service_.get(); } |
36 | |
37 // Returns the cache instance. | |
38 GDataCache* cache() { return cache_; } | 36 GDataCache* cache() { return cache_; } |
39 | |
40 // Returns the file system instance. | |
41 GDataFileSystemInterface* file_system() { return file_system_.get(); } | 37 GDataFileSystemInterface* file_system() { return file_system_.get(); } |
42 | |
43 // Returns the uploader instance. | |
44 GDataUploader* uploader() { return uploader_.get(); } | 38 GDataUploader* uploader() { return uploader_.get(); } |
45 | 39 GDataContactsService* contacts_service() { return contacts_service_.get(); } |
46 // Returns the file system instance. | |
47 DriveWebAppsRegistry* webapps_registry() { return webapps_registry_.get(); } | 40 DriveWebAppsRegistry* webapps_registry() { return webapps_registry_.get(); } |
48 | 41 |
49 // ProfileKeyedService override: | 42 // ProfileKeyedService override: |
50 virtual void Shutdown() OVERRIDE; | 43 virtual void Shutdown() OVERRIDE; |
51 | 44 |
52 private: | 45 private: |
53 explicit GDataSystemService(Profile* profile); | 46 explicit GDataSystemService(Profile* profile); |
54 virtual ~GDataSystemService(); | 47 virtual ~GDataSystemService(); |
55 | 48 |
56 // Initializes the object. This function should be called before any | 49 // Initializes the object. This function should be called before any |
(...skipping 10 matching lines...) Expand all Loading... |
67 | 60 |
68 Profile* profile_; | 61 Profile* profile_; |
69 const base::SequencedWorkerPool::SequenceToken sequence_token_; | 62 const base::SequencedWorkerPool::SequenceToken sequence_token_; |
70 GDataCache* cache_; | 63 GDataCache* cache_; |
71 scoped_ptr<DocumentsServiceInterface> documents_service_; | 64 scoped_ptr<DocumentsServiceInterface> documents_service_; |
72 scoped_ptr<GDataUploader> uploader_; | 65 scoped_ptr<GDataUploader> uploader_; |
73 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; | 66 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; |
74 scoped_ptr<GDataFileSystemInterface> file_system_; | 67 scoped_ptr<GDataFileSystemInterface> file_system_; |
75 scoped_ptr<GDataDownloadObserver> download_observer_; | 68 scoped_ptr<GDataDownloadObserver> download_observer_; |
76 scoped_ptr<GDataSyncClient> sync_client_; | 69 scoped_ptr<GDataSyncClient> sync_client_; |
| 70 scoped_ptr<GDataContactsService> contacts_service_; |
77 | 71 |
78 DISALLOW_COPY_AND_ASSIGN(GDataSystemService); | 72 DISALLOW_COPY_AND_ASSIGN(GDataSystemService); |
79 }; | 73 }; |
80 | 74 |
81 // Singleton that owns all GDataSystemServices and associates them with | 75 // Singleton that owns all GDataSystemServices and associates them with |
82 // Profiles. | 76 // Profiles. |
83 class GDataSystemServiceFactory : public ProfileKeyedServiceFactory { | 77 class GDataSystemServiceFactory : public ProfileKeyedServiceFactory { |
84 public: | 78 public: |
85 // Returns the GDataSystemService for |profile|, creating it if it is not | 79 // Returns the GDataSystemService for |profile|, creating it if it is not |
86 // yet created. | 80 // yet created. |
(...skipping 26 matching lines...) Expand all Loading... |
113 virtual ~GDataSystemServiceFactory(); | 107 virtual ~GDataSystemServiceFactory(); |
114 | 108 |
115 // ProfileKeyedServiceFactory: | 109 // ProfileKeyedServiceFactory: |
116 virtual ProfileKeyedService* BuildServiceInstanceFor( | 110 virtual ProfileKeyedService* BuildServiceInstanceFor( |
117 Profile* profile) const OVERRIDE; | 111 Profile* profile) const OVERRIDE; |
118 }; | 112 }; |
119 | 113 |
120 } // namespace gdata | 114 } // namespace gdata |
121 | 115 |
122 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_ | 116 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_ |
OLD | NEW |