| Index: webkit/fileapi/media_file_system_proxy_win.h
|
| diff --git a/webkit/fileapi/media_file_system_proxy_win.h b/webkit/fileapi/media_file_system_proxy_win.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..dc7fad4e4a0440e645c988bd33d429e53595811e
|
| --- /dev/null
|
| +++ b/webkit/fileapi/media_file_system_proxy_win.h
|
| @@ -0,0 +1,119 @@
|
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef WEBKIT_FILEAPI_MEDIA_FILE_SYSTEM_PROXY_WIN_H_
|
| +#define WEBKIT_FILEAPI_MEDIA_FILE_SYSTEM_PROXY_WIN_H_
|
| +
|
| +#include <map>
|
| +#include <vector>
|
| +
|
| +#include <PortableDeviceApi.h> // Include this header for Windows Portable Device API interfaces
|
| +#include <PortableDevice.h> // Include this header for Windows Portable Device definitions
|
| +
|
| +#include "base/callback.h"
|
| +#include "base/file_path.h"
|
| +#include "base/file_util_proxy.h"
|
| +#include "base/platform_file.h"
|
| +#include "webkit/fileapi/media_file_system_proxy.h"
|
| +#include "base/win/scoped_comptr.h"
|
| +
|
| +
|
| +class GURL;
|
| +
|
| +using base::PlatformFileError;
|
| +
|
| +namespace fileapi {
|
| +
|
| +class FileSystemOperationContext;
|
| +
|
| +// The interface class for media file system proxy.
|
| +class MediaFileSystemProxyWin : public fileapi::MediaFileSystemProxyInterface {
|
| + public:
|
| + // Some of the proxy routines are just wrapping around the FileUtilProxy's
|
| + // relay methods, so we use the same types as FileUtilProxy for them.
|
| + typedef base::FileUtilProxy::Entry Entry;
|
| + typedef base::Callback<void(PlatformFileError,
|
| + const std::vector<Entry>&,
|
| + bool has_more)> ReadDirectoryCallback;
|
| +
|
| + MediaFileSystemProxyWin(const FilePath::StringType& device_id);
|
| + ~MediaFileSystemProxyWin();
|
| +
|
| + // Gets the file or directory info for given|path|.
|
| + virtual void GetFileInfo(const FileSystemURL& url,
|
| + const FileSystemOperationInterface::GetMetadataCallback& callback);
|
| +
|
| + // Copies a file or directory from |src_url| to |dest_url|. If
|
| + // |src_url| is a directory, the contents of |src_url| are copied to
|
| + // |dest_url| recursively. A new file or directory is created at
|
| + // |dest_url| as needed.
|
| + virtual void Copy(
|
| + const FileSystemURL& src_url,
|
| + const FileSystemURL& dest_url,
|
| + const FileSystemOperationInterface::StatusCallback& callback);
|
| +
|
| + // Moves a file or directory from |src_url| to |dest_url|. A new file
|
| + // or directory is created at |dest_url| as needed.
|
| + virtual void Move(
|
| + const FileSystemURL& src_url,
|
| + const FileSystemURL& dest_url,
|
| + const FileSystemOperationInterface::StatusCallback& callback);
|
| +
|
| + // Reads contents of a directory at |url|.
|
| + virtual void ReadDirectory(
|
| + FileSystemOperationContext* context,
|
| + const FileSystemURL& url,
|
| + const FileSystemOperationInterface::ReadDirectoryCallback& callback);
|
| +
|
| + // Removes a file or directory at |url|. If |recursive| is true, remove
|
| + // all files and directories under the directory at |url| recursively.
|
| + virtual void Remove(const FileSystemURL& url, bool recursive,
|
| + const FileSystemOperationInterface::StatusCallback& callback);
|
| +
|
| + // Creates a directory at |url|. If |exclusive| is true, an error is
|
| + // raised in case a directory is already present at the URL. If
|
| + // |recursive| is true, create parent directories as needed just like
|
| + // mkdir -p does.
|
| + virtual void CreateDirectory(
|
| + const FileSystemURL& url,
|
| + bool exclusive,
|
| + bool recursive,
|
| + const FileSystemOperationInterface::StatusCallback& callback);
|
| +
|
| + // Creates a file at |url|. If the flag |is_exclusive| is true, an
|
| + // error is raised when a file already exists at the path. It is
|
| + // an error if a directory or a hosted document is already present at the
|
| + // path, or the parent directory of the path is not present yet.
|
| + virtual void CreateFile(
|
| + const FileSystemURL& url,
|
| + bool exclusive,
|
| + const FileSystemOperationInterface::StatusCallback& callback);
|
| +
|
| + // Opens file for a give |url| with specified |flags| (see
|
| + // base::PlatformFileFlags for details).
|
| + virtual void OpenFile(
|
| + const FileSystemURL& url,
|
| + int flags,
|
| + base::ProcessHandle peer_handle,
|
| + const FileSystemOperationInterface::OpenFileCallback& callback);
|
| +
|
| + // Notifies that a file opened by OpenFile (at |path|) is closed.
|
| + virtual void NotifyCloseFile(const FileSystemURL& url);
|
| +
|
| +private:
|
| + // Store a map of entry full path with the corresponding object id in the device.
|
| + // Key: Entry.FullPath
|
| + // Value: Object identifier specified by the device.
|
| + typedef std::map<std::string, std::string> ObjectIdMap;
|
| +
|
| + // MTP Device identifier.
|
| + FilePath::StringType device_id_;
|
| +
|
| + ObjectIdMap object_id_map_;
|
| + base::win::ScopedComPtr<IPortableDevice> portable_device_;
|
| +};
|
| +
|
| +} // namespace fileapi
|
| +
|
| +#endif // WEBKIT_FILEAPI_MEDIA_FILE_SYSTEM_PROXY_H_
|
|
|