platform_util.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. // Copyright (c) 2013 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #ifndef ATOM_COMMON_PLATFORM_UTIL_H_
  5. #define ATOM_COMMON_PLATFORM_UTIL_H_
  6. #include "build/build_config.h"
  7. #if defined(OS_WIN)
  8. #include "base/strings/string16.h"
  9. #endif
  10. class GURL;
  11. namespace base {
  12. class FilePath;
  13. }
  14. namespace platform_util {
  15. // Show the given file in a file manager. If possible, select the file.
  16. // Must be called from the UI thread.
  17. bool ShowItemInFolder(const base::FilePath& full_path);
  18. // Open the given file in the desktop's default manner.
  19. // Must be called from the UI thread.
  20. bool OpenItem(const base::FilePath& full_path);
  21. // Open the given external protocol URL in the desktop's default manner.
  22. // (For example, mailto: URLs in the default mail user agent.)
  23. bool OpenExternal(
  24. #if defined(OS_WIN)
  25. const base::string16& url,
  26. #else
  27. const GURL& url,
  28. #endif
  29. bool activate);
  30. // Move a file to trash.
  31. bool MoveItemToTrash(const base::FilePath& full_path);
  32. void Beep();
  33. } // namespace platform_util
  34. #endif // ATOM_COMMON_PLATFORM_UTIL_H_