Chromium Code Reviews| Index: chrome/browser/chromeos/gdata/gdata_file_system.h |
| diff --git a/chrome/browser/chromeos/gdata/gdata_file_system.h b/chrome/browser/chromeos/gdata/gdata_file_system.h |
| index c963adc4545962b8d62a31b362e30ad0933a11fc..e93115a1549fa5c38f7404a2f213d83c90745a30 100644 |
| --- a/chrome/browser/chromeos/gdata/gdata_file_system.h |
| +++ b/chrome/browser/chromeos/gdata/gdata_file_system.h |
| @@ -205,6 +205,14 @@ class GDataFileSystemInterface { |
| virtual void FindEntryByResourceIdSync(const std::string& resource_id, |
| FindEntryDelegate* delegate) = 0; |
| + // Does server side content search for |search_query|. Search results will be |
|
satorux1
2012/05/03 17:58:34
please move this function to where ReadDirectoryBy
tbarzic
2012/05/03 23:56:17
Done.
|
| + // returned as gdata entries in temp directory proto, and their |
| + // title/file_name will be formatted as |<resource_id>.<original_file_name>|. |
| + // |
| + // Can be called from UI/IO thread. |callback| is run on calling thread. |
| + virtual void SearchContent(const std::string& search_query, |
|
satorux1
2012/05/03 17:58:34
maybe GetEntriesByQueryAsync()? (we'll drop Async
tbarzic
2012/05/03 23:56:17
Done.
|
| + const ReadDirectoryCallback& callback) = 0; |
| + |
| // Initiates transfer of |local_file_path| to |remote_dest_file_path|. |
| // |local_file_path| must be a file from the local file system, |
| // |remote_dest_file_path| is the virtual destination path within gdata file |
| @@ -403,6 +411,8 @@ class GDataFileSystem : public GDataFileSystemInterface, |
| virtual void Authenticate(const AuthStatusCallback& callback) OVERRIDE; |
| virtual void FindEntryByResourceIdSync(const std::string& resource_id, |
| FindEntryDelegate* delegate) OVERRIDE; |
| + virtual void SearchContent(const std::string& search_query, |
| + const ReadDirectoryCallback& callback) OVERRIDE; |
| virtual void TransferFile(const FilePath& local_file_path, |
| const FilePath& remote_dest_file_path, |
| const FileOperationCallback& callback) OVERRIDE; |
| @@ -547,7 +557,9 @@ class GDataFileSystem : public GDataFileSystemInterface, |
| GetDocumentsParams(int start_changestamp, |
| int root_feed_changestamp, |
| std::vector<DocumentFeed*>* feed_list, |
| + bool allow_multiple_feeds, |
| const FilePath& search_file_path, |
| + const std::string& search_query, |
| const FindEntryCallback& callback); |
| ~GetDocumentsParams(); |
| @@ -558,7 +570,11 @@ class GDataFileSystem : public GDataFileSystemInterface, |
| int start_changestamp; |
| int root_feed_changestamp; |
| scoped_ptr<std::vector<DocumentFeed*> > feed_list; |
| + // Should we stop after getting first feed chunk, even if there is more |
| + // data. |
| + bool allow_multiple_feeds; |
|
satorux1
2012/05/03 17:58:34
maybe should_fetch_multipe_feeds ?
tbarzic
2012/05/03 23:56:17
Done.
|
| FilePath search_file_path; |
| + std::string search_query; |
| FindEntryCallback callback; |
| }; |
| @@ -570,6 +586,11 @@ class GDataFileSystem : public GDataFileSystemInterface, |
| const FilePath& file_path)> |
| FilePathUpdateCallback; |
| + // Callback run as a response to LoadFeedFromServer. |
| + typedef base::Callback<void(GetDocumentsParams* params, |
| + base::PlatformFileError error)> |
| + LoadDocumentFeedCallback; |
| + |
| // Finds entry object by |file_path| and returns the entry object. |
| // Returns NULL if it does not find the entry. |
| GDataEntry* GetGDataEntryByPath(const FilePath& file_path); |
| @@ -604,6 +625,15 @@ class GDataFileSystem : public GDataFileSystemInterface, |
| base::Value* data, |
| base::PlatformFileError *error); |
| + // Callback passed to |LoadFeedFromServer| from |SearchContent| method. |
| + // |callback| is that should be run with data received from |
| + // |LoadFeedFromServer|. |
| + // |params| params used for getting document feed for content search. |
| + // |status| was |LoadFeedFromServer| successfull. |
| + void OnSearchContent(const ReadDirectoryCallback& callback, |
| + GetDocumentsParams* params, |
| + base::PlatformFileError status); |
| + |
| // Initiates transfer of |local_file_path| with |resource_id| to |
| // |remote_dest_file_path|. |local_file_path| must be a file from the local |
| // file system, |remote_dest_file_path| is the virtual destination path within |
| @@ -679,12 +709,10 @@ class GDataFileSystem : public GDataFileSystemInterface, |
| base::PlatformFileError RemoveEntryFromGData(const FilePath& file_path, |
| std::string* resource_id); |
| - // Callback for handling feed content fetching while searching for file info. |
| - // This callback is invoked after async feed fetch operation that was |
| - // invoked by StartDirectoryRefresh() completes. This callback will update |
| - // the content of the refreshed directory object and continue initially |
| - // started FindEntryByPath() request. |
| - void OnGetDocuments(GetDocumentsParams* params, |
| + // Callback for handling response from |GDataDocumentsService::GetDocuments|. |
| + // Invokes |callback| when done. |
| + void OnGetDocuments(const LoadDocumentFeedCallback& callback, |
| + GetDocumentsParams* params, |
| GDataErrorCode status, |
| scoped_ptr<base::Value> data); |
| @@ -853,11 +881,29 @@ class GDataFileSystem : public GDataFileSystemInterface, |
| // 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. |
| - // If successful, it will try to find the file upon retrieval completion. |
| + // 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. |
| + // |allow_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|. |
| void LoadFeedFromServer(int start_changestamp, |
| int root_feed_changestamp, |
| + bool allow_multiple_feeds, |
| const FilePath& search_file_path, |
| - const FindEntryCallback& callback); |
| + const std::string& search_query, |
| + const FindEntryCallback& entry_found_callback, |
| + const LoadDocumentFeedCallback& load_feed_callback); |
| + |
| + // Callback for handling feed content fetching while searching for file info. |
| + // This callback is invoked after async feed fetch operation that was |
| + // invoked by StartDirectoryRefresh() completes. This callback will update |
| + // the content of the refreshed directory object and continue initially |
| + // started FindEntryByPath() request. |
| + void OnFeedFromServerLoaded(GetDocumentsParams* params, |
| + base::PlatformFileError status); |
| // 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 |
| @@ -1262,6 +1308,8 @@ class GDataFileSystem : public GDataFileSystemInterface, |
| // The following functions are used to forward calls to asynchronous public |
| // member functions to UI thread. |
| + void SearchContentOnUIThread(const std::string& search_query, |
| + const ReadDirectoryCallback& callback); |
| void CopyOnUIThread(const FilePath& src_file_path, |
| const FilePath& dest_file_path, |
| const FileOperationCallback& callback); |