scanning_app_delegate.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. // Copyright 2021 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef ASH_WEBUI_SCANNING_SCANNING_APP_DELEGATE_H_
  5. #define ASH_WEBUI_SCANNING_SCANNING_APP_DELEGATE_H_
  6. #include <memory>
  7. #include <string>
  8. #include <vector>
  9. #include "base/callback_forward.h"
  10. #include "base/files/file_path.h"
  11. namespace ui {
  12. class SelectFilePolicy;
  13. } // namespace ui
  14. namespace ash {
  15. // A delegate which exposes browser functionality from //chrome to the Scan app
  16. // UI.
  17. class ScanningAppDelegate {
  18. public:
  19. virtual ~ScanningAppDelegate() = default;
  20. // Returns a ChromeSelectFilePolicy used to open a select dialog.
  21. virtual std::unique_ptr<ui::SelectFilePolicy>
  22. CreateChromeSelectFilePolicy() = 0;
  23. // Gets the display name from |path| to show in the Scan To dropdown. Handles
  24. // the special case of converting the Google Drive root and MyFiles directory
  25. // to the desired display names "Google Drive" and "My Files" respectively.
  26. virtual std::string GetBaseNameFromPath(const base::FilePath& path) = 0;
  27. // Gets the MyFiles path for the current user.
  28. virtual base::FilePath GetMyFilesPath() = 0;
  29. // Gets scan settings from Pref service.
  30. virtual std::string GetScanSettingsFromPrefs() = 0;
  31. // Determines if |path_to_file| is a supported file path for the Files app.
  32. virtual bool IsFilePathSupported(const base::FilePath& path_to_file) = 0;
  33. // Opens the Media app with the files specified in |file_paths|.
  34. virtual void OpenFilesInMediaApp(
  35. const std::vector<base::FilePath>& file_paths) = 0;
  36. // Saves scan settings to Pref service.
  37. virtual void SaveScanSettingsToPrefs(const std::string& scan_settings) = 0;
  38. // Opens the Files app with |path_to_file| highlighted. Returns false if
  39. // |path_to_file| is not found in the filesystem.
  40. virtual void ShowFileInFilesApp(
  41. const base::FilePath& path_to_file,
  42. base::OnceCallback<void(const bool)> callback) = 0;
  43. };
  44. } // namespace ash
  45. #endif // ASH_WEBUI_SCANNING_SCANNING_APP_DELEGATE_H_