1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// This file provides miscellaneous API functions, which don't belong to
// other files.
#ifndef CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
#define CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
#include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h"
#include "chrome/common/extensions/webstore_install_result.h"
#include "google_apis/drive/gdata_errorcode.h"
namespace google_apis {
class AuthServiceInterface;
}
namespace extensions {
// Implements the chrome.fileManagerPrivate.logoutUserForReauthentication
// method.
class FileManagerPrivateLogoutUserForReauthenticationFunction
: public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.logoutUserForReauthentication",
FILEMANAGERPRIVATE_LOGOUTUSERFORREAUTHENTICATION)
protected:
virtual ~FileManagerPrivateLogoutUserForReauthenticationFunction() {}
// SyncExtensionFunction overrides.
virtual bool RunSync() override;
};
// Implements the chrome.fileManagerPrivate.getPreferences method.
// Gets settings for Files.app.
class FileManagerPrivateGetPreferencesFunction
: public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getPreferences",
FILEMANAGERPRIVATE_GETPREFERENCES)
protected:
virtual ~FileManagerPrivateGetPreferencesFunction() {}
virtual bool RunSync() override;
};
// Implements the chrome.fileManagerPrivate.setPreferences method.
// Sets settings for Files.app.
class FileManagerPrivateSetPreferencesFunction
: public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.setPreferences",
FILEMANAGERPRIVATE_SETPREFERENCES)
protected:
virtual ~FileManagerPrivateSetPreferencesFunction() {}
virtual bool RunSync() override;
};
// Implements the chrome.fileManagerPrivate.zipSelection method.
// Creates a zip file for the selected files.
class FileManagerPrivateZipSelectionFunction
: public LoggedAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.zipSelection",
FILEMANAGERPRIVATE_ZIPSELECTION)
FileManagerPrivateZipSelectionFunction();
protected:
virtual ~FileManagerPrivateZipSelectionFunction();
// AsyncExtensionFunction overrides.
virtual bool RunAsync() override;
// Receives the result from ZipFileCreator.
void OnZipDone(bool success);
};
// Implements the chrome.fileManagerPrivate.zoom method.
// Changes the zoom level of the file manager by internally calling
// RenderViewHost::Zoom(). TODO(hirono): Remove this function once the zoom
// level change is supported for all apps. crbug.com/227175.
class FileManagerPrivateZoomFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.zoom",
FILEMANAGERPRIVATE_ZOOM);
protected:
virtual ~FileManagerPrivateZoomFunction() {}
// AsyncExtensionFunction overrides.
virtual bool RunSync() override;
};
// Implements the chrome.fileManagerPrivate.installWebstoreItem method.
class FileManagerPrivateInstallWebstoreItemFunction
: public LoggedAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.installWebstoreItem",
FILEMANAGERPRIVATE_INSTALLWEBSTOREITEM);
protected:
virtual ~FileManagerPrivateInstallWebstoreItemFunction() {}
// AsyncExtensionFunction overrides.
virtual bool RunAsync() override;
void OnInstallComplete(bool success,
const std::string& error,
extensions::webstore_install::Result result);
private:
std::string webstore_item_id_;
};
class FileManagerPrivateRequestWebStoreAccessTokenFunction
: public LoggedAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.requestWebStoreAccessToken",
FILEMANAGERPRIVATE_REQUESTWEBSTOREACCESSTOKEN);
FileManagerPrivateRequestWebStoreAccessTokenFunction();
protected:
virtual ~FileManagerPrivateRequestWebStoreAccessTokenFunction();
virtual bool RunAsync() override;
private:
scoped_ptr<google_apis::AuthServiceInterface> auth_service_;
void OnAccessTokenFetched(google_apis::GDataErrorCode code,
const std::string& access_token);
};
class FileManagerPrivateGetProfilesFunction
: public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getProfiles",
FILEMANAGERPRIVATE_GETPROFILES);
protected:
virtual ~FileManagerPrivateGetProfilesFunction() {}
// AsyncExtensionFunction overrides.
virtual bool RunSync() override;
};
class FileManagerPrivateVisitDesktopFunction
: public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.visitDesktop",
FILEMANAGERPRIVATE_VISITDESKTOP);
protected:
virtual ~FileManagerPrivateVisitDesktopFunction() {}
// AsyncExtensionFunction overrides.
virtual bool RunSync() override;
};
// Implements the chrome.fileManagerPrivate.openInspector method.
class FileManagerPrivateOpenInspectorFunction
: public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.openInspector",
FILEMANAGERPRIVATE_OPENINSPECTOR);
protected:
virtual ~FileManagerPrivateOpenInspectorFunction() {}
virtual bool RunSync() override;
};
} // namespace extensions
#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
|