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_DRIVE_SYSTEM_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_SYSTEM_SERVICE_H_ |
6 #define CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_SYSTEM_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_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/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/threading/sequenced_worker_pool.h" | 13 #include "base/threading/sequenced_worker_pool.h" |
14 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" | 14 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" |
15 #include "chrome/browser/profiles/profile_keyed_service.h" | 15 #include "chrome/browser/profiles/profile_keyed_service.h" |
16 #include "chrome/browser/profiles/profile_keyed_service_factory.h" | 16 #include "chrome/browser/profiles/profile_keyed_service_factory.h" |
17 | 17 |
18 class FilePath; | 18 class FilePath; |
19 | 19 |
20 namespace gdata { | 20 namespace gdata { |
21 | 21 |
22 class DriveCache; | 22 class DriveCache; |
23 class DriveFileSystemInterface; | 23 class DriveFileSystemInterface; |
24 class DriveServiceInterface; | 24 class DriveServiceInterface; |
25 class DriveWebAppsRegistry; | 25 class DriveWebAppsRegistry; |
26 class FileWriteHelper; | 26 class FileWriteHelper; |
27 class GDataDownloadObserver; | 27 class GDataDownloadObserver; |
28 class GDataSyncClient; | 28 class GDataSyncClient; |
29 class GDataUploader; | 29 class GDataUploader; |
| 30 class StaleCacheFilesRemover; |
30 | 31 |
31 // DriveSystemService runs the Drive system, including the Drive file system | 32 // DriveSystemService runs the Drive system, including the Drive file system |
32 // implementation for the file manager, and some other sub systems. | 33 // implementation for the file manager, and some other sub systems. |
33 // | 34 // |
34 // The class is essentially a container that manages lifetime of the objects | 35 // The class is essentially a container that manages lifetime of the objects |
35 // that are used to run the Drive system. The DriveSystemService object is | 36 // that are used to run the Drive system. The DriveSystemService object is |
36 // created per-profile. | 37 // created per-profile. |
37 class DriveSystemService : public ProfileKeyedService { | 38 class DriveSystemService : public ProfileKeyedService { |
38 public: | 39 public: |
39 DriveServiceInterface* drive_service() { return drive_service_.get(); } | 40 DriveServiceInterface* drive_service() { return drive_service_.get(); } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 Profile* profile_; | 76 Profile* profile_; |
76 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 77 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
77 DriveCache* cache_; | 78 DriveCache* cache_; |
78 scoped_ptr<DriveServiceInterface> drive_service_; | 79 scoped_ptr<DriveServiceInterface> drive_service_; |
79 scoped_ptr<GDataUploader> uploader_; | 80 scoped_ptr<GDataUploader> uploader_; |
80 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; | 81 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; |
81 scoped_ptr<DriveFileSystemInterface> file_system_; | 82 scoped_ptr<DriveFileSystemInterface> file_system_; |
82 scoped_ptr<FileWriteHelper> file_write_helper_; | 83 scoped_ptr<FileWriteHelper> file_write_helper_; |
83 scoped_ptr<GDataDownloadObserver> download_observer_; | 84 scoped_ptr<GDataDownloadObserver> download_observer_; |
84 scoped_ptr<GDataSyncClient> sync_client_; | 85 scoped_ptr<GDataSyncClient> sync_client_; |
| 86 scoped_ptr<StaleCacheFilesRemover> stale_cache_files_remover_; |
85 base::WeakPtrFactory<DriveSystemService> weak_ptr_factory_; | 87 base::WeakPtrFactory<DriveSystemService> weak_ptr_factory_; |
86 | 88 |
87 DISALLOW_COPY_AND_ASSIGN(DriveSystemService); | 89 DISALLOW_COPY_AND_ASSIGN(DriveSystemService); |
88 }; | 90 }; |
89 | 91 |
90 // Singleton that owns all DriveSystemServices and associates them with | 92 // Singleton that owns all DriveSystemServices and associates them with |
91 // Profiles. | 93 // Profiles. |
92 class DriveSystemServiceFactory : public ProfileKeyedServiceFactory { | 94 class DriveSystemServiceFactory : public ProfileKeyedServiceFactory { |
93 public: | 95 public: |
94 // Returns the DriveSystemService for |profile|, creating it if it is not | 96 // Returns the DriveSystemService for |profile|, creating it if it is not |
(...skipping 26 matching lines...) Expand all Loading... |
121 virtual ~DriveSystemServiceFactory(); | 123 virtual ~DriveSystemServiceFactory(); |
122 | 124 |
123 // ProfileKeyedServiceFactory: | 125 // ProfileKeyedServiceFactory: |
124 virtual ProfileKeyedService* BuildServiceInstanceFor( | 126 virtual ProfileKeyedService* BuildServiceInstanceFor( |
125 Profile* profile) const OVERRIDE; | 127 Profile* profile) const OVERRIDE; |
126 }; | 128 }; |
127 | 129 |
128 } // namespace gdata | 130 } // namespace gdata |
129 | 131 |
130 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_SYSTEM_SERVICE_H_ | 132 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_SYSTEM_SERVICE_H_ |
OLD | NEW |