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.
5 // This file provides miscellaneous API functions, which don't belong to
8 #ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
9 #define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
11 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h"
12 #include "chrome/common/extensions/webstore_install_result.h"
13 #include "google_apis/drive/gdata_errorcode.h"
15 namespace google_apis {
16 class AuthServiceInterface;
19 namespace extensions {
21 // Implements the chrome.fileManagerPrivate.logoutUserForReauthentication
23 class FileManagerPrivateLogoutUserForReauthenticationFunction
24 : public ChromeSyncExtensionFunction {
26 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.logoutUserForReauthentication",
27 FILEMANAGERPRIVATE_LOGOUTUSERFORREAUTHENTICATION)
30 virtual ~FileManagerPrivateLogoutUserForReauthenticationFunction() {}
32 // SyncExtensionFunction overrides.
33 virtual bool RunSync() OVERRIDE;
36 // Implements the chrome.fileManagerPrivate.getPreferences method.
37 // Gets settings for Files.app.
38 class FileManagerPrivateGetPreferencesFunction
39 : public ChromeSyncExtensionFunction {
41 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getPreferences",
42 FILEMANAGERPRIVATE_GETPREFERENCES)
45 virtual ~FileManagerPrivateGetPreferencesFunction() {}
47 virtual bool RunSync() OVERRIDE;
50 // Implements the chrome.fileManagerPrivate.setPreferences method.
51 // Sets settings for Files.app.
52 class FileManagerPrivateSetPreferencesFunction
53 : public ChromeSyncExtensionFunction {
55 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.setPreferences",
56 FILEMANAGERPRIVATE_SETPREFERENCES)
59 virtual ~FileManagerPrivateSetPreferencesFunction() {}
61 virtual bool RunSync() OVERRIDE;
64 // Implements the chrome.fileManagerPrivate.zipSelection method.
65 // Creates a zip file for the selected files.
66 class FileManagerPrivateZipSelectionFunction
67 : public LoggedAsyncExtensionFunction {
69 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.zipSelection",
70 FILEMANAGERPRIVATE_ZIPSELECTION)
72 FileManagerPrivateZipSelectionFunction();
75 virtual ~FileManagerPrivateZipSelectionFunction();
77 // AsyncExtensionFunction overrides.
78 virtual bool RunAsync() OVERRIDE;
80 // Receives the result from ZipFileCreator.
81 void OnZipDone(bool success);
84 // Implements the chrome.fileManagerPrivate.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.
88 class FileManagerPrivateZoomFunction : public ChromeSyncExtensionFunction {
90 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.zoom",
91 FILEMANAGERPRIVATE_ZOOM);
94 virtual ~FileManagerPrivateZoomFunction() {}
96 // AsyncExtensionFunction overrides.
97 virtual bool RunSync() OVERRIDE;
100 // Implements the chrome.fileManagerPrivate.installWebstoreItem method.
101 class FileManagerPrivateInstallWebstoreItemFunction
102 : public LoggedAsyncExtensionFunction {
104 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.installWebstoreItem",
105 FILEMANAGERPRIVATE_INSTALLWEBSTOREITEM);
108 virtual ~FileManagerPrivateInstallWebstoreItemFunction() {}
110 // AsyncExtensionFunction overrides.
111 virtual bool RunAsync() OVERRIDE;
112 void OnInstallComplete(bool success,
113 const std::string& error,
114 extensions::webstore_install::Result result);
117 std::string webstore_item_id_;
120 class FileManagerPrivateRequestWebStoreAccessTokenFunction
121 : public LoggedAsyncExtensionFunction {
123 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.requestWebStoreAccessToken",
124 FILEMANAGERPRIVATE_REQUESTWEBSTOREACCESSTOKEN);
126 FileManagerPrivateRequestWebStoreAccessTokenFunction();
129 virtual ~FileManagerPrivateRequestWebStoreAccessTokenFunction();
130 virtual bool RunAsync() OVERRIDE;
133 scoped_ptr<google_apis::AuthServiceInterface> auth_service_;
135 void OnAccessTokenFetched(google_apis::GDataErrorCode code,
136 const std::string& access_token);
140 class FileManagerPrivateGetProfilesFunction
141 : public ChromeSyncExtensionFunction {
143 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getProfiles",
144 FILEMANAGERPRIVATE_GETPROFILES);
147 virtual ~FileManagerPrivateGetProfilesFunction() {}
149 // AsyncExtensionFunction overrides.
150 virtual bool RunSync() OVERRIDE;
153 class FileManagerPrivateVisitDesktopFunction
154 : public ChromeSyncExtensionFunction {
156 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.visitDesktop",
157 FILEMANAGERPRIVATE_VISITDESKTOP);
160 virtual ~FileManagerPrivateVisitDesktopFunction() {}
162 // AsyncExtensionFunction overrides.
163 virtual bool RunSync() OVERRIDE;
166 // Implements the chrome.fileManagerPrivate.openInspector method.
167 class FileManagerPrivateOpenInspectorFunction
168 : public ChromeSyncExtensionFunction {
170 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.openInspector",
171 FILEMANAGERPRIVATE_OPENINSPECTOR);
174 virtual ~FileManagerPrivateOpenInspectorFunction() {}
176 virtual bool RunSync() OVERRIDE;
179 } // namespace extensions
181 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_