private_api_misc.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 miscellaneous API functions, which don't belong to
6// other files.
7
8#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
9#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
10
11#include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h"
12#include "chrome/browser/chromeos/extensions/file_manager/zip_file_creator.h"
13
14namespace file_manager {
15
16// Implements the chrome.fileBrowserPrivate.logoutUser method.
17class LogoutUserFunction : public SyncExtensionFunction {
18 public:
19  DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.logoutUser",
20                             FILEBROWSERPRIVATE_LOGOUTUSER)
21
22  LogoutUserFunction();
23
24 protected:
25  virtual ~LogoutUserFunction();
26
27  // SyncExtensionFunction overrides.
28  virtual bool RunImpl() OVERRIDE;
29};
30
31// Implements the chrome.fileBrowserPrivate.getPreferences method.
32// Gets settings for Files.app.
33class GetPreferencesFunction : public SyncExtensionFunction {
34 public:
35  DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getPreferences",
36                             FILEBROWSERPRIVATE_GETPREFERENCES)
37
38  GetPreferencesFunction();
39
40 protected:
41  virtual ~GetPreferencesFunction();
42
43  virtual bool RunImpl() OVERRIDE;
44};
45
46// Implements the chrome.fileBrowserPrivate.setPreferences method.
47// Sets settings for Files.app.
48class SetPreferencesFunction : public SyncExtensionFunction {
49 public:
50  DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.setPreferences",
51                             FILEBROWSERPRIVATE_SETPREFERENCES)
52
53  SetPreferencesFunction();
54
55 protected:
56  virtual ~SetPreferencesFunction();
57
58  virtual bool RunImpl() OVERRIDE;
59};
60
61// Implements the chrome.fileBrowserPrivate.zipSelection method.
62// Creates a zip file for the selected files.
63class ZipSelectionFunction : public LoggedAsyncExtensionFunction,
64                             public ZipFileCreator::Observer {
65 public:
66  DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.zipSelection",
67                             FILEBROWSERPRIVATE_ZIPSELECTION)
68
69  ZipSelectionFunction();
70
71 protected:
72  virtual ~ZipSelectionFunction();
73
74  // AsyncExtensionFunction overrides.
75  virtual bool RunImpl() OVERRIDE;
76
77  // extensions::ZipFileCreator::Delegate overrides.
78  virtual void OnZipDone(bool success) OVERRIDE;
79
80 private:
81  scoped_refptr<ZipFileCreator> zip_file_creator_;
82};
83
84// Implements the chrome.fileBrowserPrivate.zoom method.
85// Changes the zoom level of the file manager by internally calling
86// RenderViewHost::Zoom(). TODO(hirono): Remove this function once the zoom
87// level change is supported for all apps. crbug.com/227175.
88class ZoomFunction : public SyncExtensionFunction {
89 public:
90  DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.zoom",
91                             FILEBROWSERPRIVATE_ZOOM);
92
93  ZoomFunction();
94
95 protected:
96  virtual ~ZoomFunction();
97  virtual bool RunImpl() OVERRIDE;
98};
99
100}  // namespace file_manager
101
102#endif  // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
103