| 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 <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/files/file.h" | 13 #include "base/files/file.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h" | 15 #include "chrome/browser/chromeos/extensions/file_manager/private_api_base.h" |
| 16 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" | 16 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_inte
rface.h" |
| 17 #include "chrome/browser/extensions/chrome_extension_function.h" | 17 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 18 #include "chrome/browser/extensions/chrome_extension_function_details.h" | 18 #include "chrome/browser/extensions/chrome_extension_function_details.h" |
| 19 #include "google_apis/drive/drive_api_error_codes.h" | 19 #include "google_apis/drive/drive_api_error_codes.h" |
| 20 | 20 |
| 21 namespace google_apis { | 21 namespace google_apis { |
| 22 class AuthServiceInterface; | 22 class AuthServiceInterface; |
| 23 } // namespace google_apis | 23 } // namespace google_apis |
| 24 | 24 |
| 25 namespace extensions { | 25 namespace extensions { |
| 26 | 26 |
| 27 // Implements the chrome.fileManagerPrivate.logoutUserForReauthentication | 27 // Implements the chrome.fileManagerPrivate.logoutUserForReauthentication |
| 28 // method. | 28 // method. |
| 29 class FileManagerPrivateLogoutUserForReauthenticationFunction | 29 class FileManagerPrivateLogoutUserForReauthenticationFunction |
| 30 : public ChromeSyncExtensionFunction { | 30 : public UIThreadExtensionFunction { |
| 31 public: | 31 public: |
| 32 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.logoutUserForReauthentication", | 32 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.logoutUserForReauthentication", |
| 33 FILEMANAGERPRIVATE_LOGOUTUSERFORREAUTHENTICATION) | 33 FILEMANAGERPRIVATE_LOGOUTUSERFORREAUTHENTICATION) |
| 34 | 34 |
| 35 protected: | 35 protected: |
| 36 ~FileManagerPrivateLogoutUserForReauthenticationFunction() override {} | 36 ~FileManagerPrivateLogoutUserForReauthenticationFunction() override {} |
| 37 | 37 |
| 38 // SyncExtensionFunction overrides. | 38 // ExtensionFunction: |
| 39 bool RunSync() override; | 39 ResponseAction Run() override; |
| 40 }; | 40 }; |
| 41 | 41 |
| 42 // Implements the chrome.fileManagerPrivate.getPreferences method. | 42 // Implements the chrome.fileManagerPrivate.getPreferences method. |
| 43 // Gets settings for Files.app. | 43 // Gets settings for Files.app. |
| 44 class FileManagerPrivateGetPreferencesFunction | 44 class FileManagerPrivateGetPreferencesFunction |
| 45 : public ChromeSyncExtensionFunction { | 45 : public UIThreadExtensionFunction { |
| 46 public: | 46 public: |
| 47 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getPreferences", | 47 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getPreferences", |
| 48 FILEMANAGERPRIVATE_GETPREFERENCES) | 48 FILEMANAGERPRIVATE_GETPREFERENCES) |
| 49 | 49 |
| 50 protected: | 50 protected: |
| 51 ~FileManagerPrivateGetPreferencesFunction() override {} | 51 ~FileManagerPrivateGetPreferencesFunction() override {} |
| 52 | 52 |
| 53 bool RunSync() override; | 53 ResponseAction Run() override; |
| 54 }; | 54 }; |
| 55 | 55 |
| 56 // Implements the chrome.fileManagerPrivate.setPreferences method. | 56 // Implements the chrome.fileManagerPrivate.setPreferences method. |
| 57 // Sets settings for Files.app. | 57 // Sets settings for Files.app. |
| 58 class FileManagerPrivateSetPreferencesFunction | 58 class FileManagerPrivateSetPreferencesFunction |
| 59 : public ChromeSyncExtensionFunction { | 59 : public UIThreadExtensionFunction { |
| 60 public: | 60 public: |
| 61 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.setPreferences", | 61 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.setPreferences", |
| 62 FILEMANAGERPRIVATE_SETPREFERENCES) | 62 FILEMANAGERPRIVATE_SETPREFERENCES) |
| 63 | 63 |
| 64 protected: | 64 protected: |
| 65 ~FileManagerPrivateSetPreferencesFunction() override {} | 65 ~FileManagerPrivateSetPreferencesFunction() override {} |
| 66 | 66 |
| 67 bool RunSync() override; | 67 ResponseAction Run() override; |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 // Implements the chrome.fileManagerPrivate.zipSelection method. | 70 // Implements the chrome.fileManagerPrivate.zipSelection method. |
| 71 // Creates a zip file for the selected files. | 71 // Creates a zip file for the selected files. |
| 72 class FileManagerPrivateInternalZipSelectionFunction | 72 class FileManagerPrivateInternalZipSelectionFunction |
| 73 : public LoggedAsyncExtensionFunction { | 73 : public LoggedAsyncExtensionFunction { |
| 74 public: | 74 public: |
| 75 DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.zipSelection", | 75 DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.zipSelection", |
| 76 FILEMANAGERPRIVATEINTERNAL_ZIPSELECTION) | 76 FILEMANAGERPRIVATEINTERNAL_ZIPSELECTION) |
| 77 | 77 |
| 78 FileManagerPrivateInternalZipSelectionFunction(); | 78 FileManagerPrivateInternalZipSelectionFunction(); |
| 79 | 79 |
| 80 protected: | 80 protected: |
| 81 ~FileManagerPrivateInternalZipSelectionFunction() override; | 81 ~FileManagerPrivateInternalZipSelectionFunction() override; |
| 82 | 82 |
| 83 // AsyncExtensionFunction overrides. | 83 // AsyncExtensionFunction overrides. |
| 84 bool RunAsync() override; | 84 bool RunAsync() override; |
| 85 | 85 |
| 86 // Receives the result from ZipFileCreator. | 86 // Receives the result from ZipFileCreator. |
| 87 void OnZipDone(bool success); | 87 void OnZipDone(bool success); |
| 88 }; | 88 }; |
| 89 | 89 |
| 90 // Implements the chrome.fileManagerPrivate.zoom method. | 90 // Implements the chrome.fileManagerPrivate.zoom method. |
| 91 // Changes the zoom level of the file manager by modifying the zoom level of the | 91 // Changes the zoom level of the file manager by modifying the zoom level of the |
| 92 // WebContents. | 92 // WebContents. |
| 93 // TODO(hirono): Remove this function once the zoom level change is supported | 93 // TODO(hirono): Remove this function once the zoom level change is supported |
| 94 // for all apps. crbug.com/227175. | 94 // for all apps. crbug.com/227175. |
| 95 class FileManagerPrivateZoomFunction : public ChromeSyncExtensionFunction { | 95 class FileManagerPrivateZoomFunction : public UIThreadExtensionFunction { |
| 96 public: | 96 public: |
| 97 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.zoom", | 97 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.zoom", |
| 98 FILEMANAGERPRIVATE_ZOOM); | 98 FILEMANAGERPRIVATE_ZOOM); |
| 99 | 99 |
| 100 protected: | 100 protected: |
| 101 ~FileManagerPrivateZoomFunction() override {} | 101 ~FileManagerPrivateZoomFunction() override {} |
| 102 | 102 |
| 103 // AsyncExtensionFunction overrides. | 103 // ExtensionFunction: |
| 104 bool RunSync() override; | 104 ResponseAction Run() override; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 class FileManagerPrivateRequestWebStoreAccessTokenFunction | 107 class FileManagerPrivateRequestWebStoreAccessTokenFunction |
| 108 : public LoggedAsyncExtensionFunction { | 108 : public LoggedAsyncExtensionFunction { |
| 109 public: | 109 public: |
| 110 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.requestWebStoreAccessToken", | 110 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.requestWebStoreAccessToken", |
| 111 FILEMANAGERPRIVATE_REQUESTWEBSTOREACCESSTOKEN); | 111 FILEMANAGERPRIVATE_REQUESTWEBSTOREACCESSTOKEN); |
| 112 | 112 |
| 113 FileManagerPrivateRequestWebStoreAccessTokenFunction(); | 113 FileManagerPrivateRequestWebStoreAccessTokenFunction(); |
| 114 | 114 |
| 115 protected: | 115 protected: |
| 116 ~FileManagerPrivateRequestWebStoreAccessTokenFunction() override; | 116 ~FileManagerPrivateRequestWebStoreAccessTokenFunction() override; |
| 117 bool RunAsync() override; | 117 bool RunAsync() override; |
| 118 | 118 |
| 119 private: | 119 private: |
| 120 std::unique_ptr<google_apis::AuthServiceInterface> auth_service_; | 120 std::unique_ptr<google_apis::AuthServiceInterface> auth_service_; |
| 121 | 121 |
| 122 void OnAccessTokenFetched(google_apis::DriveApiErrorCode code, | 122 void OnAccessTokenFetched(google_apis::DriveApiErrorCode code, |
| 123 const std::string& access_token); | 123 const std::string& access_token); |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 class FileManagerPrivateGetProfilesFunction | 126 class FileManagerPrivateGetProfilesFunction : public UIThreadExtensionFunction { |
| 127 : public ChromeSyncExtensionFunction { | |
| 128 public: | 127 public: |
| 129 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getProfiles", | 128 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.getProfiles", |
| 130 FILEMANAGERPRIVATE_GETPROFILES); | 129 FILEMANAGERPRIVATE_GETPROFILES); |
| 131 | 130 |
| 132 protected: | 131 protected: |
| 133 ~FileManagerPrivateGetProfilesFunction() override {} | 132 ~FileManagerPrivateGetProfilesFunction() override {} |
| 134 | 133 |
| 135 // AsyncExtensionFunction overrides. | 134 // ExtensionFunction: |
| 136 bool RunSync() override; | 135 ResponseAction Run() override; |
| 137 }; | 136 }; |
| 138 | 137 |
| 139 // Implements the chrome.fileManagerPrivate.openInspector method. | 138 // Implements the chrome.fileManagerPrivate.openInspector method. |
| 140 class FileManagerPrivateOpenInspectorFunction | 139 class FileManagerPrivateOpenInspectorFunction |
| 141 : public ChromeSyncExtensionFunction { | 140 : public UIThreadExtensionFunction { |
| 142 public: | 141 public: |
| 143 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.openInspector", | 142 DECLARE_EXTENSION_FUNCTION("fileManagerPrivate.openInspector", |
| 144 FILEMANAGERPRIVATE_OPENINSPECTOR); | 143 FILEMANAGERPRIVATE_OPENINSPECTOR); |
| 145 | 144 |
| 146 protected: | 145 protected: |
| 147 ~FileManagerPrivateOpenInspectorFunction() override {} | 146 ~FileManagerPrivateOpenInspectorFunction() override {} |
| 148 | 147 |
| 149 bool RunSync() override; | 148 ResponseAction Run() override; |
| 150 }; | 149 }; |
| 151 | 150 |
| 152 // Implements the chrome.fileManagerPrivate.getMimeType method. | 151 // Implements the chrome.fileManagerPrivate.getMimeType method. |
| 153 class FileManagerPrivateInternalGetMimeTypeFunction | 152 class FileManagerPrivateInternalGetMimeTypeFunction |
| 154 : public LoggedAsyncExtensionFunction { | 153 : public LoggedAsyncExtensionFunction { |
| 155 public: | 154 public: |
| 156 DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getMimeType", | 155 DECLARE_EXTENSION_FUNCTION("fileManagerPrivateInternal.getMimeType", |
| 157 FILEMANAGERPRIVATEINTERNAL_GETMIMETYPE) | 156 FILEMANAGERPRIVATEINTERNAL_GETMIMETYPE) |
| 158 | 157 |
| 159 FileManagerPrivateInternalGetMimeTypeFunction(); | 158 FileManagerPrivateInternalGetMimeTypeFunction(); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 void OnCompleted(base::File::Error result); | 265 void OnCompleted(base::File::Error result); |
| 267 | 266 |
| 268 const ChromeExtensionFunctionDetails chrome_details_; | 267 const ChromeExtensionFunctionDetails chrome_details_; |
| 269 DISALLOW_COPY_AND_ASSIGN( | 268 DISALLOW_COPY_AND_ASSIGN( |
| 270 FileManagerPrivateInternalExecuteCustomActionFunction); | 269 FileManagerPrivateInternalExecuteCustomActionFunction); |
| 271 }; | 270 }; |
| 272 | 271 |
| 273 } // namespace extensions | 272 } // namespace extensions |
| 274 | 273 |
| 275 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_ | 274 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_ |
| OLD | NEW |