Add clipboard.writeImage API

This commit is contained in:
Cheng Zhao 2015-03-26 12:54:15 +08:00
parent 0bb7abd7a4
commit 6f082b630d
2 changed files with 7 additions and 0 deletions

View file

@ -69,6 +69,11 @@ gfx::Image ReadImage(ui::ClipboardType type) {
return gfx::Image::CreateFrom1xBitmap(bitmap);
}
void WriteImage(const gfx::Image& image, ui::ClipboardType type) {
ui::ScopedClipboardWriter writer(type);
writer.WriteImage(image.AsBitmap());
}
void Clear(ui::ClipboardType type) {
ui::Clipboard::GetForCurrentThread()->Clear(type);
}
@ -81,6 +86,7 @@ void Initialize(v8::Handle<v8::Object> exports, v8::Handle<v8::Value> unused,
dict.SetMethod("_readText", &ReadText);
dict.SetMethod("_writeText", &WriteText);
dict.SetMethod("_readImage", &ReadImage);
dict.SetMethod("_writeImage", &WriteImage);
dict.SetMethod("_clear", &Clear);
}

View file

@ -10,4 +10,5 @@ else
readText: (type='standard') -> binding._readText type
writeText: (text, type='standard') -> binding._writeText text, type
readImage: (type='standard') -> binding._readImage type
writeImage: (image, type='standard') -> binding._writeImage image, type
clear: (type='standard') -> binding._clear type