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