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_CHANGE_LIST_LOADER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 10 matching lines...) Expand all Loading... |
21 class AboutResource; | 21 class AboutResource; |
22 class AppList; | 22 class AppList; |
23 class ResourceList; | 23 class ResourceList; |
24 } | 24 } |
25 | 25 |
26 namespace drive { | 26 namespace drive { |
27 | 27 |
28 class ChangeList; | 28 class ChangeList; |
29 class ChangeListLoaderObserver; | 29 class ChangeListLoaderObserver; |
30 class ChangeListProcessor; | 30 class ChangeListProcessor; |
31 class DriveScheduler; | |
32 class DriveWebAppsRegistry; | 31 class DriveWebAppsRegistry; |
| 32 class JobScheduler; |
33 | 33 |
34 // Callback run as a response to SearchFromServer. | 34 // Callback run as a response to SearchFromServer. |
35 typedef base::Callback<void(ScopedVector<ChangeList> change_lists, | 35 typedef base::Callback<void(ScopedVector<ChangeList> change_lists, |
36 FileError error)> LoadFeedListCallback; | 36 FileError error)> LoadFeedListCallback; |
37 | 37 |
38 // ChangeListLoader is used to load feeds from WAPI (codename for | 38 // ChangeListLoader is used to load feeds from WAPI (codename for |
39 // Documents List API) or Google Drive API and load the cached metadata. | 39 // Documents List API) or Google Drive API and load the cached metadata. |
40 class ChangeListLoader { | 40 class ChangeListLoader { |
41 public: | 41 public: |
42 ChangeListLoader(DriveResourceMetadata* resource_metadata, | 42 ChangeListLoader(DriveResourceMetadata* resource_metadata, |
43 DriveScheduler* scheduler, | 43 JobScheduler* scheduler, |
44 DriveWebAppsRegistry* webapps_registry); | 44 DriveWebAppsRegistry* webapps_registry); |
45 ~ChangeListLoader(); | 45 ~ChangeListLoader(); |
46 | 46 |
47 // Indicates whether there is a feed refreshing server request is in flight. | 47 // Indicates whether there is a feed refreshing server request is in flight. |
48 bool IsRefreshing() const; | 48 bool IsRefreshing() const; |
49 | 49 |
50 // Adds and removes the observer. | 50 // Adds and removes the observer. |
51 void AddObserver(ChangeListLoaderObserver* observer); | 51 void AddObserver(ChangeListLoaderObserver* observer); |
52 void RemoveObserver(ChangeListLoaderObserver* observer); | 52 void RemoveObserver(ChangeListLoaderObserver* observer); |
53 | 53 |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 const LoadFeedListCallback& callback, | 260 const LoadFeedListCallback& callback, |
261 google_apis::GDataErrorCode status, | 261 google_apis::GDataErrorCode status, |
262 scoped_ptr<google_apis::ResourceList> resource_list); | 262 scoped_ptr<google_apis::ResourceList> resource_list); |
263 | 263 |
264 // Part of UpdateFromFeed(). | 264 // Part of UpdateFromFeed(). |
265 // Callback for ChangeListProcessor::ApplyFeeds. | 265 // Callback for ChangeListProcessor::ApplyFeeds. |
266 void NotifyDirectoryChangedAfterApplyFeed(bool should_notify, | 266 void NotifyDirectoryChangedAfterApplyFeed(bool should_notify, |
267 const base::Closure& callback); | 267 const base::Closure& callback); |
268 | 268 |
269 DriveResourceMetadata* resource_metadata_; // Not owned. | 269 DriveResourceMetadata* resource_metadata_; // Not owned. |
270 DriveScheduler* scheduler_; // Not owned. | 270 JobScheduler* scheduler_; // Not owned. |
271 DriveWebAppsRegistry* webapps_registry_; // Not owned. | 271 DriveWebAppsRegistry* webapps_registry_; // Not owned. |
272 ObserverList<ChangeListLoaderObserver> observers_; | 272 ObserverList<ChangeListLoaderObserver> observers_; |
273 scoped_ptr<ChangeListProcessor> change_list_processor_; | 273 scoped_ptr<ChangeListProcessor> change_list_processor_; |
274 typedef std::map<std::string, std::vector<FileOperationCallback> > | 274 typedef std::map<std::string, std::vector<FileOperationCallback> > |
275 LoadCallbackMap; | 275 LoadCallbackMap; |
276 LoadCallbackMap pending_load_callback_; | 276 LoadCallbackMap pending_load_callback_; |
277 | 277 |
278 // Indicates whether there is a feed refreshing server request is in flight. | 278 // Indicates whether there is a feed refreshing server request is in flight. |
279 int64 last_known_remote_changestamp_; | 279 int64 last_known_remote_changestamp_; |
280 | 280 |
281 // True if the file system feed is loaded from the cache or from the server. | 281 // True if the file system feed is loaded from the cache or from the server. |
282 bool loaded_; | 282 bool loaded_; |
283 | 283 |
284 // Note: This should remain the last member so it'll be destroyed and | 284 // Note: This should remain the last member so it'll be destroyed and |
285 // invalidate its weak pointers before any other members are destroyed. | 285 // invalidate its weak pointers before any other members are destroyed. |
286 base::WeakPtrFactory<ChangeListLoader> weak_ptr_factory_; | 286 base::WeakPtrFactory<ChangeListLoader> weak_ptr_factory_; |
287 DISALLOW_COPY_AND_ASSIGN(ChangeListLoader); | 287 DISALLOW_COPY_AND_ASSIGN(ChangeListLoader); |
288 }; | 288 }; |
289 | 289 |
290 } // namespace drive | 290 } // namespace drive |
291 | 291 |
292 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ | 292 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ |
OLD | NEW |