| 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_FEED_LOADER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 namespace google_apis { | 24 namespace google_apis { |
| 25 class DocumentFeed; | 25 class DocumentFeed; |
| 26 class DriveServiceInterface; | 26 class DriveServiceInterface; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace drive { | 29 namespace drive { |
| 30 | 30 |
| 31 class DriveCache; | 31 class DriveCache; |
| 32 class DriveFeedLoaderObserver; | 32 class DriveFeedLoaderObserver; |
| 33 class DriveFeedProcessor; | 33 class DriveFeedProcessor; |
| 34 class DriveScheduler; |
| 34 class DriveWebAppsRegistryInterface; | 35 class DriveWebAppsRegistryInterface; |
| 35 struct GetDocumentsUiState; | 36 struct GetDocumentsUiState; |
| 36 struct LoadFeedParams; | 37 struct LoadFeedParams; |
| 37 | 38 |
| 38 // Callback run as a response to LoadFromServer. | 39 // Callback run as a response to LoadFromServer. |
| 39 typedef base::Callback<void(scoped_ptr<LoadFeedParams> params, | 40 typedef base::Callback<void(scoped_ptr<LoadFeedParams> params, |
| 40 DriveFileError error)> | 41 DriveFileError error)> |
| 41 LoadDocumentFeedCallback; | 42 LoadDocumentFeedCallback; |
| 42 | 43 |
| 43 // Set of parameters sent to LoadFromServer and LoadDocumentFeedCallback. | 44 // Set of parameters sent to LoadFromServer and LoadDocumentFeedCallback. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 const FileOperationCallback callback; | 97 const FileOperationCallback callback; |
| 97 }; | 98 }; |
| 98 | 99 |
| 99 // DriveFeedLoader is used to load feeds from WAPI (codename for | 100 // DriveFeedLoader is used to load feeds from WAPI (codename for |
| 100 // Documents List API) and load the cached proto file. | 101 // Documents List API) and load the cached proto file. |
| 101 class DriveFeedLoader { | 102 class DriveFeedLoader { |
| 102 public: | 103 public: |
| 103 DriveFeedLoader( | 104 DriveFeedLoader( |
| 104 DriveResourceMetadata* resource_metadata, | 105 DriveResourceMetadata* resource_metadata, |
| 105 google_apis::DriveServiceInterface* drive_service, | 106 google_apis::DriveServiceInterface* drive_service, |
| 107 DriveScheduler* scheduler, |
| 106 DriveWebAppsRegistryInterface* webapps_registry, | 108 DriveWebAppsRegistryInterface* webapps_registry, |
| 107 DriveCache* cache, | 109 DriveCache* cache, |
| 108 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_); | 110 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_); |
| 109 ~DriveFeedLoader(); | 111 ~DriveFeedLoader(); |
| 110 | 112 |
| 111 // Adds and removes the observer. | 113 // Adds and removes the observer. |
| 112 void AddObserver(DriveFeedLoaderObserver* observer); | 114 void AddObserver(DriveFeedLoaderObserver* observer); |
| 113 void RemoveObserver(DriveFeedLoaderObserver* observer); | 115 void RemoveObserver(DriveFeedLoaderObserver* observer); |
| 114 | 116 |
| 115 // Starts root feed load from the cache, and runs |callback| to tell the | 117 // Starts root feed load from the cache, and runs |callback| to tell the |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 // Callback for DriveFeedProcessor::ApplyFeeds. | 225 // Callback for DriveFeedProcessor::ApplyFeeds. |
| 224 void NotifyDirectoryChanged( | 226 void NotifyDirectoryChanged( |
| 225 bool should_notify, | 227 bool should_notify, |
| 226 const base::Closure& update_finished_callback); | 228 const base::Closure& update_finished_callback); |
| 227 | 229 |
| 228 // Callback for UpdateFromFeed. | 230 // Callback for UpdateFromFeed. |
| 229 void OnUpdateFromFeed(const FileOperationCallback& load_finished_callback); | 231 void OnUpdateFromFeed(const FileOperationCallback& load_finished_callback); |
| 230 | 232 |
| 231 DriveResourceMetadata* resource_metadata_; // Not owned. | 233 DriveResourceMetadata* resource_metadata_; // Not owned. |
| 232 google_apis::DriveServiceInterface* drive_service_; // Not owned. | 234 google_apis::DriveServiceInterface* drive_service_; // Not owned. |
| 235 DriveScheduler* scheduler_; // Not owned. |
| 233 DriveWebAppsRegistryInterface* webapps_registry_; // Not owned. | 236 DriveWebAppsRegistryInterface* webapps_registry_; // Not owned. |
| 234 DriveCache* cache_; // Not owned. | 237 DriveCache* cache_; // Not owned. |
| 235 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 238 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 236 ObserverList<DriveFeedLoaderObserver> observers_; | 239 ObserverList<DriveFeedLoaderObserver> observers_; |
| 237 scoped_ptr<DriveFeedProcessor> feed_processor_; | 240 scoped_ptr<DriveFeedProcessor> feed_processor_; |
| 238 | 241 |
| 239 // Indicates whether there is a feed refreshing server request is in flight. | 242 // Indicates whether there is a feed refreshing server request is in flight. |
| 240 bool refreshing_; | 243 bool refreshing_; |
| 241 | 244 |
| 242 // Note: This should remain the last member so it'll be destroyed and | 245 // Note: This should remain the last member so it'll be destroyed and |
| 243 // invalidate its weak pointers before any other members are destroyed. | 246 // invalidate its weak pointers before any other members are destroyed. |
| 244 base::WeakPtrFactory<DriveFeedLoader> weak_ptr_factory_; | 247 base::WeakPtrFactory<DriveFeedLoader> weak_ptr_factory_; |
| 245 DISALLOW_COPY_AND_ASSIGN(DriveFeedLoader); | 248 DISALLOW_COPY_AND_ASSIGN(DriveFeedLoader); |
| 246 }; | 249 }; |
| 247 | 250 |
| 248 } // namespace drive | 251 } // namespace drive |
| 249 | 252 |
| 250 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ | 253 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ |
| OLD | NEW |