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" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
45 DriveWebAppsRegistry* webapps_registry() { return webapps_registry_.get(); } | 45 DriveWebAppsRegistry* webapps_registry() { return webapps_registry_.get(); } |
46 | 46 |
47 // Clears all the local cache files and in-memory data, and remounts the file | 47 // Clears all the local cache files and in-memory data, and remounts the file |
48 // system. | 48 // system. |
49 void ClearCacheAndRemountFileSystem( | 49 void ClearCacheAndRemountFileSystem( |
50 const base::Callback<void(bool)>& callback); | 50 const base::Callback<void(bool)>& callback); |
51 | 51 |
52 // ProfileKeyedService override: | 52 // ProfileKeyedService override: |
53 virtual void Shutdown() OVERRIDE; | 53 virtual void Shutdown() OVERRIDE; |
54 | 54 |
55 // Returns true if Drive is enabled for the specified profile. | |
56 // Must be called on UI thread. | |
57 static bool IsDriveEnabled(Profile* profile); | |
58 | |
55 private: | 59 private: |
56 explicit DriveSystemService(Profile* profile); | 60 explicit DriveSystemService(Profile* profile); |
57 virtual ~DriveSystemService(); | 61 virtual ~DriveSystemService(); |
58 | 62 |
59 // Initializes the object. This function should be called before any | 63 // Initializes the object. This function should be called before any |
60 // other functions. | 64 // other functions. |
61 void Initialize(DriveServiceInterface* drive_service, | 65 void Initialize(DriveServiceInterface* drive_service, |
62 const FilePath& cache_root); | 66 const FilePath& cache_root); |
63 | 67 |
64 // Registers remote file system proxy for drive mount point. | 68 // Registers remote file system proxy for drive mount point. |
65 void AddDriveMountPoint(); | 69 void AddDriveMountPoint(); |
66 // Unregisters drive mount point from File API. | 70 // Unregisters drive mount point from File API. |
67 void RemoveDriveMountPoint(); | 71 void RemoveDriveMountPoint(); |
68 | 72 |
69 // Adds back the drive mount point. Used to implement ClearCache(). | 73 // Adds back the drive mount point. Used to implement ClearCache(). |
70 void AddBackDriveMountPoint(const base::Callback<void(bool)>& callback, | 74 void AddBackDriveMountPoint(const base::Callback<void(bool)>& callback, |
71 DriveFileError error, | 75 DriveFileError error, |
72 const FilePath& file_path); | 76 const FilePath& file_path); |
73 | 77 |
74 // Called when cache initialization is done. Continues initialization if | 78 // Called when cache initialization is done. Continues initialization if |
75 // the cache initialization is successful. | 79 // the cache initialization is successful. |
76 void OnCacheInitialized(bool success); | 80 void OnCacheInitialized(bool success); |
77 | 81 |
82 // Disables Drive for the specified profile. Used to disable Drive when | |
83 // needed (ex. initialization of the Drive cache failed). | |
84 // Must be called on UI thread. | |
85 static void DisableDrive(Profile* profile); | |
hashimoto
2012/10/11 04:09:15
Can't this method be a free function in the namele
satorux1
2012/10/11 04:25:31
Good point. Done!
| |
86 | |
78 friend class DriveSystemServiceFactory; | 87 friend class DriveSystemServiceFactory; |
79 | 88 |
80 Profile* profile_; | 89 Profile* profile_; |
81 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 90 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
82 DriveCache* cache_; | 91 DriveCache* cache_; |
83 scoped_ptr<DriveServiceInterface> drive_service_; | 92 scoped_ptr<DriveServiceInterface> drive_service_; |
84 scoped_ptr<DriveUploader> uploader_; | 93 scoped_ptr<DriveUploader> uploader_; |
85 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; | 94 scoped_ptr<DriveWebAppsRegistry> webapps_registry_; |
86 scoped_ptr<DriveFileSystemInterface> file_system_; | 95 scoped_ptr<DriveFileSystemInterface> file_system_; |
87 scoped_ptr<FileWriteHelper> file_write_helper_; | 96 scoped_ptr<FileWriteHelper> file_write_helper_; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 virtual ~DriveSystemServiceFactory(); | 136 virtual ~DriveSystemServiceFactory(); |
128 | 137 |
129 // ProfileKeyedServiceFactory: | 138 // ProfileKeyedServiceFactory: |
130 virtual ProfileKeyedService* BuildServiceInstanceFor( | 139 virtual ProfileKeyedService* BuildServiceInstanceFor( |
131 Profile* profile) const OVERRIDE; | 140 Profile* profile) const OVERRIDE; |
132 }; | 141 }; |
133 | 142 |
134 } // namespace gdata | 143 } // namespace gdata |
135 | 144 |
136 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_SYSTEM_SERVICE_H_ | 145 #endif // CHROME_BROWSER_CHROMEOS_GDATA_DRIVE_SYSTEM_SERVICE_H_ |
OLD | NEW |