#ifndef CHROME_BROWSER_MEDIA_GALLERIES_LINUX_SNAPSHOT_FILE_DETAILS_H_
#define CHROME_BROWSER_MEDIA_GALLERIES_LINUX_SNAPSHOT_FILE_DETAILS_H_
#include <string>
#include "base/basictypes.h"
#include "base/callback.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "chrome/browser/media_galleries/fileapi/mtp_device_async_delegate.h"
struct SnapshotRequestInfo {
SnapshotRequestInfo(
const std::string& device_file_path,
const base::FilePath& snapshot_file_path,
const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback&
success_callback,
const MTPDeviceAsyncDelegate::ErrorCallback& error_callback);
~SnapshotRequestInfo();
const std::string device_file_path;
const base::FilePath snapshot_file_path;
const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback
success_callback;
const MTPDeviceAsyncDelegate::ErrorCallback error_callback;
};
class SnapshotFileDetails {
public:
SnapshotFileDetails(const SnapshotRequestInfo& request_info,
const base::File::Info& file_info);
~SnapshotFileDetails();
std::string device_file_path() const {
return request_info_.device_file_path;
}
base::FilePath snapshot_file_path() const {
return request_info_.snapshot_file_path;
}
uint32 bytes_written() const {
return bytes_written_;
}
const base::File::Info file_info() const {
return file_info_;
}
const MTPDeviceAsyncDelegate::CreateSnapshotFileSuccessCallback
success_callback() const {
return request_info_.success_callback;
}
const MTPDeviceAsyncDelegate::ErrorCallback error_callback() const {
return request_info_.error_callback;
}
bool error_occurred() const {
return error_occurred_;
}
void set_error_occurred(bool error);
bool AddBytesWritten(uint32 bytes_written);
bool IsSnapshotFileWriteComplete() const;
uint32 BytesToRead() const;
private:
const SnapshotRequestInfo request_info_;
const base::File::Info file_info_;
uint32 bytes_written_;
bool error_occurred_;
DISALLOW_COPY_AND_ASSIGN(SnapshotFileDetails);
};
#endif