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