blob: e447d5ca87b6ca97df0db64fac5e6ce20ae8cc7e (
plain)
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
|
// 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/browser/chromeos/file_manager/zip_file_creator.h"
#include "google_apis/drive/gdata_errorcode.h"
namespace google_apis {
class AuthServiceInterface;
}
namespace extensions {
// Implements the chrome.fileBrowserPrivate.logoutUserForReauthentication
// method.
class FileBrowserPrivateLogoutUserForReauthenticationFunction
: public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.logoutUserForReauthentication",
FILEBROWSERPRIVATE_LOGOUTUSERFORREAUTHENTICATION)
protected:
virtual ~FileBrowserPrivateLogoutUserForReauthenticationFunction() {}
// SyncExtensionFunction overrides.
virtual bool RunImpl() OVERRIDE;
};
// Implements the chrome.fileBrowserPrivate.getPreferences method.
// Gets settings for Files.app.
class FileBrowserPrivateGetPreferencesFunction
: public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getPreferences",
FILEBROWSERPRIVATE_GETPREFERENCES)
protected:
virtual ~FileBrowserPrivateGetPreferencesFunction() {}
virtual bool RunImpl() OVERRIDE;
};
// Implements the chrome.fileBrowserPrivate.setPreferences method.
// Sets settings for Files.app.
class FileBrowserPrivateSetPreferencesFunction
: public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.setPreferences",
FILEBROWSERPRIVATE_SETPREFERENCES)
protected:
virtual ~FileBrowserPrivateSetPreferencesFunction() {}
virtual bool RunImpl() OVERRIDE;
};
// Implements the chrome.fileBrowserPrivate.zipSelection method.
// Creates a zip file for the selected files.
class FileBrowserPrivateZipSelectionFunction
: public LoggedAsyncExtensionFunction,
public file_manager::ZipFileCreator::Observer {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.zipSelection",
FILEBROWSERPRIVATE_ZIPSELECTION)
FileBrowserPrivateZipSelectionFunction();
protected:
virtual ~FileBrowserPrivateZipSelectionFunction();
// AsyncExtensionFunction overrides.
virtual bool RunImpl() OVERRIDE;
// extensions::ZipFileCreator::Delegate overrides.
virtual void OnZipDone(bool success) OVERRIDE;
private:
scoped_refptr<file_manager::ZipFileCreator> zip_file_creator_;
};
// Implements the chrome.fileBrowserPrivate.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 FileBrowserPrivateZoomFunction : public ChromeSyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.zoom",
FILEBROWSERPRIVATE_ZOOM);
protected:
virtual ~FileBrowserPrivateZoomFunction() {}
// AsyncExtensionFunction overrides.
virtual bool RunImpl() OVERRIDE;
};
// Implements the chrome.fileBrowserPrivate.installWebstoreItem method.
class FileBrowserPrivateInstallWebstoreItemFunction
: public LoggedAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.installWebstoreItem",
FILEBROWSERPRIVATE_INSTALLWEBSTOREITEM);
protected:
virtual ~FileBrowserPrivateInstallWebstoreItemFunction() {}
// AsyncExtensionFunction overrides.
virtual bool RunImpl() OVERRIDE;
void OnInstallComplete(bool success, const std::string& error);
private:
std::string webstore_item_id_;
};
class FileBrowserPrivateRequestWebStoreAccessTokenFunction
: public LoggedAsyncExtensionFunction {
public:
DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.requestWebStoreAccessToken",
FILEBROWSERPRIVATE_REQUESTWEBSTOREACCESSTOKEN);
FileBrowserPrivateRequestWebStoreAccessTokenFunction();
protected:
virtual ~FileBrowserPrivateRequestWebStoreAccessTokenFunction();
virtual bool RunImpl() OVERRIDE;
private:
scoped_ptr<google_apis::AuthServiceInterface> auth_service_;
void OnAccessTokenFetched(google_apis::GDataErrorCode code,
const std::string& access_token);
};
} // namespace extensions
#endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_
|