| 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 | 36 |
| 36 // Callback run as a response to SearchFromServer and LoadDirectoryFromServer. | 37 // Callback run as a response to SearchFromServer and LoadDirectoryFromServer. |
| 37 typedef base::Callback< | 38 typedef base::Callback< |
| 38 void(const ScopedVector<google_apis::DocumentFeed>& feed_list, | 39 void(const ScopedVector<google_apis::DocumentFeed>& feed_list, |
| 39 DriveFileError error)> LoadFeedListCallback; | 40 DriveFileError error)> LoadFeedListCallback; |
| 40 | 41 |
| 41 // DriveFeedLoader is used to load feeds from WAPI (codename for | 42 // DriveFeedLoader is used to load feeds from WAPI (codename for |
| 42 // Documents List API) and load the cached proto file. | 43 // Documents List API) and load the cached proto file. |
| 43 class DriveFeedLoader { | 44 class DriveFeedLoader { |
| 44 public: | 45 public: |
| 45 DriveFeedLoader( | 46 DriveFeedLoader( |
| 46 DriveResourceMetadata* resource_metadata, | 47 DriveResourceMetadata* resource_metadata, |
| 47 google_apis::DriveServiceInterface* drive_service, | 48 google_apis::DriveServiceInterface* drive_service, |
| 49 DriveScheduler* scheduler, |
| 48 DriveWebAppsRegistryInterface* webapps_registry, | 50 DriveWebAppsRegistryInterface* webapps_registry, |
| 49 DriveCache* cache, | 51 DriveCache* cache, |
| 50 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); | 52 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner); |
| 51 ~DriveFeedLoader(); | 53 ~DriveFeedLoader(); |
| 52 | 54 |
| 53 // Adds and removes the observer. | 55 // Adds and removes the observer. |
| 54 void AddObserver(DriveFeedLoaderObserver* observer); | 56 void AddObserver(DriveFeedLoaderObserver* observer); |
| 55 void RemoveObserver(DriveFeedLoaderObserver* observer); | 57 void RemoveObserver(DriveFeedLoaderObserver* observer); |
| 56 | 58 |
| 57 // Starts root feed load from the cache, and runs |callback| to tell the | 59 // Starts root feed load from the cache, and runs |callback| to tell the |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 169 |
| 168 // Callback for DriveFeedProcessor::ApplyFeeds. | 170 // Callback for DriveFeedProcessor::ApplyFeeds. |
| 169 void NotifyDirectoryChanged(bool should_notify, | 171 void NotifyDirectoryChanged(bool should_notify, |
| 170 const base::Closure& update_finished_callback); | 172 const base::Closure& update_finished_callback); |
| 171 | 173 |
| 172 // Callback for UpdateFromFeed. | 174 // Callback for UpdateFromFeed. |
| 173 void OnUpdateFromFeed(const FileOperationCallback& load_finished_callback); | 175 void OnUpdateFromFeed(const FileOperationCallback& load_finished_callback); |
| 174 | 176 |
| 175 DriveResourceMetadata* resource_metadata_; // Not owned. | 177 DriveResourceMetadata* resource_metadata_; // Not owned. |
| 176 google_apis::DriveServiceInterface* drive_service_; // Not owned. | 178 google_apis::DriveServiceInterface* drive_service_; // Not owned. |
| 179 DriveScheduler* scheduler_; // Not owned. |
| 177 DriveWebAppsRegistryInterface* webapps_registry_; // Not owned. | 180 DriveWebAppsRegistryInterface* webapps_registry_; // Not owned. |
| 178 DriveCache* cache_; // Not owned. | 181 DriveCache* cache_; // Not owned. |
| 179 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 182 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 180 ObserverList<DriveFeedLoaderObserver> observers_; | 183 ObserverList<DriveFeedLoaderObserver> observers_; |
| 181 scoped_ptr<DriveFeedProcessor> feed_processor_; | 184 scoped_ptr<DriveFeedProcessor> feed_processor_; |
| 182 | 185 |
| 183 // Indicates whether there is a feed refreshing server request is in flight. | 186 // Indicates whether there is a feed refreshing server request is in flight. |
| 184 bool refreshing_; | 187 bool refreshing_; |
| 185 | 188 |
| 186 // Note: This should remain the last member so it'll be destroyed and | 189 // Note: This should remain the last member so it'll be destroyed and |
| 187 // invalidate its weak pointers before any other members are destroyed. | 190 // invalidate its weak pointers before any other members are destroyed. |
| 188 base::WeakPtrFactory<DriveFeedLoader> weak_ptr_factory_; | 191 base::WeakPtrFactory<DriveFeedLoader> weak_ptr_factory_; |
| 189 DISALLOW_COPY_AND_ASSIGN(DriveFeedLoader); | 192 DISALLOW_COPY_AND_ASSIGN(DriveFeedLoader); |
| 190 }; | 193 }; |
| 191 | 194 |
| 192 } // namespace drive | 195 } // namespace drive |
| 193 | 196 |
| 194 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ | 197 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_DRIVE_FEED_LOADER_H_ |
| OLD | NEW |