private_api_mount.h revision a36e5920737c6adbddd3e43b760e5de8431db6e0
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 <string>
11#include <vector>
12
13#include "base/files/file_path.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 file_manager {
22
23// Implements chrome.fileBrowserPrivate.addMount method.
24// Mounts a device or a file.
25class AddMountFunction : public LoggedAsyncExtensionFunction {
26 public:
27  DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.addMount",
28                             FILEBROWSERPRIVATE_ADDMOUNT)
29
30  AddMountFunction();
31
32 protected:
33  virtual ~AddMountFunction();
34
35  // AsyncExtensionFunction overrides.
36  virtual bool RunImpl() OVERRIDE;
37
38 private:
39  // A callback method to handle the result of MarkCacheAsMounted.
40  void OnMountedStateSet(const std::string& mount_type,
41                         const base::FilePath::StringType& file_name,
42                         drive::FileError error,
43                         const base::FilePath& file_path);
44};
45
46// Implements chrome.fileBrowserPrivate.removeMount method.
47// Unmounts selected device. Expects mount point path as an argument.
48class RemoveMountFunction : public LoggedAsyncExtensionFunction {
49 public:
50  DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.removeMount",
51                             FILEBROWSERPRIVATE_REMOVEMOUNT)
52
53  RemoveMountFunction();
54
55 protected:
56  virtual ~RemoveMountFunction();
57
58  // AsyncExtensionFunction overrides.
59  virtual bool RunImpl() OVERRIDE;
60
61 private:
62  // A callback method to handle the result of GetSelectedFileInfo.
63  void GetSelectedFileInfoResponse(
64      const std::vector<ui::SelectedFileInfo>& files);
65};
66
67// Implements chrome.fileBrowserPrivate.getMountPoints method.
68class GetMountPointsFunction : public LoggedAsyncExtensionFunction {
69 public:
70  DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getMountPoints",
71                             FILEBROWSERPRIVATE_GETMOUNTPOINTS)
72
73  GetMountPointsFunction();
74
75 protected:
76  virtual ~GetMountPointsFunction();
77
78  // AsyncExtensionFunction overrides.
79  virtual bool RunImpl() OVERRIDE;
80};
81
82}  // namespace file_manager
83
84#endif  // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MOUNT_H_
85