Support reading/writing bookmarks to clipboard
This commit is contained in:
parent
6ea59803a8
commit
271808b278
1 changed files with 19 additions and 0 deletions
|
@ -122,6 +122,23 @@ void WriteHtml(const base::string16& html, mate::Arguments* args) {
|
|||
writer.WriteHTML(html, std::string());
|
||||
}
|
||||
|
||||
v8::Local<v8::Value> ReadBookmark(mate::Arguments* args) {
|
||||
base::string16 title;
|
||||
std::string url;
|
||||
mate::Dictionary dict = mate::Dictionary::CreateEmpty(args->isolate());
|
||||
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
||||
clipboard->ReadBookmark(&title, &url);
|
||||
dict.Set("title", title);
|
||||
dict.Set("url", url);
|
||||
return dict.GetHandle();
|
||||
}
|
||||
|
||||
void WriteBookmark(const base::string16& title, const std::string& url,
|
||||
mate::Arguments* args) {
|
||||
ui::ScopedClipboardWriter writer(GetClipboardType(args));
|
||||
writer.WriteBookmark(title, url);
|
||||
}
|
||||
|
||||
gfx::Image ReadImage(mate::Arguments* args) {
|
||||
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
||||
SkBitmap bitmap = clipboard->ReadImage(GetClipboardType(args));
|
||||
|
@ -150,6 +167,8 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
dict.SetMethod("writeRTF", &WriteRtf);
|
||||
dict.SetMethod("readHTML", &ReadHtml);
|
||||
dict.SetMethod("writeHTML", &WriteHtml);
|
||||
dict.SetMethod("readBookmark", &ReadBookmark);
|
||||
dict.SetMethod("writeBookmark", &WriteBookmark);
|
||||
dict.SetMethod("readImage", &ReadImage);
|
||||
dict.SetMethod("writeImage", &WriteImage);
|
||||
dict.SetMethod("clear", &Clear);
|
||||
|
|
Loading…
Reference in a new issue