| 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 <memory> |
| 9 |
| 8 #include "base/callback.h" | 10 #include "base/callback.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/memory/singleton.h" | 12 #include "base/memory/singleton.h" |
| 12 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 13 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
| 14 #include "components/drive/drive_notification_observer.h" | 15 #include "components/drive/drive_notification_observer.h" |
| 15 #include "components/drive/file_errors.h" | 16 #include "components/drive/file_errors.h" |
| 16 #include "components/drive/file_system_core_util.h" | 17 #include "components/drive/file_system_core_util.h" |
| 17 #include "components/drive/job_scheduler.h" | 18 #include "components/drive/job_scheduler.h" |
| 18 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" | 19 #include "components/keyed_service/content/browser_context_keyed_service_factory
.h" |
| 19 #include "components/keyed_service/core/keyed_service.h" | 20 #include "components/keyed_service/core/keyed_service.h" |
| 20 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 163 |
| 163 friend class DriveIntegrationServiceFactory; | 164 friend class DriveIntegrationServiceFactory; |
| 164 | 165 |
| 165 Profile* profile_; | 166 Profile* profile_; |
| 166 State state_; | 167 State state_; |
| 167 bool enabled_; | 168 bool enabled_; |
| 168 // Custom mount point name that can be injected for testing in constructor. | 169 // Custom mount point name that can be injected for testing in constructor. |
| 169 std::string mount_point_name_; | 170 std::string mount_point_name_; |
| 170 | 171 |
| 171 base::FilePath cache_root_directory_; | 172 base::FilePath cache_root_directory_; |
| 172 scoped_ptr<EventLogger> logger_; | 173 std::unique_ptr<EventLogger> logger_; |
| 173 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 174 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 174 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; | 175 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
| 175 scoped_ptr<internal::ResourceMetadataStorage, | 176 std::unique_ptr<internal::ResourceMetadataStorage, util::DestroyHelper> |
| 176 util::DestroyHelper> metadata_storage_; | 177 metadata_storage_; |
| 177 scoped_ptr<internal::FileCache, util::DestroyHelper> cache_; | 178 std::unique_ptr<internal::FileCache, util::DestroyHelper> cache_; |
| 178 scoped_ptr<DriveServiceInterface> drive_service_; | 179 std::unique_ptr<DriveServiceInterface> drive_service_; |
| 179 scoped_ptr<JobScheduler> scheduler_; | 180 std::unique_ptr<JobScheduler> scheduler_; |
| 180 scoped_ptr<DriveAppRegistry> drive_app_registry_; | 181 std::unique_ptr<DriveAppRegistry> drive_app_registry_; |
| 181 scoped_ptr<internal::ResourceMetadata, | 182 std::unique_ptr<internal::ResourceMetadata, util::DestroyHelper> |
| 182 util::DestroyHelper> resource_metadata_; | 183 resource_metadata_; |
| 183 scoped_ptr<FileSystemInterface> file_system_; | 184 std::unique_ptr<FileSystemInterface> file_system_; |
| 184 scoped_ptr<DownloadHandler> download_handler_; | 185 std::unique_ptr<DownloadHandler> download_handler_; |
| 185 scoped_ptr<DebugInfoCollector> debug_info_collector_; | 186 std::unique_ptr<DebugInfoCollector> debug_info_collector_; |
| 186 | 187 |
| 187 base::ObserverList<DriveIntegrationServiceObserver> observers_; | 188 base::ObserverList<DriveIntegrationServiceObserver> observers_; |
| 188 scoped_ptr<PreferenceWatcher> preference_watcher_; | 189 std::unique_ptr<PreferenceWatcher> preference_watcher_; |
| 189 scoped_ptr<content::NotificationRegistrar> profile_notification_registrar_; | 190 std::unique_ptr<content::NotificationRegistrar> |
| 191 profile_notification_registrar_; |
| 190 | 192 |
| 191 // Note: This should remain the last member so it'll be destroyed and | 193 // Note: This should remain the last member so it'll be destroyed and |
| 192 // invalidate its weak pointers before any other members are destroyed. | 194 // invalidate its weak pointers before any other members are destroyed. |
| 193 base::WeakPtrFactory<DriveIntegrationService> weak_ptr_factory_; | 195 base::WeakPtrFactory<DriveIntegrationService> weak_ptr_factory_; |
| 194 DISALLOW_COPY_AND_ASSIGN(DriveIntegrationService); | 196 DISALLOW_COPY_AND_ASSIGN(DriveIntegrationService); |
| 195 }; | 197 }; |
| 196 | 198 |
| 197 // Singleton that owns all instances of DriveIntegrationService and | 199 // Singleton that owns all instances of DriveIntegrationService and |
| 198 // associates them with Profiles. | 200 // associates them with Profiles. |
| 199 class DriveIntegrationServiceFactory | 201 class DriveIntegrationServiceFactory |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 // allows factory creation to be delayed until it normally happens (on profile | 240 // allows factory creation to be delayed until it normally happens (on profile |
| 239 // creation) rather than when tests are set up. DriveIntegrationServiceFactory | 241 // creation) rather than when tests are set up. DriveIntegrationServiceFactory |
| 240 // transitively depends on ExtensionSystemFactory which crashes if created too | 242 // transitively depends on ExtensionSystemFactory which crashes if created too |
| 241 // soon (i.e. before the BrowserProcess exists). | 243 // soon (i.e. before the BrowserProcess exists). |
| 242 static FactoryCallback* factory_for_test_; | 244 static FactoryCallback* factory_for_test_; |
| 243 }; | 245 }; |
| 244 | 246 |
| 245 } // namespace drive | 247 } // namespace drive |
| 246 | 248 |
| 247 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_INTEGRATION_SERVICE_H_ | 249 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_INTEGRATION_SERVICE_H_ |
| OLD | NEW |