Chromium Code Reviews| Index: chrome/browser/chromeos/gdata/gdata_file_system.cc |
| diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.cc b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
| index d7bbff261be721fc90a728422c649620c757d9fd..669cfc0f5cc672c3c84f380e8c4b39d1ea87d9cb 100644 |
| --- a/chrome/browser/chromeos/gdata/gdata_file_system.cc |
| +++ b/chrome/browser/chromeos/gdata/gdata_file_system.cc |
| @@ -441,6 +441,7 @@ void AddEntryToSearchResults( |
| const SearchCallback& callback, |
| GDataFileError error, |
| bool run_callback, |
| + const GURL& next_feed, |
| GDataEntry* entry) { |
| // If a result is not present in our local file system snapshot, ignore it. |
| // For example, this may happen if the entry has recently been added to the |
| @@ -453,7 +454,7 @@ void AddEntryToSearchResults( |
| if (run_callback) { |
| scoped_ptr<std::vector<SearchResultInfo> > result_vec(results); |
| if (!callback.is_null()) |
| - callback.Run(error, result_vec.Pass()); |
| + callback.Run(error, next_feed, result_vec.Pass()); |
| } |
| } |
| @@ -974,6 +975,7 @@ void GDataFileSystem::OnGetAccountMetadata( |
| true, /* should_fetch_multiple_feeds */ |
| search_file_path, |
| std::string() /* no search query */, |
| + GURL(), |
|
satorux1
2012/07/20 17:13:04
please add some comment
tbarzic
2012/07/20 17:51:43
Done.
|
| std::string() /* no directory resource ID */, |
| callback, |
| base::Bind(&GDataFileSystem::OnFeedFromServerLoaded, |
| @@ -1003,6 +1005,7 @@ void GDataFileSystem::OnGetAccountMetadata( |
| true, /* should_fetch_multiple_feeds */ |
| search_file_path, |
| std::string() /* no search query */, |
| + GURL(), |
|
satorux1
2012/07/20 17:13:04
ditto
tbarzic
2012/07/20 17:51:43
Done.
|
| std::string() /* no directory resource ID */, |
| callback, |
| base::Bind(&GDataFileSystem::OnFeedFromServerLoaded, |
| @@ -1038,6 +1041,7 @@ void GDataFileSystem::OnGetAccountMetadata( |
| true, /* should_fetch_multiple_feeds */ |
| search_file_path, |
| std::string() /* no search query */, |
| + GURL(), |
|
satorux1
2012/07/20 17:13:04
ditto
tbarzic
2012/07/20 17:51:43
Done.
|
| std::string() /* no directory resource ID */, |
| callback, |
| base::Bind(&GDataFileSystem::OnFeedFromServerLoaded, |
| @@ -1051,6 +1055,7 @@ void GDataFileSystem::LoadFeedFromServer( |
| bool should_fetch_multiple_feeds, |
| const FilePath& search_file_path, |
| const std::string& search_query, |
| + const GURL& feed_to_load, |
| const std::string& directory_resource_id, |
| const FindEntryCallback& entry_found_callback, |
| const LoadDocumentFeedCallback& feed_load_callback) { |
| @@ -1062,7 +1067,7 @@ void GDataFileSystem::LoadFeedFromServer( |
| new std::vector<DocumentFeed*>); |
| const base::TimeTicks start_time = base::TimeTicks::Now(); |
| documents_service_->GetDocuments( |
| - GURL(), // root feed start. |
| + feed_to_load, |
| start_changestamp, |
| search_query, |
| directory_resource_id, |
| @@ -2346,6 +2351,7 @@ void GDataFileSystem::RequestDirectoryRefreshOnUIThreadAfterGetEntryInfo( |
| true, // multiple feeds |
| file_path, |
| std::string(), // No search query |
| + GURL(), |
|
satorux1
2012/07/20 17:13:04
ditto.
tbarzic
2012/07/20 17:51:43
Done.
|
| entry_proto->resource_id(), |
| FindEntryCallback(), // Not used. |
| base::Bind(&GDataFileSystem::OnRequestDirectoryRefresh, |
| @@ -2638,7 +2644,7 @@ void GDataFileSystem::OnSearch(const SearchCallback& callback, |
| if (error != GDATA_FILE_OK) { |
| if (!callback.is_null()) |
| - callback.Run(error, scoped_ptr<std::vector<SearchResultInfo> >()); |
| + callback.Run(error, GURL(), scoped_ptr<std::vector<SearchResultInfo> >()); |
| return; |
| } |
| @@ -2650,10 +2656,13 @@ void GDataFileSystem::OnSearch(const SearchCallback& callback, |
| DCHECK_EQ(1u, params->feed_list->size()); |
| DocumentFeed* feed = params->feed_list->at(0); |
| + GURL next_feed; |
| + feed->GetNextFeedURL(&next_feed); |
|
satorux1
2012/07/20 17:13:04
are we going to fetch all the search results? What
tbarzic
2012/07/20 17:51:43
Yeah, we should probably stop at certain number, b
satorux1
2012/07/20 17:55:56
I think having a hard limit here would be safer.
tbarzic
2012/07/20 18:32:19
yep, that was the number I had in mind to limit nu
|
| + |
| if (feed->entries().empty()) { |
| scoped_ptr<std::vector<SearchResultInfo> > result_vec(results); |
| if (!callback.is_null()) |
| - callback.Run(error, result_vec.Pass()); |
| + callback.Run(error, next_feed, result_vec.Pass()); |
| return; |
| } |
| @@ -2689,22 +2698,26 @@ void GDataFileSystem::OnSearch(const SearchCallback& callback, |
| results, |
| callback, |
| error, |
| - i+1 == feed->entries().size())); |
| + i+1 == feed->entries().size(), |
| + next_feed)); |
| } |
| } |
| void GDataFileSystem::Search(const std::string& search_query, |
| + const GURL& next_feed, |
| const SearchCallback& callback) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
| BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| RunTaskOnUIThread(base::Bind(&GDataFileSystem::SearchAsyncOnUIThread, |
| ui_weak_ptr_, |
| search_query, |
| + next_feed, |
| CreateRelayCallback(callback))); |
| } |
| void GDataFileSystem::SearchAsyncOnUIThread( |
| const std::string& search_query, |
| + const GURL& next_feed, |
| const SearchCallback& callback) { |
| DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| scoped_ptr<std::vector<DocumentFeed*> > feed_list( |
| @@ -2719,6 +2732,7 @@ void GDataFileSystem::SearchAsyncOnUIThread( |
| // results (especially since we don't cache them). |
| FilePath(), // Not used. |
| search_query, |
| + next_feed, |
| std::string(), // No directory resource ID. |
| FindEntryCallback(), // Not used. |
| base::Bind(&GDataFileSystem::OnSearch, |