#include "chrome/browser/media_galleries/win/snapshot_file_details.h"
#include "components/storage_monitor/storage_monitor.h"
#include "content/public/browser/browser_thread.h"
-#include "webkit/common/fileapi/file_system_util.h"
+#include "storage/common/fileapi/file_system_util.h"
namespace {
bool GetStorageInfoOnUIThread(const base::string16& storage_path,
base::string16* pnp_device_id,
base::string16* storage_object_id) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
DCHECK(!storage_path.empty());
DCHECK(pnp_device_id);
DCHECK(storage_object_id);
base::RemoveChars(storage_path, L"\\\\", &storage_device_id);
DCHECK(!storage_device_id.empty());
// TODO(gbillock): Take the StorageMonitor as an argument.
- StorageMonitor* monitor = StorageMonitor::GetInstance();
+ storage_monitor::StorageMonitor* monitor =
+ storage_monitor::StorageMonitor::GetInstance();
DCHECK(monitor);
return monitor->GetMTPStorageInfoFromDeviceId(
base::UTF16ToUTF8(storage_device_id), pnp_device_id, storage_object_id);
base::File::Error ReadDirectoryOnBlockingPoolThread(
const MTPDeviceDelegateImplWin::StorageDeviceInfo& device_info,
const base::FilePath& root,
- fileapi::AsyncFileUtil::EntryList* entries) {
+ storage::AsyncFileUtil::EntryList* entries) {
base::ThreadRestrictions::AssertIOAllowed();
DCHECK(!root.empty());
DCHECK(entries);
return error;
while (!(current = file_enum->Next()).empty()) {
- fileapi::DirectoryEntry entry;
+ storage::DirectoryEntry entry;
entry.is_directory = file_enum->IsDirectory();
- entry.name = fileapi::VirtualPath::BaseName(current).value();
+ entry.name = storage::VirtualPath::BaseName(current).value();
entry.size = file_enum->Size();
entry.last_modified_time = file_enum->LastModifiedTime();
entries->push_back(entry);
base::string16* pnp_device_id,
base::string16* storage_object_id,
bool succeeded) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(pnp_device_id);
DCHECK(storage_object_id);
if (!succeeded)
void CreateMTPDeviceAsyncDelegate(
const base::string16& device_location,
const CreateMTPDeviceAsyncDelegateCallback& callback) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(!device_location.empty());
base::string16* pnp_device_id = new base::string16;
base::string16* storage_object_id = new base::string16;
: pnp_device_id(pnp_device_id),
registered_device_path(registered_device_path),
storage_object_id(storage_object_id) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
}
MTPDeviceDelegateImplWin::PendingTaskInfo::PendingTaskInfo(
media_task_runner_(MediaFileSystemBackend::MediaTaskRunner()),
task_in_progress_(false),
weak_ptr_factory_(this) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(!registered_device_path.empty());
DCHECK(!pnp_device_id.empty());
DCHECK(!storage_object_id.empty());
}
MTPDeviceDelegateImplWin::~MTPDeviceDelegateImplWin() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
}
void MTPDeviceDelegateImplWin::GetFileInfo(
const base::FilePath& file_path,
const GetFileInfoSuccessCallback& success_callback,
const ErrorCallback& error_callback) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(!file_path.empty());
base::File::Info* file_info = new base::File::Info;
EnsureInitAndRunTask(
const base::FilePath& root,
const ReadDirectorySuccessCallback& success_callback,
const ErrorCallback& error_callback) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(!root.empty());
- fileapi::AsyncFileUtil::EntryList* entries =
- new fileapi::AsyncFileUtil::EntryList;
+ storage::AsyncFileUtil::EntryList* entries =
+ new storage::AsyncFileUtil::EntryList;
EnsureInitAndRunTask(
PendingTaskInfo(FROM_HERE,
base::Bind(&ReadDirectoryOnBlockingPoolThread,
const base::FilePath& snapshot_file_path,
const CreateSnapshotFileSuccessCallback& success_callback,
const ErrorCallback& error_callback) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(!device_file_path.empty());
DCHECK(!snapshot_file_path.empty());
scoped_ptr<SnapshotFileDetails> file_details(
void MTPDeviceDelegateImplWin::ReadBytes(
const base::FilePath& device_file_path,
- net::IOBuffer* buf, int64 offset, int buf_len,
+ const scoped_refptr<net::IOBuffer>& buf,
+ int64 offset,
+ int buf_len,
const ReadBytesSuccessCallback& success_callback,
const ErrorCallback& error_callback) {
NOTREACHED();
}
void MTPDeviceDelegateImplWin::CancelPendingTasksAndDeleteDelegate() {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
PortableDeviceMapService::GetInstance()->MarkPortableDeviceForDeletion(
storage_device_info_.registered_device_path);
media_task_runner_->PostTask(
void MTPDeviceDelegateImplWin::EnsureInitAndRunTask(
const PendingTaskInfo& task_info) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
if ((init_state_ == INITIALIZED) && !task_in_progress_) {
DCHECK(pending_tasks_.empty());
DCHECK(!current_snapshot_details_.get());
}
void MTPDeviceDelegateImplWin::OnInitCompleted(bool succeeded) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
init_state_ = succeeded ? INITIALIZED : UNINITIALIZED;
task_in_progress_ = false;
ProcessNextPendingRequest();
const ErrorCallback& error_callback,
base::File::Info* file_info,
base::File::Error error) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(file_info);
if (error == base::File::FILE_OK)
success_callback.Run(*file_info);
void MTPDeviceDelegateImplWin::OnDidReadDirectory(
const ReadDirectorySuccessCallback& success_callback,
const ErrorCallback& error_callback,
- fileapi::AsyncFileUtil::EntryList* file_list,
+ storage::AsyncFileUtil::EntryList* file_list,
base::File::Error error) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(file_list);
if (error == base::File::FILE_OK)
success_callback.Run(*file_list, false /*no more entries*/);
void MTPDeviceDelegateImplWin::OnGetFileStream(
scoped_ptr<SnapshotFileDetails> file_details,
base::File::Error error) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(file_details);
DCHECK(!file_details->request_info().device_file_path.empty());
DCHECK(!file_details->request_info().snapshot_file_path.empty());
void MTPDeviceDelegateImplWin::OnWroteDataChunkIntoSnapshotFile(
const base::FilePath& snapshot_file_path,
DWORD bytes_written) {
- DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::IO));
+ DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
DCHECK(!snapshot_file_path.empty());
if (!current_snapshot_details_.get())
return;