Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / media_galleries / linux / mtp_device_task_helper.h
index 02bc9f5..f24251e 100644 (file)
@@ -31,8 +31,10 @@ class MTPDeviceTaskHelper {
   typedef MTPDeviceAsyncDelegate::GetFileInfoSuccessCallback
       GetFileInfoSuccessCallback;
 
-  typedef base::Callback<void(const fileapi::AsyncFileUtil::EntryList&)>
-      ReadDirectorySuccessCallback;
+  // NOTE: The file names in the entry list have their file id appended at the
+  // end. e.g. foo.jpg with file id 45 becomes foo.jpg,45.
+  typedef base::Callback<void(const fileapi::AsyncFileUtil::EntryList& entries,
+                              bool has_more)> ReadDirectorySuccessCallback;
 
   typedef MTPDeviceAsyncDelegate::ErrorCallback ErrorCallback;
 
@@ -48,34 +50,34 @@ class MTPDeviceTaskHelper {
   void OpenStorage(const std::string& storage_name,
                    const OpenStorageCallback& callback);
 
-  // Dispatches the GetFileInfoByPath request to the
-  // MediaTransferProtocolManager.
+  // Dispatches the GetFileInfo request to the MediaTransferProtocolManager.
   //
-  // |file_path| specifies the relative of the file whose details are requested.
+  // |file_id| specifies the id of the file whose details are requested.
   //
   // If the file details are fetched successfully, |success_callback| is invoked
   // on the IO thread to notify the caller about the file details.
   //
   // If there is an error, |error_callback| is invoked on the IO thread to
   // notify the caller about the file error.
-  void GetFileInfoByPath(
-      const std::string& file_path,
-      const GetFileInfoSuccessCallback& success_callback,
-      const ErrorCallback& error_callback);
+  void GetFileInfo(uint32 file_id,
+                   const GetFileInfoSuccessCallback& success_callback,
+                   const ErrorCallback& error_callback);
 
   // Dispatches the read directory request to the MediaTransferProtocolManager.
   //
-  // |dir_path| specifies the directory file path.
+  // |dir_id| specifies the directory id.
   //
   // If the directory file entries are enumerated successfully,
   // |success_callback| is invoked on the IO thread to notify the caller about
-  // the directory file entries.
+  // the directory file entries. Please see the note in the
+  // ReadDirectorySuccessCallback typedef regarding the special treatment of
+  // file names.
   //
   // If there is an error, |error_callback| is invoked on the IO thread to
   // notify the caller about the file error.
-  void ReadDirectoryByPath(const std::string& dir_path,
-                           const ReadDirectorySuccessCallback& success_callback,
-                           const ErrorCallback& error_callback);
+  void ReadDirectory(uint32 dir_id,
+                     const ReadDirectorySuccessCallback& success_callback,
+                     const ErrorCallback& error_callback);
 
   // Forwards the WriteDataIntoSnapshotFile request to the MTPReadFileWorker
   // object.
@@ -122,7 +124,7 @@ class MTPDeviceTaskHelper {
                      const MtpFileEntry& file_entry,
                      bool error) const;
 
-  // Query callback for ReadDirectoryByPath().
+  // Query callback for ReadDirectory().
   //
   // If there is no error, |error| is set to false, |file_entries| has the
   // directory file entries and |success_callback| is invoked on the IO thread
@@ -130,11 +132,11 @@ class MTPDeviceTaskHelper {
   //
   // If there is an error, |error| is set to true, |file_entries| is empty
   // and |error_callback| is invoked on the IO thread to notify the caller.
-  void OnDidReadDirectoryByPath(
-      const ReadDirectorySuccessCallback& success_callback,
-      const ErrorCallback& error_callback,
-      const std::vector<MtpFileEntry>& file_entries,
-      bool error) const;
+  void OnDidReadDirectory(const ReadDirectorySuccessCallback& success_callback,
+                          const ErrorCallback& error_callback,
+                          const std::vector<MtpFileEntry>& file_entries,
+                          bool has_more,
+                          bool error) const;
 
   // Intermediate step to finish a ReadBytes request.
   void OnGetFileInfoToReadBytes(