Chromium Code Reviews| Index: chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h |
| diff --git a/chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h b/chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h |
| index b5712c567bada9d559cb077c99acca9ab99e4f18..1663bf0775b95e309c7e2312c6cac8a8fd8859d2 100644 |
| --- a/chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h |
| +++ b/chrome/browser/chromeos/gdata/gdata_wapi_feed_loader.h |
| @@ -27,7 +27,7 @@ struct GetDocumentsParams { |
| const FilePath& search_file_path, |
| const std::string& search_query, |
| const std::string& directory_resource_id, |
| - const FindEntryCallback& callback, |
| + const FileOperationCallback& callback, |
| GetDocumentsUiState* ui_state); |
| ~GetDocumentsParams(); |
| @@ -44,7 +44,7 @@ struct GetDocumentsParams { |
| FilePath search_file_path; |
| std::string search_query; |
| std::string directory_resource_id; |
| - FindEntryCallback callback; |
| + FileOperationCallback callback; |
| scoped_ptr<GetDocumentsUiState> ui_state; |
| }; |
| @@ -53,7 +53,7 @@ struct LoadRootFeedParams { |
| LoadRootFeedParams( |
| FilePath search_file_path, |
| bool should_load_from_server, |
| - const FindEntryCallback& callback); |
| + const FileOperationCallback& callback); |
| ~LoadRootFeedParams(); |
| FilePath search_file_path; |
| @@ -63,7 +63,7 @@ struct LoadRootFeedParams { |
| base::Time last_modified; |
| // Time when filesystem began to be loaded from disk. |
| base::Time load_start_time; |
| - const FindEntryCallback callback; |
| + const FileOperationCallback callback; |
| }; |
| // Callback run as a response to LoadFromServer. |
| @@ -107,29 +107,38 @@ class GDataWapiFeedLoader { |
| void AddObserver(Observer* observer); |
| void RemoveObserver(Observer* observer); |
| - // Starts root feed load from the cache. If successful, it will try to find |
| - // the file upon retrieval completion. In addition to that, it will |
| - // initiate retrieval of the root feed from the server unless |
| + // Starts root feed load from the cache. If successful, runs |callback| to |
| + // tell the caller that the loading was successful. |
| + // |
| + // Then, it will initiate retrieval of the root feed from the server unless |
| // |should_load_from_server| is set to false. |should_load_from_server| is |
| - // false only for testing. |
| + // false only for testing. If loading from the server is successful, runs |
| + // |callback| if it was not previously run (i.e. loading from the cache was |
| + // successful). |
| + // |
| + // |callback| may be null. |
| void LoadFromCache(bool should_load_from_server, |
|
achuithb
2012/08/14 23:57:36
Not in this patch, but can this be simplified so w
satorux1
2012/08/15 00:03:26
This is just what I was doing after sending the in
|
| const FilePath& search_file_path, |
| - const FindEntryCallback& callback); |
| + const FileOperationCallback& callback); |
| // Starts root feed load from the server. Value of |start_changestamp| |
| // determines the type of feed to load - 0 means root feed, every other |
| // value would trigger delta feed. |
| // In the case of loading the root feed we use |root_feed_changestamp| as its |
| // initial changestamp value since it does not come with that info. |
| - // When done |load_feed_callback| is invoked. |
| - // |entry_found_callback| is used only when this is invoked while searching |
| - // for file info, and is used in |load_feed_callback|. If successful, it will |
| - // try to find the file upon retrieval completion. |
| + // |
| + // When all feeds are loaded, |feed_load_callback| is invoked with the |
| + // retrieved feeds. Then |load_finished_callback| is invoked with the error |
| + // code. |
| + // |
| // |should_fetch_multiple_feeds| is true iff don't want to stop feed loading |
| // after we retrieve first feed chunk. |
| // If invoked as a part of content search, query will be set in |
| // |search_query|. |
| // If |feed_to_load| is set, this is feed url that will be used to load feed. |
| + // |
| + // |load_finished_callback| may be null. |
| + // |feed_load_callback| must not be null |
|
achuithb
2012/08/14 23:57:36
nit: period at end of sentence here and elsewhere.
satorux1
2012/08/15 00:03:26
Done.
|
| void LoadFromServer( |
| ContentOrigin initial_origin, |
| int64 start_changestamp, |
| @@ -139,7 +148,7 @@ class GDataWapiFeedLoader { |
| const std::string& search_query, |
| const GURL& feed_to_load, |
| const std::string& directory_resource_id, |
| - const FindEntryCallback& entry_found_callback, |
| + const FileOperationCallback& load_finished_callback, |
| const LoadDocumentFeedCallback& feed_load_callback); |
| // Retrieves account metadata and determines from the last change timestamp |
| @@ -148,7 +157,7 @@ class GDataWapiFeedLoader { |
| ContentOrigin initial_origin, |
| int64 local_changestamp, |
| const FilePath& search_file_path, |
| - const FindEntryCallback& callback); |
| + const FileOperationCallback& callback); |
| // Updates whole directory structure feeds collected in |feed_list|. |
| // On success, returns PLATFORM_FILE_OK. Record file statistics as UMA |
| @@ -177,7 +186,7 @@ class GDataWapiFeedLoader { |
| ContentOrigin initial_origin, |
| int64 local_changestamp, |
| const FilePath& search_file_path, |
| - const FindEntryCallback& callback, |
| + const FileOperationCallback& callback, |
| GDataErrorCode status, |
| scoped_ptr<base::Value> feed_data); |
| @@ -189,7 +198,7 @@ class GDataWapiFeedLoader { |
| ContentOrigin initial_origin, |
| int64 local_changestamp, |
| const FilePath& search_file_path, |
| - const FindEntryCallback& callback, |
| + const FileOperationCallback& callback, |
| GDataErrorCode status, |
| scoped_ptr<base::Value> feed_data); |
| @@ -203,6 +212,7 @@ class GDataWapiFeedLoader { |
| // Callback for handling response from |GDataDocumentsService::GetDocuments|. |
| // Invokes |callback| when done. |
| + // |callback| must not be null |
| void OnGetDocuments( |
| ContentOrigin initial_origin, |
| const LoadDocumentFeedCallback& callback, |
| @@ -213,6 +223,7 @@ class GDataWapiFeedLoader { |
| // Callback for handling response from |GDataDocumentsService::GetChanglist|. |
| // Invokes |callback| when done. |
| + // |callback| must not be null |
| void OnGetChangelist(ContentOrigin initial_origin, |
| const LoadDocumentFeedCallback& callback, |
| GetDocumentsParams* params, |