| 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 <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // See the comment at Load() for |directory_fetch_info| parameter. | 107 // See the comment at Load() for |directory_fetch_info| parameter. |
| 108 // |callback| must not be null. | 108 // |callback| must not be null. |
| 109 // TODO(satorux): make this private. crbug.com/193417 | 109 // TODO(satorux): make this private. crbug.com/193417 |
| 110 void LoadFromServerIfNeeded(const DirectoryFetchInfo& directory_fetch_info, | 110 void LoadFromServerIfNeeded(const DirectoryFetchInfo& directory_fetch_info, |
| 111 const FileOperationCallback& callback); | 111 const FileOperationCallback& callback); |
| 112 | 112 |
| 113 // Updates whole directory structure feeds collected in |feed_list|. | 113 // Updates whole directory structure feeds collected in |feed_list|. |
| 114 // Record file statistics as UMA histograms. | 114 // Record file statistics as UMA histograms. |
| 115 // | 115 // |
| 116 // See comments at ChangeListProcessor::ApplyFeeds() for | 116 // See comments at ChangeListProcessor::ApplyFeeds() for |
| 117 // |is_delta_feed| and |root_feed_changestamp|. | 117 // |about_resource| and |is_delta_feed|. |
| 118 // |update_finished_callback| must not be null. | 118 // |update_finished_callback| must not be null. |
| 119 void UpdateFromFeed(const ScopedVector<google_apis::ResourceList>& feed_list, | 119 void UpdateFromFeed( |
| 120 bool is_delta_feed, | 120 scoped_ptr<google_apis::AboutResource> about_resource, |
| 121 int64 root_feed_changestamp, | 121 const ScopedVector<google_apis::ResourceList>& feed_list, |
| 122 const base::Closure& update_finished_callback); | 122 bool is_delta_feed, |
| 123 const base::Closure& update_finished_callback); |
| 123 | 124 |
| 124 // Schedules |callback| to run when it's ready (i.e. the change list | 125 // Schedules |callback| to run when it's ready (i.e. the change list |
| 125 // loading is complete or the directory specified by |directory_fetch_info| | 126 // loading is complete or the directory specified by |directory_fetch_info| |
| 126 // is loaded). |directory_fetch_info| can be empty if the callback is not | 127 // is loaded). |directory_fetch_info| can be empty if the callback is not |
| 127 // interested in a particular directory. | 128 // interested in a particular directory. |
| 128 // |callback| must not be null. | 129 // |callback| must not be null. |
| 129 void ScheduleRun(const DirectoryFetchInfo& directory_fetch_info, | 130 void ScheduleRun(const DirectoryFetchInfo& directory_fetch_info, |
| 130 const FileOperationCallback& callback); | 131 const FileOperationCallback& callback); |
| 131 | 132 |
| 132 // Indicates whether there is a feed refreshing server request is in flight. | 133 // Indicates whether there is a feed refreshing server request is in flight. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 // Part of LoadFromServerIfNeeded() Callled when | 195 // Part of LoadFromServerIfNeeded() Callled when |
| 195 // DriveScheduler::GetAboutResource() is complete. This method calls | 196 // DriveScheduler::GetAboutResource() is complete. This method calls |
| 196 // CompareChangestampsAndLoadIfNeeded() to make a decision about whether or | 197 // CompareChangestampsAndLoadIfNeeded() to make a decision about whether or |
| 197 // not to fetch the change list. | 198 // not to fetch the change list. |
| 198 void LoadFromServerIfNeededAfterGetAbout( | 199 void LoadFromServerIfNeededAfterGetAbout( |
| 199 const DirectoryFetchInfo& directory_fetch_info, | 200 const DirectoryFetchInfo& directory_fetch_info, |
| 200 const FileOperationCallback& callback, | 201 const FileOperationCallback& callback, |
| 201 google_apis::GDataErrorCode status, | 202 google_apis::GDataErrorCode status, |
| 202 scoped_ptr<google_apis::AboutResource> about_resource); | 203 scoped_ptr<google_apis::AboutResource> about_resource); |
| 203 | 204 |
| 204 // Compares |remote_changestamp| and |local_changestamp| and triggers | 205 // Compares the largetst_change_id in |about_resource| and |local_changestamp| |
| 205 // LoadFromServer if necessary. | 206 // and triggers LoadFromServer if necessary. |
| 206 void CompareChangestampsAndLoadIfNeeded( | 207 void CompareChangestampsAndLoadIfNeeded( |
| 207 const DirectoryFetchInfo& directory_fetch_info, | 208 const DirectoryFetchInfo& directory_fetch_info, |
| 208 const FileOperationCallback& callback, | 209 const FileOperationCallback& callback, |
| 209 int64 remote_changestamp, | 210 scoped_ptr<google_apis::AboutResource> about_resource, |
| 210 int64 local_changestamp); | 211 int64 local_changestamp); |
| 211 | 212 |
| 212 // Starts loading the change list since |start_changestamp|, or the full | 213 // Starts loading the change list since |start_changestamp|, or the full |
| 213 // resource list if |start_changestamp| is zero. |remote_changestamp| will | 214 // resource list if |start_changestamp| is zero. For full update, the |
| 214 // be stored in DriveResourceMetadata, once loading is done. | 215 // largest_change_id and root_folder_id from |about_resource| will be used. |
| 215 // callback must not be null. | 216 // |callback| must not be null. |
| 216 void LoadChangeListFromServer( | 217 void LoadChangeListFromServer( |
| 218 scoped_ptr<google_apis::AboutResource> about_resource, |
| 217 int64 start_changestamp, | 219 int64 start_changestamp, |
| 218 int64 remote_changestamp, | |
| 219 const FileOperationCallback& callback); | 220 const FileOperationCallback& callback); |
| 220 | 221 |
| 221 // Callback for handling response from |DriveAPIService::GetAppList|. | 222 // Callback for handling response from |DriveAPIService::GetAppList|. |
| 222 // If the application list is successfully parsed, passes the list to | 223 // If the application list is successfully parsed, passes the list to |
| 223 // Drive webapps registry. | 224 // Drive webapps registry. |
| 224 void OnGetAppList(google_apis::GDataErrorCode status, | 225 void OnGetAppList(google_apis::GDataErrorCode status, |
| 225 scoped_ptr<google_apis::AppList> app_list); | 226 scoped_ptr<google_apis::AppList> app_list); |
| 226 | 227 |
| 227 // Callback for handling feed content fetching while searching for file info. | 228 // Callback for handling feed content fetching while searching for file info. |
| 228 // This callback is invoked after async feed fetch operation that was | 229 // This callback is invoked after async feed fetch operation that was |
| 229 // invoked by StartDirectoryRefresh() completes. This callback will update | 230 // invoked by StartDirectoryRefresh() completes. This callback will update |
| 230 // the content of the refreshed directory object and continue initially | 231 // the content of the refreshed directory object and continue initially |
| 231 // started FindEntryByPath() request. | 232 // started FindEntryByPath() request. |
| 232 void UpdateMetadataFromFeedAfterLoadFromServer( | 233 void UpdateMetadataFromFeedAfterLoadFromServer( |
| 234 scoped_ptr<google_apis::AboutResource> about_resource, |
| 233 bool is_delta_feed, | 235 bool is_delta_feed, |
| 234 int64 feed_changestamp, | |
| 235 const FileOperationCallback& callback, | 236 const FileOperationCallback& callback, |
| 236 const ScopedVector<google_apis::ResourceList>& feed_list, | 237 const ScopedVector<google_apis::ResourceList>& feed_list, |
| 237 DriveFileError error); | 238 DriveFileError error); |
| 238 | 239 |
| 239 // Save filesystem to disk. | 240 // Save filesystem to disk. |
| 240 void SaveFileSystem(); | 241 void SaveFileSystem(); |
| 241 | 242 |
| 242 // Callback for handling UI updates caused by feed fetching. | 243 // Callback for handling UI updates caused by feed fetching. |
| 243 void OnNotifyResourceListFetched( | 244 void OnNotifyResourceListFetched( |
| 244 base::WeakPtr<GetResourceListUiState> ui_state); | 245 base::WeakPtr<GetResourceListUiState> ui_state); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 275 | 276 |
| 276 // Note: This should remain the last member so it'll be destroyed and | 277 // Note: This should remain the last member so it'll be destroyed and |
| 277 // invalidate its weak pointers before any other members are destroyed. | 278 // invalidate its weak pointers before any other members are destroyed. |
| 278 base::WeakPtrFactory<ChangeListLoader> weak_ptr_factory_; | 279 base::WeakPtrFactory<ChangeListLoader> weak_ptr_factory_; |
| 279 DISALLOW_COPY_AND_ASSIGN(ChangeListLoader); | 280 DISALLOW_COPY_AND_ASSIGN(ChangeListLoader); |
| 280 }; | 281 }; |
| 281 | 282 |
| 282 } // namespace drive | 283 } // namespace drive |
| 283 | 284 |
| 284 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ | 285 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ |
| OLD | NEW |