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.fileBrowserPrivate.logoutUserForReauthentication
23 class FileBrowserPrivateLogoutUserForReauthenticationFunction
24 : public ChromeSyncExtensionFunction {
26 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.logoutUserForReauthentication",
27 FILEBROWSERPRIVATE_LOGOUTUSERFORREAUTHENTICATION)
30 virtual ~FileBrowserPrivateLogoutUserForReauthenticationFunction() {}
32 // SyncExtensionFunction overrides.
33 virtual bool RunSync() OVERRIDE;
36 // Implements the chrome.fileBrowserPrivate.getPreferences method.
37 // Gets settings for Files.app.
38 class FileBrowserPrivateGetPreferencesFunction
39 : public ChromeSyncExtensionFunction {
41 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getPreferences",
42 FILEBROWSERPRIVATE_GETPREFERENCES)
45 virtual ~FileBrowserPrivateGetPreferencesFunction() {}
47 virtual bool RunSync() OVERRIDE;
50 // Implements the chrome.fileBrowserPrivate.setPreferences method.
51 // Sets settings for Files.app.
52 class FileBrowserPrivateSetPreferencesFunction
53 : public ChromeSyncExtensionFunction {
55 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.setPreferences",
56 FILEBROWSERPRIVATE_SETPREFERENCES)
59 virtual ~FileBrowserPrivateSetPreferencesFunction() {}
61 virtual bool RunSync() OVERRIDE;
64 // Implements the chrome.fileBrowserPrivate.zipSelection method.
65 // Creates a zip file for the selected files.
66 class FileBrowserPrivateZipSelectionFunction
67 : public LoggedAsyncExtensionFunction {
69 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.zipSelection",
70 FILEBROWSERPRIVATE_ZIPSELECTION)
72 FileBrowserPrivateZipSelectionFunction();
75 virtual ~FileBrowserPrivateZipSelectionFunction();
77 // AsyncExtensionFunction overrides.
78 virtual bool RunAsync() OVERRIDE;
80 // Receives the result from ZipFileCreator.
81 void OnZipDone(bool success);
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.
88 class FileBrowserPrivateZoomFunction : public ChromeSyncExtensionFunction {
90 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.zoom",
91 FILEBROWSERPRIVATE_ZOOM);
94 virtual ~FileBrowserPrivateZoomFunction() {}
96 // AsyncExtensionFunction overrides.
97 virtual bool RunSync() OVERRIDE;
100 // Implements the chrome.fileBrowserPrivate.installWebstoreItem method.
101 class FileBrowserPrivateInstallWebstoreItemFunction
102 : public LoggedAsyncExtensionFunction {
104 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.installWebstoreItem",
105 FILEBROWSERPRIVATE_INSTALLWEBSTOREITEM);
108 virtual ~FileBrowserPrivateInstallWebstoreItemFunction() {}
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 FileBrowserPrivateRequestWebStoreAccessTokenFunction
121 : public LoggedAsyncExtensionFunction {
123 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.requestWebStoreAccessToken",
124 FILEBROWSERPRIVATE_REQUESTWEBSTOREACCESSTOKEN);
126 FileBrowserPrivateRequestWebStoreAccessTokenFunction();
129 virtual ~FileBrowserPrivateRequestWebStoreAccessTokenFunction();
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 FileBrowserPrivateGetProfilesFunction
141 : public ChromeSyncExtensionFunction {
143 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getProfiles",
144 FILEBROWSERPRIVATE_GETPROFILES);
147 virtual ~FileBrowserPrivateGetProfilesFunction() {}
149 // AsyncExtensionFunction overrides.
150 virtual bool RunSync() OVERRIDE;
153 class FileBrowserPrivateVisitDesktopFunction
154 : public ChromeSyncExtensionFunction {
156 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.visitDesktop",
157 FILEBROWSERPRIVATE_VISITDESKTOP);
160 virtual ~FileBrowserPrivateVisitDesktopFunction() {}
162 // AsyncExtensionFunction overrides.
163 virtual bool RunSync() OVERRIDE;
166 // Implements the chrome.fileBrowserPrivate.openInspector method.
167 class FileBrowserPrivateOpenInspectorFunction
168 : public ChromeSyncExtensionFunction {
170 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.openInspector",
171 FILEBROWSERPRIVATE_OPENINSPECTOR);
174 virtual ~FileBrowserPrivateOpenInspectorFunction() {}
176 virtual bool RunSync() OVERRIDE;
179 } // namespace extensions
181 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_