Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(128)

Side by Side Diff: chrome/browser/chromeos/drive/change_list_loader.h

Issue 12588009: drive: Pass through AboutResouce from server among callbacks in ChangeListLoader. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unittest, remove garbage. Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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|
206 // and triggers
205 // LoadFromServer if necessary. 207 // LoadFromServer if necessary.
206 void CompareChangestampsAndLoadIfNeeded( 208 void CompareChangestampsAndLoadIfNeeded(
207 const DirectoryFetchInfo& directory_fetch_info, 209 const DirectoryFetchInfo& directory_fetch_info,
208 const FileOperationCallback& callback, 210 const FileOperationCallback& callback,
209 int64 remote_changestamp, 211 scoped_ptr<google_apis::AboutResource> about_resource,
210 int64 local_changestamp); 212 int64 local_changestamp);
211 213
212 // Starts loading the change list since |start_changestamp|, or the full 214 // Starts loading the change list since |start_changestamp|, or the full
213 // resource list if |start_changestamp| is zero. |remote_changestamp| will 215 // resource list if |start_changestamp| is zero. For full update, the
214 // be stored in DriveResourceMetadata, once loading is done. 216 // largest_change_id and root_folder_id from |about_resource| will be used.
215 // callback must not be null. 217 // |callback| must not be null.
216 void LoadChangeListFromServer( 218 void LoadChangeListFromServer(
219 scoped_ptr<google_apis::AboutResource> about_resource,
217 int64 start_changestamp, 220 int64 start_changestamp,
218 int64 remote_changestamp,
219 const FileOperationCallback& callback); 221 const FileOperationCallback& callback);
220 222
221 // Callback for handling response from |DriveAPIService::GetAppList|. 223 // Callback for handling response from |DriveAPIService::GetAppList|.
222 // If the application list is successfully parsed, passes the list to 224 // If the application list is successfully parsed, passes the list to
223 // Drive webapps registry. 225 // Drive webapps registry.
224 void OnGetAppList(google_apis::GDataErrorCode status, 226 void OnGetAppList(google_apis::GDataErrorCode status,
225 scoped_ptr<google_apis::AppList> app_list); 227 scoped_ptr<google_apis::AppList> app_list);
226 228
227 // Callback for handling feed content fetching while searching for file info. 229 // Callback for handling feed content fetching while searching for file info.
228 // This callback is invoked after async feed fetch operation that was 230 // This callback is invoked after async feed fetch operation that was
229 // invoked by StartDirectoryRefresh() completes. This callback will update 231 // invoked by StartDirectoryRefresh() completes. This callback will update
230 // the content of the refreshed directory object and continue initially 232 // the content of the refreshed directory object and continue initially
231 // started FindEntryByPath() request. 233 // started FindEntryByPath() request.
232 void UpdateMetadataFromFeedAfterLoadFromServer( 234 void UpdateMetadataFromFeedAfterLoadFromServer(
235 scoped_ptr<google_apis::AboutResource> about_resource,
233 bool is_delta_feed, 236 bool is_delta_feed,
234 int64 feed_changestamp,
235 const FileOperationCallback& callback, 237 const FileOperationCallback& callback,
236 const ScopedVector<google_apis::ResourceList>& feed_list, 238 const ScopedVector<google_apis::ResourceList>& feed_list,
237 DriveFileError error); 239 DriveFileError error);
238 240
239 // Save filesystem to disk. 241 // Save filesystem to disk.
240 void SaveFileSystem(); 242 void SaveFileSystem();
241 243
242 // Callback for handling UI updates caused by feed fetching. 244 // Callback for handling UI updates caused by feed fetching.
243 void OnNotifyResourceListFetched( 245 void OnNotifyResourceListFetched(
244 base::WeakPtr<GetResourceListUiState> ui_state); 246 base::WeakPtr<GetResourceListUiState> ui_state);
(...skipping 21 matching lines...) Expand all
266 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_; 268 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner_;
267 ObserverList<ChangeListLoaderObserver> observers_; 269 ObserverList<ChangeListLoaderObserver> observers_;
268 scoped_ptr<ChangeListProcessor> change_list_processor_; 270 scoped_ptr<ChangeListProcessor> change_list_processor_;
269 typedef std::pair<DirectoryFetchInfo, 271 typedef std::pair<DirectoryFetchInfo,
270 FileOperationCallback> QueuedCallbackInfo; 272 FileOperationCallback> QueuedCallbackInfo;
271 std::queue<QueuedCallbackInfo> queue_; 273 std::queue<QueuedCallbackInfo> queue_;
272 274
273 // Indicates whether there is a feed refreshing server request is in flight. 275 // Indicates whether there is a feed refreshing server request is in flight.
274 bool refreshing_; 276 bool refreshing_;
275 277
278 // Resource ID for the user's "My Drive" root. This must be retrieved from
hidehiko 2013/03/18 06:22:27 Don't need?
Haruki Sato 2013/03/18 07:06:41 Done. Thanks.
279 // the server.
280 // std::string drive_root_resource_id_;
281
276 // Note: This should remain the last member so it'll be destroyed and 282 // Note: This should remain the last member so it'll be destroyed and
277 // invalidate its weak pointers before any other members are destroyed. 283 // invalidate its weak pointers before any other members are destroyed.
278 base::WeakPtrFactory<ChangeListLoader> weak_ptr_factory_; 284 base::WeakPtrFactory<ChangeListLoader> weak_ptr_factory_;
279 DISALLOW_COPY_AND_ASSIGN(ChangeListLoader); 285 DISALLOW_COPY_AND_ASSIGN(ChangeListLoader);
280 }; 286 };
281 287
282 } // namespace drive 288 } // namespace drive
283 289
284 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_ 290 #endif // CHROME_BROWSER_CHROMEOS_DRIVE_CHANGE_LIST_LOADER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698