| 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_GDATA_WAPI_FEED_LOADER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_FEED_LOADER_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_FEED_LOADER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_FEED_LOADER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "chrome/browser/chromeos/gdata/gdata_directory_service.h" | 14 #include "chrome/browser/chromeos/gdata/drive_resource_metadata.h" |
| 15 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" | 15 #include "chrome/browser/chromeos/gdata/gdata_errorcode.h" |
| 16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
| 17 | 17 |
| 18 namespace base { | 18 namespace base { |
| 19 class Value; | 19 class Value; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace gdata { | 22 namespace gdata { |
| 23 | 23 |
| 24 class DriveWebAppsRegistryInterface; | |
| 25 class DocumentFeed; | 24 class DocumentFeed; |
| 26 class DriveServiceInterface; | 25 class DriveServiceInterface; |
| 26 class DriveWebAppsRegistryInterface; |
| 27 class GDataCache; | 27 class GDataCache; |
| 28 struct GetDocumentsUiState; | 28 struct GetDocumentsUiState; |
| 29 | 29 |
| 30 // Set of parameters sent to LoadDocumentFeedCallback callback. | 30 // Set of parameters sent to LoadDocumentFeedCallback callback. |
| 31 struct GetDocumentsParams { | 31 struct GetDocumentsParams { |
| 32 GetDocumentsParams(int64 start_changestamp, | 32 GetDocumentsParams(int64 start_changestamp, |
| 33 int64 root_feed_changestamp, | 33 int64 root_feed_changestamp, |
| 34 std::vector<DocumentFeed*>* feed_list, | 34 std::vector<DocumentFeed*>* feed_list, |
| 35 const std::string& search_query, | 35 const std::string& search_query, |
| 36 const std::string& directory_resource_id, | 36 const std::string& directory_resource_id, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 virtual void OnDocumentFeedFetched(int num_accumulated_entries) {} | 90 virtual void OnDocumentFeedFetched(int num_accumulated_entries) {} |
| 91 | 91 |
| 92 // Triggered when the feed from the server is loaded. | 92 // Triggered when the feed from the server is loaded. |
| 93 virtual void OnFeedFromServerLoaded() {} | 93 virtual void OnFeedFromServerLoaded() {} |
| 94 | 94 |
| 95 protected: | 95 protected: |
| 96 virtual ~Observer() {} | 96 virtual ~Observer() {} |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 GDataWapiFeedLoader( | 99 GDataWapiFeedLoader( |
| 100 GDataDirectoryService* directory_service, | 100 DriveResourceMetadata* resource_metadata, |
| 101 DriveServiceInterface* drive_service, | 101 DriveServiceInterface* drive_service, |
| 102 DriveWebAppsRegistryInterface* webapps_registry, | 102 DriveWebAppsRegistryInterface* webapps_registry, |
| 103 GDataCache* cache, | 103 GDataCache* cache, |
| 104 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_); | 104 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_); |
| 105 ~GDataWapiFeedLoader(); | 105 ~GDataWapiFeedLoader(); |
| 106 | 106 |
| 107 // Adds and removes the observer. | 107 // Adds and removes the observer. |
| 108 void AddObserver(Observer* observer); | 108 void AddObserver(Observer* observer); |
| 109 void RemoveObserver(Observer* observer); | 109 void RemoveObserver(Observer* observer); |
| 110 | 110 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 GDataErrorCode status, | 227 GDataErrorCode status, |
| 228 scoped_ptr<base::Value> data); | 228 scoped_ptr<base::Value> data); |
| 229 | 229 |
| 230 // Save filesystem to disk. | 230 // Save filesystem to disk. |
| 231 void SaveFileSystem(); | 231 void SaveFileSystem(); |
| 232 | 232 |
| 233 // Callback for handling UI updates caused by document fetching. | 233 // Callback for handling UI updates caused by document fetching. |
| 234 void OnNotifyDocumentFeedFetched( | 234 void OnNotifyDocumentFeedFetched( |
| 235 base::WeakPtr<GetDocumentsUiState> ui_state); | 235 base::WeakPtr<GetDocumentsUiState> ui_state); |
| 236 | 236 |
| 237 GDataDirectoryService* directory_service_; // Not owned. | 237 DriveResourceMetadata* resource_metadata_; // Not owned. |
| 238 DriveServiceInterface* drive_service_; // Not owned. | 238 DriveServiceInterface* drive_service_; // Not owned. |
| 239 DriveWebAppsRegistryInterface* webapps_registry_; // Not owned. | 239 DriveWebAppsRegistryInterface* webapps_registry_; // Not owned. |
| 240 GDataCache* cache_; // Not owned. | 240 GDataCache* cache_; // Not owned. |
| 241 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; | 241 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; |
| 242 ObserverList<Observer> observers_; | 242 ObserverList<Observer> observers_; |
| 243 | 243 |
| 244 // Note: This should remain the last member so it'll be destroyed and | 244 // Note: This should remain the last member so it'll be destroyed and |
| 245 // invalidate its weak pointers before any other members are destroyed. | 245 // invalidate its weak pointers before any other members are destroyed. |
| 246 base::WeakPtrFactory<GDataWapiFeedLoader> weak_ptr_factory_; | 246 base::WeakPtrFactory<GDataWapiFeedLoader> weak_ptr_factory_; |
| 247 DISALLOW_COPY_AND_ASSIGN(GDataWapiFeedLoader); | 247 DISALLOW_COPY_AND_ASSIGN(GDataWapiFeedLoader); |
| 248 }; | 248 }; |
| 249 | 249 |
| 250 } // namespace gdata | 250 } // namespace gdata |
| 251 | 251 |
| 252 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_FEED_LOADER_H_ | 252 #endif // CHROME_BROWSER_CHROMEOS_GDATA_GDATA_WAPI_FEED_LOADER_H_ |
| OLD | NEW |