electron/atom/common/platform_util.h

61 lines
1.4 KiB
C
Raw Normal View History

// Copyright (c) 2013 GitHub, Inc.
2014-04-25 09:49:37 +00:00
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_COMMON_PLATFORM_UTIL_H_
#define ATOM_COMMON_PLATFORM_UTIL_H_
#include "base/callback_forward.h"
2016-10-14 19:38:55 +00:00
#include "build/build_config.h"
#include "v8/include/v8.h"
#if defined(OS_WIN)
#include "base/strings/string16.h"
#endif
class GURL;
namespace base {
class FilePath;
}
namespace platform_util {
// Show the given file in a file manager. If possible, select the file.
// Must be called from the UI thread.
bool ShowItemInFolder(const base::FilePath& full_path);
// Open the given file in the desktop's default manner.
// Must be called from the UI thread.
2016-09-12 21:29:06 +00:00
bool OpenItem(const base::FilePath& full_path);
typedef base::Callback<void(v8::Local<v8::Value> error)> OpenExternalCallback;
// Open the given external protocol URL in the desktop's default manner.
// (For example, mailto: URLs in the default mail user agent.)
bool OpenExternal(
#if defined(OS_WIN)
const base::string16& url,
#else
const GURL& url,
#endif
bool activate);
void OpenExternal(
#if defined(OS_WIN)
const base::string16& url,
#else
const GURL& url,
#endif
bool activate,
const OpenExternalCallback& callback);
// Move a file to trash.
bool MoveItemToTrash(const base::FilePath& full_path);
2013-04-29 14:10:03 +00:00
void Beep();
} // namespace platform_util
#endif // ATOM_COMMON_PLATFORM_UTIL_H_