2014-10-31 18:17:05 +00:00
|
|
|
// 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
|
2013-04-30 08:10:25 +00:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/common/api/electron_api_clipboard.h"
|
2013-04-30 08:10:25 +00:00
|
|
|
|
2021-08-24 00:52:17 +00:00
|
|
|
#include <map>
|
|
|
|
|
2023-05-30 08:28:43 +00:00
|
|
|
#include "base/containers/contains.h"
|
2023-07-13 20:59:14 +00:00
|
|
|
#include "base/run_loop.h"
|
2015-07-07 05:17:33 +00:00
|
|
|
#include "base/strings/utf_string_conversions.h"
|
2023-08-14 08:35:37 +00:00
|
|
|
#include "shell/browser/browser.h"
|
2019-10-31 07:56:00 +00:00
|
|
|
#include "shell/common/gin_converters/image_converter.h"
|
|
|
|
#include "shell/common/gin_helper/dictionary.h"
|
2019-06-19 20:46:59 +00:00
|
|
|
#include "shell/common/node_includes.h"
|
2017-06-29 13:11:57 +00:00
|
|
|
#include "third_party/skia/include/core/SkBitmap.h"
|
2019-02-04 09:08:36 +00:00
|
|
|
#include "ui/base/clipboard/clipboard_format_type.h"
|
2024-04-10 20:06:47 +00:00
|
|
|
#include "ui/base/clipboard/file_info.h"
|
2014-06-28 14:33:00 +00:00
|
|
|
#include "ui/base/clipboard/scoped_clipboard_writer.h"
|
2021-10-21 18:51:36 +00:00
|
|
|
#include "ui/gfx/codec/png_codec.h"
|
2013-12-11 07:48:19 +00:00
|
|
|
|
2022-06-29 19:55:47 +00:00
|
|
|
namespace electron::api {
|
2013-04-30 08:10:25 +00:00
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
ui::ClipboardBuffer Clipboard::GetClipboardBuffer(gin_helper::Arguments* args) {
|
2015-06-10 04:12:37 +00:00
|
|
|
std::string type;
|
|
|
|
if (args->GetNext(&type) && type == "selection")
|
2019-08-24 01:14:23 +00:00
|
|
|
return ui::ClipboardBuffer::kSelection;
|
2015-06-10 04:12:37 +00:00
|
|
|
else
|
2019-08-24 01:14:23 +00:00
|
|
|
return ui::ClipboardBuffer::kCopyPaste;
|
2015-06-10 04:12:37 +00:00
|
|
|
}
|
|
|
|
|
2021-03-16 16:18:45 +00:00
|
|
|
std::vector<std::u16string> Clipboard::AvailableFormats(
|
2019-10-31 07:56:00 +00:00
|
|
|
gin_helper::Arguments* args) {
|
2021-03-16 16:18:45 +00:00
|
|
|
std::vector<std::u16string> format_types;
|
2013-04-30 08:10:25 +00:00
|
|
|
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
2020-07-22 05:34:34 +00:00
|
|
|
clipboard->ReadAvailableTypes(GetClipboardBuffer(args),
|
|
|
|
/* data_dst = */ nullptr, &format_types);
|
2015-05-22 09:29:11 +00:00
|
|
|
return format_types;
|
2013-04-30 08:10:25 +00:00
|
|
|
}
|
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
bool Clipboard::Has(const std::string& format_string,
|
|
|
|
gin_helper::Arguments* args) {
|
2015-05-27 08:05:51 +00:00
|
|
|
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
2019-02-04 09:08:36 +00:00
|
|
|
ui::ClipboardFormatType format(
|
|
|
|
ui::ClipboardFormatType::GetType(format_string));
|
2021-07-06 12:17:13 +00:00
|
|
|
if (format.GetName().empty())
|
2021-08-24 00:52:17 +00:00
|
|
|
format = ui::ClipboardFormatType::CustomPlatformType(format_string);
|
2020-07-22 05:34:34 +00:00
|
|
|
return clipboard->IsFormatAvailable(format, GetClipboardBuffer(args),
|
|
|
|
/* data_dst = */ nullptr);
|
2015-05-27 08:05:51 +00:00
|
|
|
}
|
|
|
|
|
2017-03-17 16:58:35 +00:00
|
|
|
std::string Clipboard::Read(const std::string& format_string) {
|
2013-04-30 08:10:25 +00:00
|
|
|
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
2021-11-04 18:19:30 +00:00
|
|
|
// Prefer raw platform format names
|
|
|
|
ui::ClipboardFormatType rawFormat(
|
|
|
|
ui::ClipboardFormatType::CustomPlatformType(format_string));
|
|
|
|
bool rawFormatAvailable = clipboard->IsFormatAvailable(
|
|
|
|
rawFormat, ui::ClipboardBuffer::kCopyPaste, /* data_dst = */ nullptr);
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_LINUX)
|
2021-11-04 18:19:30 +00:00
|
|
|
if (!rawFormatAvailable) {
|
|
|
|
rawFormatAvailable = clipboard->IsFormatAvailable(
|
|
|
|
rawFormat, ui::ClipboardBuffer::kSelection, /* data_dst = */ nullptr);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
if (rawFormatAvailable) {
|
|
|
|
std::string data;
|
|
|
|
clipboard->ReadData(rawFormat, /* data_dst = */ nullptr, &data);
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
// Otherwise, resolve custom format names
|
2021-08-24 00:52:17 +00:00
|
|
|
std::map<std::string, std::string> custom_format_names;
|
|
|
|
custom_format_names =
|
|
|
|
clipboard->ExtractCustomPlatformNames(ui::ClipboardBuffer::kCopyPaste,
|
|
|
|
/* data_dst = */ nullptr);
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_LINUX)
|
2023-05-30 08:28:43 +00:00
|
|
|
if (!base::Contains(custom_format_names, format_string)) {
|
2021-08-24 00:52:17 +00:00
|
|
|
custom_format_names =
|
|
|
|
clipboard->ExtractCustomPlatformNames(ui::ClipboardBuffer::kSelection,
|
|
|
|
/* data_dst = */ nullptr);
|
|
|
|
}
|
|
|
|
#endif
|
2013-04-30 08:10:25 +00:00
|
|
|
|
2021-11-01 14:00:36 +00:00
|
|
|
ui::ClipboardFormatType format;
|
2023-05-30 08:28:43 +00:00
|
|
|
if (base::Contains(custom_format_names, format_string)) {
|
2021-11-01 14:00:36 +00:00
|
|
|
format =
|
|
|
|
ui::ClipboardFormatType(ui::ClipboardFormatType::CustomPlatformType(
|
|
|
|
custom_format_names[format_string]));
|
|
|
|
} else {
|
|
|
|
format = ui::ClipboardFormatType(
|
|
|
|
ui::ClipboardFormatType::CustomPlatformType(format_string));
|
|
|
|
}
|
2013-04-30 08:10:25 +00:00
|
|
|
std::string data;
|
2020-07-22 05:34:34 +00:00
|
|
|
clipboard->ReadData(format, /* data_dst = */ nullptr, &data);
|
2021-11-01 14:00:36 +00:00
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
v8::Local<v8::Value> Clipboard::ReadBuffer(const std::string& format_string,
|
|
|
|
gin_helper::Arguments* args) {
|
|
|
|
std::string data = Read(format_string);
|
2018-04-16 19:08:17 +00:00
|
|
|
return node::Buffer::Copy(args->isolate(), data.data(), data.length())
|
|
|
|
.ToLocalChecked();
|
2017-03-16 22:42:23 +00:00
|
|
|
}
|
|
|
|
|
2017-05-22 20:53:58 +00:00
|
|
|
void Clipboard::WriteBuffer(const std::string& format,
|
2017-04-21 05:47:04 +00:00
|
|
|
const v8::Local<v8::Value> buffer,
|
2019-10-31 07:56:00 +00:00
|
|
|
gin_helper::Arguments* args) {
|
2017-05-22 20:53:58 +00:00
|
|
|
if (!node::Buffer::HasInstance(buffer)) {
|
|
|
|
args->ThrowError("buffer must be a node Buffer");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2019-08-24 01:14:23 +00:00
|
|
|
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
2019-10-28 22:12:35 +00:00
|
|
|
base::span<const uint8_t> payload_span(
|
|
|
|
reinterpret_cast<const uint8_t*>(node::Buffer::Data(buffer)),
|
|
|
|
node::Buffer::Length(buffer));
|
2021-11-04 18:19:30 +00:00
|
|
|
writer.WriteUnsafeRawData(base::UTF8ToUTF16(format),
|
|
|
|
mojo_base::BigBuffer(payload_span));
|
2017-04-21 05:47:04 +00:00
|
|
|
}
|
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
void Clipboard::Write(const gin_helper::Dictionary& data,
|
|
|
|
gin_helper::Arguments* args) {
|
2019-08-24 01:14:23 +00:00
|
|
|
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
2021-03-16 16:18:45 +00:00
|
|
|
std::u16string text, html, bookmark;
|
2015-07-07 05:17:33 +00:00
|
|
|
gfx::Image image;
|
|
|
|
|
2016-06-24 22:14:28 +00:00
|
|
|
if (data.Get("text", &text)) {
|
2015-07-07 05:17:33 +00:00
|
|
|
writer.WriteText(text);
|
|
|
|
|
2016-06-24 22:14:28 +00:00
|
|
|
if (data.Get("bookmark", &bookmark))
|
|
|
|
writer.WriteBookmark(bookmark, base::UTF16ToUTF8(text));
|
|
|
|
}
|
|
|
|
|
2016-02-04 18:38:47 +00:00
|
|
|
if (data.Get("rtf", &text)) {
|
|
|
|
std::string rtf = base::UTF16ToUTF8(text);
|
|
|
|
writer.WriteRTF(rtf);
|
|
|
|
}
|
|
|
|
|
2015-07-07 05:17:33 +00:00
|
|
|
if (data.Get("html", &html))
|
2024-01-31 23:04:13 +00:00
|
|
|
writer.WriteHTML(html, std::string());
|
2015-07-07 05:17:33 +00:00
|
|
|
|
|
|
|
if (data.Get("image", &image))
|
|
|
|
writer.WriteImage(image.AsBitmap());
|
|
|
|
}
|
|
|
|
|
2021-03-16 16:18:45 +00:00
|
|
|
std::u16string Clipboard::ReadText(gin_helper::Arguments* args) {
|
|
|
|
std::u16string data;
|
2015-07-07 05:17:33 +00:00
|
|
|
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
2019-08-24 01:14:23 +00:00
|
|
|
auto type = GetClipboardBuffer(args);
|
2021-07-26 16:02:16 +00:00
|
|
|
if (clipboard->IsFormatAvailable(ui::ClipboardFormatType::PlainTextType(),
|
2020-07-22 05:34:34 +00:00
|
|
|
type, /* data_dst = */ nullptr)) {
|
|
|
|
clipboard->ReadText(type, /* data_dst = */ nullptr, &data);
|
2020-01-17 18:41:52 +00:00
|
|
|
} else {
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_WIN)
|
2021-07-26 16:02:16 +00:00
|
|
|
if (clipboard->IsFormatAvailable(ui::ClipboardFormatType::PlainTextAType(),
|
|
|
|
type,
|
|
|
|
/* data_dst = */ nullptr)) {
|
2020-01-17 18:41:52 +00:00
|
|
|
std::string result;
|
2020-07-22 05:34:34 +00:00
|
|
|
clipboard->ReadAsciiText(type, /* data_dst = */ nullptr, &result);
|
2020-01-17 18:41:52 +00:00
|
|
|
data = base::ASCIIToUTF16(result);
|
|
|
|
}
|
|
|
|
#endif
|
2015-07-07 05:17:33 +00:00
|
|
|
}
|
2014-04-15 07:50:00 +00:00
|
|
|
return data;
|
2013-04-30 08:10:25 +00:00
|
|
|
}
|
|
|
|
|
2021-03-16 16:18:45 +00:00
|
|
|
void Clipboard::WriteText(const std::u16string& text,
|
2019-10-31 07:56:00 +00:00
|
|
|
gin_helper::Arguments* args) {
|
2019-08-24 01:14:23 +00:00
|
|
|
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
2014-06-28 14:33:00 +00:00
|
|
|
writer.WriteText(text);
|
2013-04-30 08:10:25 +00:00
|
|
|
}
|
|
|
|
|
2021-03-16 16:18:45 +00:00
|
|
|
std::u16string Clipboard::ReadRTF(gin_helper::Arguments* args) {
|
2016-02-05 08:06:21 +00:00
|
|
|
std::string data;
|
|
|
|
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
2020-07-22 05:34:34 +00:00
|
|
|
clipboard->ReadRTF(GetClipboardBuffer(args), /* data_dst = */ nullptr, &data);
|
2016-02-05 08:06:21 +00:00
|
|
|
return base::UTF8ToUTF16(data);
|
|
|
|
}
|
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
void Clipboard::WriteRTF(const std::string& text, gin_helper::Arguments* args) {
|
2019-08-24 01:14:23 +00:00
|
|
|
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
2016-02-04 18:38:47 +00:00
|
|
|
writer.WriteRTF(text);
|
|
|
|
}
|
|
|
|
|
2021-03-16 16:18:45 +00:00
|
|
|
std::u16string Clipboard::ReadHTML(gin_helper::Arguments* args) {
|
|
|
|
std::u16string data;
|
|
|
|
std::u16string html;
|
2015-05-22 09:29:11 +00:00
|
|
|
std::string url;
|
2016-03-08 04:40:10 +00:00
|
|
|
uint32_t start;
|
|
|
|
uint32_t end;
|
2015-06-10 04:12:37 +00:00
|
|
|
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
2020-07-22 05:34:34 +00:00
|
|
|
clipboard->ReadHTML(GetClipboardBuffer(args), /* data_dst = */ nullptr, &html,
|
|
|
|
&url, &start, &end);
|
2015-05-22 09:29:11 +00:00
|
|
|
data = html.substr(start, end - start);
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
2021-03-16 16:18:45 +00:00
|
|
|
void Clipboard::WriteHTML(const std::u16string& html,
|
2019-10-31 07:56:00 +00:00
|
|
|
gin_helper::Arguments* args) {
|
2019-08-24 01:14:23 +00:00
|
|
|
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
2024-01-31 23:04:13 +00:00
|
|
|
writer.WriteHTML(html, std::string());
|
2015-05-22 09:29:11 +00:00
|
|
|
}
|
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
v8::Local<v8::Value> Clipboard::ReadBookmark(gin_helper::Arguments* args) {
|
2021-03-16 16:18:45 +00:00
|
|
|
std::u16string title;
|
2016-06-24 22:08:12 +00:00
|
|
|
std::string url;
|
2023-10-10 10:45:44 +00:00
|
|
|
auto dict = gin_helper::Dictionary::CreateEmpty(args->isolate());
|
2016-06-24 22:08:12 +00:00
|
|
|
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
2020-07-22 05:34:34 +00:00
|
|
|
clipboard->ReadBookmark(/* data_dst = */ nullptr, &title, &url);
|
2016-06-24 22:08:12 +00:00
|
|
|
dict.Set("title", title);
|
|
|
|
dict.Set("url", url);
|
|
|
|
return dict.GetHandle();
|
|
|
|
}
|
|
|
|
|
2021-03-16 16:18:45 +00:00
|
|
|
void Clipboard::WriteBookmark(const std::u16string& title,
|
2016-10-24 08:13:34 +00:00
|
|
|
const std::string& url,
|
2019-10-31 07:56:00 +00:00
|
|
|
gin_helper::Arguments* args) {
|
2019-08-24 01:14:23 +00:00
|
|
|
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
2016-06-24 22:08:12 +00:00
|
|
|
writer.WriteBookmark(title, url);
|
|
|
|
}
|
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
gfx::Image Clipboard::ReadImage(gin_helper::Arguments* args) {
|
2023-08-14 08:35:37 +00:00
|
|
|
// The ReadPng uses thread pool which requires app ready.
|
|
|
|
if (IsBrowserProcess() && !Browser::Get()->is_ready()) {
|
|
|
|
args->ThrowError(
|
|
|
|
"clipboard.readImage is available only after app ready in the main "
|
|
|
|
"process");
|
|
|
|
return gfx::Image();
|
|
|
|
}
|
|
|
|
|
2015-06-10 04:12:37 +00:00
|
|
|
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
2024-01-10 22:23:35 +00:00
|
|
|
std::optional<gfx::Image> image;
|
2023-07-13 20:59:14 +00:00
|
|
|
|
2023-08-14 08:35:37 +00:00
|
|
|
base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
|
2023-07-13 20:59:14 +00:00
|
|
|
base::RepeatingClosure callback = run_loop.QuitClosure();
|
2021-10-21 18:51:36 +00:00
|
|
|
clipboard->ReadPng(
|
2020-04-13 23:39:26 +00:00
|
|
|
GetClipboardBuffer(args),
|
2020-07-22 05:34:34 +00:00
|
|
|
/* data_dst = */ nullptr,
|
2021-01-25 01:27:40 +00:00
|
|
|
base::BindOnce(
|
2024-01-10 22:23:35 +00:00
|
|
|
[](std::optional<gfx::Image>* image, base::RepeatingClosure cb,
|
2021-10-21 18:51:36 +00:00
|
|
|
const std::vector<uint8_t>& result) {
|
|
|
|
SkBitmap bitmap;
|
|
|
|
gfx::PNGCodec::Decode(result.data(), result.size(), &bitmap);
|
|
|
|
image->emplace(gfx::Image::CreateFrom1xBitmap(bitmap));
|
2023-07-13 20:59:14 +00:00
|
|
|
std::move(cb).Run();
|
2020-04-13 23:39:26 +00:00
|
|
|
},
|
2023-07-13 20:59:14 +00:00
|
|
|
&image, std::move(callback)));
|
|
|
|
run_loop.Run();
|
|
|
|
|
2020-04-13 23:39:26 +00:00
|
|
|
DCHECK(image.has_value());
|
|
|
|
return image.value();
|
2015-02-11 06:55:44 +00:00
|
|
|
}
|
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
void Clipboard::WriteImage(const gfx::Image& image,
|
|
|
|
gin_helper::Arguments* args) {
|
2019-08-24 01:14:23 +00:00
|
|
|
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
2017-09-14 22:53:32 +00:00
|
|
|
SkBitmap orig = image.AsBitmap();
|
2017-08-08 10:02:20 +00:00
|
|
|
SkBitmap bmp;
|
2017-09-14 22:53:32 +00:00
|
|
|
|
2018-04-16 16:14:35 +00:00
|
|
|
if (bmp.tryAllocPixels(orig.info()) &&
|
2018-04-16 19:08:17 +00:00
|
|
|
orig.readPixels(bmp.info(), bmp.getPixels(), bmp.rowBytes(), 0, 0)) {
|
2018-04-16 16:14:35 +00:00
|
|
|
writer.WriteImage(bmp);
|
2017-06-29 13:11:57 +00:00
|
|
|
}
|
2015-03-26 04:54:15 +00:00
|
|
|
}
|
|
|
|
|
2022-02-10 02:58:52 +00:00
|
|
|
#if !BUILDFLAG(IS_MAC)
|
2021-03-16 16:18:45 +00:00
|
|
|
void Clipboard::WriteFindText(const std::u16string& text) {}
|
|
|
|
std::u16string Clipboard::ReadFindText() {
|
|
|
|
return std::u16string();
|
2018-04-16 19:08:17 +00:00
|
|
|
}
|
2016-10-24 08:13:34 +00:00
|
|
|
#endif
|
|
|
|
|
2019-10-31 07:56:00 +00:00
|
|
|
void Clipboard::Clear(gin_helper::Arguments* args) {
|
2019-08-24 01:14:23 +00:00
|
|
|
ui::Clipboard::GetForCurrentThread()->Clear(GetClipboardBuffer(args));
|
2013-04-30 08:10:25 +00:00
|
|
|
}
|
|
|
|
|
2024-04-10 20:06:47 +00:00
|
|
|
// This exists for testing purposes ONLY.
|
|
|
|
void Clipboard::WriteFilesForTesting(const std::vector<base::FilePath>& files) {
|
|
|
|
std::vector<ui::FileInfo> file_infos;
|
|
|
|
for (const auto& file : files) {
|
|
|
|
file_infos.emplace_back(ui::FileInfo(ui::FileInfo(file, file.BaseName())));
|
|
|
|
}
|
|
|
|
|
|
|
|
ui::ScopedClipboardWriter writer(ui::ClipboardBuffer::kCopyPaste);
|
|
|
|
writer.WriteFilenames(ui::FileInfosToURIList(file_infos));
|
|
|
|
}
|
|
|
|
|
2022-06-29 19:55:47 +00:00
|
|
|
} // namespace electron::api
|
2016-10-24 08:13:34 +00:00
|
|
|
|
|
|
|
namespace {
|
|
|
|
|
2018-04-16 19:08:17 +00:00
|
|
|
void Initialize(v8::Local<v8::Object> exports,
|
|
|
|
v8::Local<v8::Value> unused,
|
|
|
|
v8::Local<v8::Context> context,
|
|
|
|
void* priv) {
|
2019-10-31 07:56:00 +00:00
|
|
|
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
2016-10-24 08:13:34 +00:00
|
|
|
dict.SetMethod("availableFormats",
|
|
|
|
&electron::api::Clipboard::AvailableFormats);
|
|
|
|
dict.SetMethod("has", &electron::api::Clipboard::Has);
|
|
|
|
dict.SetMethod("read", &electron::api::Clipboard::Read);
|
|
|
|
dict.SetMethod("write", &electron::api::Clipboard::Write);
|
|
|
|
dict.SetMethod("readText", &electron::api::Clipboard::ReadText);
|
|
|
|
dict.SetMethod("writeText", &electron::api::Clipboard::WriteText);
|
2018-02-20 13:41:58 +00:00
|
|
|
dict.SetMethod("readRTF", &electron::api::Clipboard::ReadRTF);
|
|
|
|
dict.SetMethod("writeRTF", &electron::api::Clipboard::WriteRTF);
|
|
|
|
dict.SetMethod("readHTML", &electron::api::Clipboard::ReadHTML);
|
|
|
|
dict.SetMethod("writeHTML", &electron::api::Clipboard::WriteHTML);
|
2016-10-24 08:13:34 +00:00
|
|
|
dict.SetMethod("readBookmark", &electron::api::Clipboard::ReadBookmark);
|
|
|
|
dict.SetMethod("writeBookmark", &electron::api::Clipboard::WriteBookmark);
|
|
|
|
dict.SetMethod("readImage", &electron::api::Clipboard::ReadImage);
|
|
|
|
dict.SetMethod("writeImage", &electron::api::Clipboard::WriteImage);
|
|
|
|
dict.SetMethod("readFindText", &electron::api::Clipboard::ReadFindText);
|
|
|
|
dict.SetMethod("writeFindText", &electron::api::Clipboard::WriteFindText);
|
2017-03-16 22:42:23 +00:00
|
|
|
dict.SetMethod("readBuffer", &electron::api::Clipboard::ReadBuffer);
|
2017-04-21 05:47:04 +00:00
|
|
|
dict.SetMethod("writeBuffer", &electron::api::Clipboard::WriteBuffer);
|
2024-04-10 20:06:47 +00:00
|
|
|
dict.SetMethod("_writeFilesForTesting",
|
|
|
|
&electron::api::Clipboard::WriteFilesForTesting);
|
2016-10-24 08:13:34 +00:00
|
|
|
dict.SetMethod("clear", &electron::api::Clipboard::Clear);
|
2013-04-30 08:10:25 +00:00
|
|
|
}
|
|
|
|
|
2014-04-15 07:50:00 +00:00
|
|
|
} // namespace
|
2013-04-30 08:10:25 +00:00
|
|
|
|
2023-02-09 01:31:38 +00:00
|
|
|
NODE_LINKED_BINDING_CONTEXT_AWARE(electron_common_clipboard, Initialize)
|