| 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 GDataContactsService; |
| 24 class GDataDownloadObserver; | 24 class GDataDownloadObserver; |
| 25 class GDataFileSystemInterface; | 25 class GDataFileSystemInterface; |
| 26 class GDataFileWriteHelper; |
| 26 class GDataSyncClient; | 27 class GDataSyncClient; |
| 27 class GDataUploader; | 28 class GDataUploader; |
| 28 | 29 |
| 29 // GDataSystemService runs the GData system, including the GData file system | 30 // GDataSystemService runs the GData system, including the GData file system |
| 30 // implementation for the file manager, and some other sub systems. | 31 // implementation for the file manager, and some other sub systems. |
| 31 // | 32 // |
| 32 // The class is essentially a container that manages lifetime of the objects | 33 // The class is essentially a container that manages lifetime of the objects |
| 33 // that are used to run the GData system. The GDataSystemService object is | 34 // that are used to run the GData system. The GDataSystemService object is |
| 34 // created per-profile. | 35 // created per-profile. |
| 35 class GDataSystemService : public ProfileKeyedService { | 36 class GDataSystemService : public ProfileKeyedService { |
| 36 public: | 37 public: |
| 37 DocumentsServiceInterface* docs_service() { return documents_service_.get(); } | 38 DocumentsServiceInterface* docs_service() { return documents_service_.get(); } |
| 38 GDataCache* cache() { return cache_; } | 39 GDataCache* cache() { return cache_; } |
| 39 GDataFileSystemInterface* file_system() { return file_system_.get(); } | 40 GDataFileSystemInterface* file_system() { return file_system_.get(); } |
| 41 GDataFileWriteHelper* file_write_helper() { return file_write_helper_.get(); } |
| 40 GDataUploader* uploader() { return uploader_.get(); } | 42 GDataUploader* uploader() { return uploader_.get(); } |
| 41 GDataContactsService* contacts_service() { return contacts_service_.get(); } | 43 GDataContactsService* contacts_service() { return contacts_service_.get(); } |
| 42 DriveWebAppsRegistry* webapps_registry() { return webapps_registry_.get(); } | 44 DriveWebAppsRegistry* webapps_registry() { return webapps_registry_.get(); } |
| 43 | 45 |
| 44 // ProfileKeyedService override: | 46 // ProfileKeyedService override: |
| 45 virtual void Shutdown() OVERRIDE; | 47 virtual void Shutdown() OVERRIDE; |
| 46 | 48 |
| 47 private: | 49 private: |
| 48 explicit GDataSystemService(Profile* profile); | 50 explicit GDataSystemService(Profile* profile); |
| 49 virtual ~GDataSystemService(); | 51 virtual ~GDataSystemService(); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 60 | 62 |
| 61 friend class GDataSystemServiceFactory; | 63 friend class GDataSystemServiceFactory; |
| 62 | 64 |
| 63 Profile* profile_; | 65 Profile* profile_; |
| 64 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 66 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 65 GDataCache* cache_; | 67 GDataCache* cache_; |
| 66 scoped_ptr<DocumentsServiceInterface> documents_service_; | 68 scoped_ptr<DocumentsServiceInterface> documents_service_; |
| 67 scoped_ptr<GDataUploader> uploader_; | 69 scoped_ptr<GDataUploader> uploader_; |
| 68 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; | 70 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; |
| 69 scoped_ptr<GDataFileSystemInterface> file_system_; | 71 scoped_ptr<GDataFileSystemInterface> file_system_; |
| 72 scoped_ptr<GDataFileWriteHelper> file_write_helper_; |
| 70 scoped_ptr<GDataDownloadObserver> download_observer_; | 73 scoped_ptr<GDataDownloadObserver> download_observer_; |
| 71 scoped_ptr<GDataSyncClient> sync_client_; | 74 scoped_ptr<GDataSyncClient> sync_client_; |
| 72 scoped_ptr<GDataContactsService> contacts_service_; | 75 scoped_ptr<GDataContactsService> contacts_service_; |
| 73 | 76 |
| 74 DISALLOW_COPY_AND_ASSIGN(GDataSystemService); | 77 DISALLOW_COPY_AND_ASSIGN(GDataSystemService); |
| 75 }; | 78 }; |
| 76 | 79 |
| 77 // Singleton that owns all GDataSystemServices and associates them with | 80 // Singleton that owns all GDataSystemServices and associates them with |
| 78 // Profiles. | 81 // Profiles. |
| 79 class GDataSystemServiceFactory : public ProfileKeyedServiceFactory { | 82 class GDataSystemServiceFactory : public ProfileKeyedServiceFactory { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 109 virtual ~GDataSystemServiceFactory(); | 112 virtual ~GDataSystemServiceFactory(); |
| 110 | 113 |
| 111 // ProfileKeyedServiceFactory: | 114 // ProfileKeyedServiceFactory: |
| 112 virtual ProfileKeyedService* BuildServiceInstanceFor( | 115 virtual ProfileKeyedService* BuildServiceInstanceFor( |
| 113 Profile* profile) const OVERRIDE; | 116 Profile* profile) const OVERRIDE; |
| 114 }; | 117 }; |
| 115 | 118 |
| 116 } // namespace gdata | 119 } // namespace gdata |
| 117 | 120 |
| 118 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_ | 121 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_SYSTEM_SERVICE_H_ |
| OLD | NEW |