| 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_DRIVE_DRIVE_INTEGRATION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_INTEGRATION_SERVICE_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_INTEGRATION_SERVICE_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_INTEGRATION_SERVICE_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 JobListInterface* job_list() { return scheduler_.get(); } | 103 JobListInterface* job_list() { return scheduler_.get(); } |
| 104 | 104 |
| 105 // Clears all the local cache file, the local resource metadata, and | 105 // Clears all the local cache file, the local resource metadata, and |
| 106 // in-memory Drive app registry, and remounts the file system. |callback| | 106 // in-memory Drive app registry, and remounts the file system. |callback| |
| 107 // is called with true when this operation is done successfully. Otherwise, | 107 // is called with true when this operation is done successfully. Otherwise, |
| 108 // |callback| is called with false. |callback| must not be null. | 108 // |callback| is called with false. |callback| must not be null. |
| 109 void ClearCacheAndRemountFileSystem( | 109 void ClearCacheAndRemountFileSystem( |
| 110 const base::Callback<void(bool)>& callback); | 110 const base::Callback<void(bool)>& callback); |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 enum State { |
| 114 NOT_INITIALIZED, |
| 115 INITIALIZING, |
| 116 INITIALIZED, |
| 117 REMOUNTING, |
| 118 }; |
| 119 |
| 113 // Returns true if Drive is enabled. | 120 // Returns true if Drive is enabled. |
| 114 // Must be called on UI thread. | 121 // Must be called on UI thread. |
| 115 bool IsDriveEnabled(); | 122 bool IsDriveEnabled(); |
| 116 | 123 |
| 117 // Registers remote file system for drive mount point. | 124 // Registers remote file system for drive mount point. |
| 118 void AddDriveMountPoint(); | 125 void AddDriveMountPoint(); |
| 119 // Unregisters drive mount point from File API. | 126 // Unregisters drive mount point from File API. |
| 120 void RemoveDriveMountPoint(); | 127 void RemoveDriveMountPoint(); |
| 121 | 128 |
| 122 // Adds back the drive mount point. | 129 // Adds back the drive mount point. |
| 123 // Used to implement ClearCacheAndRemountFileSystem(). | 130 // Used to implement ClearCacheAndRemountFileSystem(). |
| 124 void AddBackDriveMountPoint(const base::Callback<void(bool)>& callback, | 131 void AddBackDriveMountPoint(const base::Callback<void(bool)>& callback, |
| 125 bool success); | 132 bool success); |
| 126 | 133 |
| 127 // Called when metadata initialization is done. Continues initialization if | 134 // Called when metadata initialization is done. Continues initialization if |
| 128 // the metadata initialization is successful. | 135 // the metadata initialization is successful. |
| 129 void InitializeAfterMetadataInitialized(FileError error); | 136 void InitializeAfterMetadataInitialized(FileError error); |
| 130 | 137 |
| 131 friend class DriveIntegrationServiceFactory; | 138 friend class DriveIntegrationServiceFactory; |
| 132 | 139 |
| 133 Profile* profile_; | 140 Profile* profile_; |
| 134 bool is_initialized_; | 141 State state_; |
| 135 | 142 |
| 136 base::FilePath cache_root_directory_; | 143 base::FilePath cache_root_directory_; |
| 137 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 144 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 138 scoped_ptr<internal::ResourceMetadataStorage, | 145 scoped_ptr<internal::ResourceMetadataStorage, |
| 139 util::DestroyHelper> metadata_storage_; | 146 util::DestroyHelper> metadata_storage_; |
| 140 scoped_ptr<internal::FileCache, util::DestroyHelper> cache_; | 147 scoped_ptr<internal::FileCache, util::DestroyHelper> cache_; |
| 141 scoped_ptr<DriveServiceInterface> drive_service_; | 148 scoped_ptr<DriveServiceInterface> drive_service_; |
| 142 scoped_ptr<JobScheduler> scheduler_; | 149 scoped_ptr<JobScheduler> scheduler_; |
| 143 scoped_ptr<DriveAppRegistry> drive_app_registry_; | 150 scoped_ptr<DriveAppRegistry> drive_app_registry_; |
| 144 scoped_ptr<internal::ResourceMetadata, | 151 scoped_ptr<internal::ResourceMetadata, |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 // BrowserContextKeyedServiceFactory: | 212 // BrowserContextKeyedServiceFactory: |
| 206 virtual BrowserContextKeyedService* BuildServiceInstanceFor( | 213 virtual BrowserContextKeyedService* BuildServiceInstanceFor( |
| 207 content::BrowserContext* context) const OVERRIDE; | 214 content::BrowserContext* context) const OVERRIDE; |
| 208 | 215 |
| 209 FactoryCallback factory_for_test_; | 216 FactoryCallback factory_for_test_; |
| 210 }; | 217 }; |
| 211 | 218 |
| 212 } // namespace drive | 219 } // namespace drive |
| 213 | 220 |
| 214 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_INTEGRATION_SERVICE_H_ | 221 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_INTEGRATION_SERVICE_H_ |
| OLD | NEW |