Merge pull request #11973 from electron/remove-clipboard-methods

Remove html/rtf methods marked for 2.0
This commit is contained in:
shelley vohr 2018-02-20 11:21:10 -05:00 committed by GitHub
commit 6a3fde6e20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 18 deletions

View file

@ -149,19 +149,19 @@ void Clipboard::WriteText(const base::string16& text, mate::Arguments* args) {
writer.WriteText(text); writer.WriteText(text);
} }
base::string16 Clipboard::ReadRtf(mate::Arguments* args) { base::string16 Clipboard::ReadRTF(mate::Arguments* args) {
std::string data; std::string data;
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread(); ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
clipboard->ReadRTF(GetClipboardType(args), &data); clipboard->ReadRTF(GetClipboardType(args), &data);
return base::UTF8ToUTF16(data); return base::UTF8ToUTF16(data);
} }
void Clipboard::WriteRtf(const std::string& text, mate::Arguments* args) { void Clipboard::WriteRTF(const std::string& text, mate::Arguments* args) {
ui::ScopedClipboardWriter writer(GetClipboardType(args)); ui::ScopedClipboardWriter writer(GetClipboardType(args));
writer.WriteRTF(text); writer.WriteRTF(text);
} }
base::string16 Clipboard::ReadHtml(mate::Arguments* args) { base::string16 Clipboard::ReadHTML(mate::Arguments* args) {
base::string16 data; base::string16 data;
base::string16 html; base::string16 html;
std::string url; std::string url;
@ -173,7 +173,7 @@ base::string16 Clipboard::ReadHtml(mate::Arguments* args) {
return data; return data;
} }
void Clipboard::WriteHtml(const base::string16& html, mate::Arguments* args) { void Clipboard::WriteHTML(const base::string16& html, mate::Arguments* args) {
ui::ScopedClipboardWriter writer(GetClipboardType(args)); ui::ScopedClipboardWriter writer(GetClipboardType(args));
writer.WriteHTML(html, std::string()); writer.WriteHTML(html, std::string());
} }
@ -238,10 +238,10 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
dict.SetMethod("write", &atom::api::Clipboard::Write); dict.SetMethod("write", &atom::api::Clipboard::Write);
dict.SetMethod("readText", &atom::api::Clipboard::ReadText); dict.SetMethod("readText", &atom::api::Clipboard::ReadText);
dict.SetMethod("writeText", &atom::api::Clipboard::WriteText); dict.SetMethod("writeText", &atom::api::Clipboard::WriteText);
dict.SetMethod("readRTF", &atom::api::Clipboard::ReadRtf); dict.SetMethod("readRTF", &atom::api::Clipboard::ReadRTF);
dict.SetMethod("writeRTF", &atom::api::Clipboard::WriteRtf); dict.SetMethod("writeRTF", &atom::api::Clipboard::WriteRTF);
dict.SetMethod("readHTML", &atom::api::Clipboard::ReadHtml); dict.SetMethod("readHTML", &atom::api::Clipboard::ReadHTML);
dict.SetMethod("writeHTML", &atom::api::Clipboard::WriteHtml); dict.SetMethod("writeHTML", &atom::api::Clipboard::WriteHTML);
dict.SetMethod("readBookmark", &atom::api::Clipboard::ReadBookmark); dict.SetMethod("readBookmark", &atom::api::Clipboard::ReadBookmark);
dict.SetMethod("writeBookmark", &atom::api::Clipboard::WriteBookmark); dict.SetMethod("writeBookmark", &atom::api::Clipboard::WriteBookmark);
dict.SetMethod("readImage", &atom::api::Clipboard::ReadImage); dict.SetMethod("readImage", &atom::api::Clipboard::ReadImage);
@ -251,12 +251,6 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
dict.SetMethod("readBuffer", &atom::api::Clipboard::ReadBuffer); dict.SetMethod("readBuffer", &atom::api::Clipboard::ReadBuffer);
dict.SetMethod("writeBuffer", &atom::api::Clipboard::WriteBuffer); dict.SetMethod("writeBuffer", &atom::api::Clipboard::WriteBuffer);
dict.SetMethod("clear", &atom::api::Clipboard::Clear); dict.SetMethod("clear", &atom::api::Clipboard::Clear);
// TODO(kevinsawicki): Remove in 2.0, deprecate before then with warnings
dict.SetMethod("readRtf", &atom::api::Clipboard::ReadRtf);
dict.SetMethod("writeRtf", &atom::api::Clipboard::WriteRtf);
dict.SetMethod("readHtml", &atom::api::Clipboard::ReadHtml);
dict.SetMethod("writeHtml", &atom::api::Clipboard::WriteHtml);
} }
} // namespace } // namespace

View file

@ -30,11 +30,11 @@ class Clipboard {
static base::string16 ReadText(mate::Arguments* args); static base::string16 ReadText(mate::Arguments* args);
static void WriteText(const base::string16& text, mate::Arguments* args); static void WriteText(const base::string16& text, mate::Arguments* args);
static base::string16 ReadRtf(mate::Arguments* args); static base::string16 ReadRTF(mate::Arguments* args);
static void WriteRtf(const std::string& text, mate::Arguments* args); static void WriteRTF(const std::string& text, mate::Arguments* args);
static base::string16 ReadHtml(mate::Arguments* args); static base::string16 ReadHTML(mate::Arguments* args);
static void WriteHtml(const base::string16& html, mate::Arguments* args); static void WriteHTML(const base::string16& html, mate::Arguments* args);
static v8::Local<v8::Value> ReadBookmark(mate::Arguments* args); static v8::Local<v8::Value> ReadBookmark(mate::Arguments* args);
static void WriteBookmark(const base::string16& title, static void WriteBookmark(const base::string16& title,