| 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/browser/chromeos/extensions/file_manager/zip_file_creator.h" | 12 #include "chrome/browser/chromeos/extensions/file_manager/zip_file_creator.h" |
| 13 | 13 |
| 14 namespace extensions { | 14 namespace extensions { |
| 15 | 15 |
| 16 // Implements the chrome.fileBrowserPrivate.logoutUser method. | 16 // Implements the chrome.fileBrowserPrivate.logoutUser method. |
| 17 class LogoutUserFunction : public SyncExtensionFunction { | 17 class FileBrowserPrivateLogoutUserFunction : public SyncExtensionFunction { |
| 18 public: | 18 public: |
| 19 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.logoutUser", | 19 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.logoutUser", |
| 20 FILEBROWSERPRIVATE_LOGOUTUSER) | 20 FILEBROWSERPRIVATE_LOGOUTUSER) |
| 21 | 21 |
| 22 LogoutUserFunction(); | 22 FileBrowserPrivateLogoutUserFunction(); |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 virtual ~LogoutUserFunction(); | 25 virtual ~FileBrowserPrivateLogoutUserFunction(); |
| 26 | 26 |
| 27 // SyncExtensionFunction overrides. | 27 // SyncExtensionFunction overrides. |
| 28 virtual bool RunImpl() OVERRIDE; | 28 virtual bool RunImpl() OVERRIDE; |
| 29 }; | 29 }; |
| 30 | 30 |
| 31 // Implements the chrome.fileBrowserPrivate.getPreferences method. | 31 // Implements the chrome.fileBrowserPrivate.getPreferences method. |
| 32 // Gets settings for Files.app. | 32 // Gets settings for Files.app. |
| 33 class GetPreferencesFunction : public SyncExtensionFunction { | 33 class FileBrowserPrivateGetPreferencesFunction : public SyncExtensionFunction { |
| 34 public: | 34 public: |
| 35 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getPreferences", | 35 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.getPreferences", |
| 36 FILEBROWSERPRIVATE_GETPREFERENCES) | 36 FILEBROWSERPRIVATE_GETPREFERENCES) |
| 37 | 37 |
| 38 GetPreferencesFunction(); | 38 FileBrowserPrivateGetPreferencesFunction(); |
| 39 | 39 |
| 40 protected: | 40 protected: |
| 41 virtual ~GetPreferencesFunction(); | 41 virtual ~FileBrowserPrivateGetPreferencesFunction(); |
| 42 | 42 |
| 43 virtual bool RunImpl() OVERRIDE; | 43 virtual bool RunImpl() OVERRIDE; |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // Implements the chrome.fileBrowserPrivate.setPreferences method. | 46 // Implements the chrome.fileBrowserPrivate.setPreferences method. |
| 47 // Sets settings for Files.app. | 47 // Sets settings for Files.app. |
| 48 class SetPreferencesFunction : public SyncExtensionFunction { | 48 class FileBrowserPrivateSetPreferencesFunction : public SyncExtensionFunction { |
| 49 public: | 49 public: |
| 50 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.setPreferences", | 50 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.setPreferences", |
| 51 FILEBROWSERPRIVATE_SETPREFERENCES) | 51 FILEBROWSERPRIVATE_SETPREFERENCES) |
| 52 | 52 |
| 53 SetPreferencesFunction(); | 53 FileBrowserPrivateSetPreferencesFunction(); |
| 54 | 54 |
| 55 protected: | 55 protected: |
| 56 virtual ~SetPreferencesFunction(); | 56 virtual ~FileBrowserPrivateSetPreferencesFunction(); |
| 57 | 57 |
| 58 virtual bool RunImpl() OVERRIDE; | 58 virtual bool RunImpl() OVERRIDE; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 // Implements the chrome.fileBrowserPrivate.zipSelection method. | 61 // Implements the chrome.fileBrowserPrivate.zipSelection method. |
| 62 // Creates a zip file for the selected files. | 62 // Creates a zip file for the selected files. |
| 63 class ZipSelectionFunction : public LoggedAsyncExtensionFunction, | 63 class FileBrowserPrivateZipSelectionFunction |
| 64 public file_manager::ZipFileCreator::Observer { | 64 : public LoggedAsyncExtensionFunction, |
| 65 public file_manager::ZipFileCreator::Observer { |
| 65 public: | 66 public: |
| 66 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.zipSelection", | 67 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.zipSelection", |
| 67 FILEBROWSERPRIVATE_ZIPSELECTION) | 68 FILEBROWSERPRIVATE_ZIPSELECTION) |
| 68 | 69 |
| 69 ZipSelectionFunction(); | 70 FileBrowserPrivateZipSelectionFunction(); |
| 70 | 71 |
| 71 protected: | 72 protected: |
| 72 virtual ~ZipSelectionFunction(); | 73 virtual ~FileBrowserPrivateZipSelectionFunction(); |
| 73 | 74 |
| 74 // AsyncExtensionFunction overrides. | 75 // AsyncExtensionFunction overrides. |
| 75 virtual bool RunImpl() OVERRIDE; | 76 virtual bool RunImpl() OVERRIDE; |
| 76 | 77 |
| 77 // extensions::ZipFileCreator::Delegate overrides. | 78 // extensions::ZipFileCreator::Delegate overrides. |
| 78 virtual void OnZipDone(bool success) OVERRIDE; | 79 virtual void OnZipDone(bool success) OVERRIDE; |
| 79 | 80 |
| 80 private: | 81 private: |
| 81 scoped_refptr<file_manager::ZipFileCreator> zip_file_creator_; | 82 scoped_refptr<file_manager::ZipFileCreator> zip_file_creator_; |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 // Implements the chrome.fileBrowserPrivate.zoom method. | 85 // Implements the chrome.fileBrowserPrivate.zoom method. |
| 85 // Changes the zoom level of the file manager by internally calling | 86 // Changes the zoom level of the file manager by internally calling |
| 86 // RenderViewHost::Zoom(). TODO(hirono): Remove this function once the zoom | 87 // RenderViewHost::Zoom(). TODO(hirono): Remove this function once the zoom |
| 87 // level change is supported for all apps. crbug.com/227175. | 88 // level change is supported for all apps. crbug.com/227175. |
| 88 class ZoomFunction : public SyncExtensionFunction { | 89 class FileBrowserPrivateZoomFunction : public SyncExtensionFunction { |
| 89 public: | 90 public: |
| 90 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.zoom", | 91 DECLARE_EXTENSION_FUNCTION("fileBrowserPrivate.zoom", |
| 91 FILEBROWSERPRIVATE_ZOOM); | 92 FILEBROWSERPRIVATE_ZOOM); |
| 92 | 93 |
| 93 ZoomFunction(); | 94 FileBrowserPrivateZoomFunction(); |
| 94 | 95 |
| 95 protected: | 96 protected: |
| 96 virtual ~ZoomFunction(); | 97 virtual ~FileBrowserPrivateZoomFunction(); |
| 97 virtual bool RunImpl() OVERRIDE; | 98 virtual bool RunImpl() OVERRIDE; |
| 98 }; | 99 }; |
| 99 | 100 |
| 100 } // namespace extensions | 101 } // namespace extensions |
| 101 | 102 |
| 102 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_ | 103 #endif // CHROME_BROWSER_CHROMEOS_EXTENSIONS_FILE_MANAGER_PRIVATE_API_MISC_H_ |
| OLD | NEW |