1// Copyright 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4//
5// This file provides task related API functions.
6
7#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MOUNT_H_
8#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MOUNT_H_
9
10#include <vector>
11
12#include "base/files/file_path.h"
13#include "chrome/browser/chromeos/drive/drive.pb.h"
14#include "chrome/browser/chromeos/drive/file_errors.h"
15#include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h"
16
17namespace ui {
18struct SelectedFileInfo;
19}
20
21namespace extensions {
22
23// Implements chrome.fileManagerPrivate.addMount method.
24// Mounts removable devices and archive files.
25class FileManagerPrivateAddMountFunction : public LoggedAsyncExtensionFunction {
26 public:
27  DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.addMount",
28                             FILEMANAGERPRIVATE_ADDMOUNT)
29
30 protected:
31  virtual ~FileManagerPrivateAddMountFunction() {}
32
33  // AsyncExtensionFunction overrides.
34  virtual bool RunAsync() OVERRIDE;
35
36 private:
37  // Part of Run(). Called after GetFile for Drive File System.
38  void RunAfterGetDriveFile(const base::FilePath& drive_path,
39                            drive::FileError error,
40                            const base::FilePath& cache_path,
41                            scoped_ptr<drive::ResourceEntry> entry);
42
43  // Part of Run(). Called after MarkCacheFielAsMounted for Drive File System.
44  // (or directly called from RunAsync() for other file system).
45  void RunAfterMarkCacheFileAsMounted(const base::FilePath& display_name,
46                                      drive::FileError error,
47                                      const base::FilePath& file_path);
48};
49
50// Implements chrome.fileManagerPrivate.removeMount method.
51// Unmounts selected volume. Expects volume id as an argument.
52class FileManagerPrivateRemoveMountFunction
53    : public LoggedAsyncExtensionFunction {
54 public:
55  DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.removeMount",
56                             FILEMANAGERPRIVATE_REMOVEMOUNT)
57
58 protected:
59  virtual ~FileManagerPrivateRemoveMountFunction() {}
60
61  // AsyncExtensionFunction overrides.
62  virtual bool RunAsync() OVERRIDE;
63};
64
65// Implements chrome.fileManagerPrivate.getVolumeMetadataList method.
66class FileManagerPrivateGetVolumeMetadataListFunction
67    : public LoggedAsyncExtensionFunction {
68 public:
69  DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getVolumeMetadataList",
70                             FILEMANAGERPRIVATE_GETVOLUMEMETADATALIST)
71
72 protected:
73  virtual ~FileManagerPrivateGetVolumeMetadataListFunction() {}
74
75  // AsyncExtensionFunction overrides.
76  virtual bool RunAsync() OVERRIDE;
77};
78
79}  // namespace extensions
80
81#endif  // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MOUNT_H_
82