#include <string>
#include <vector>
+#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "native_mate/dictionary.h"
+#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/clipboard/scoped_clipboard_writer.h"
+#include "ui/gfx/image/image.h"
#include "atom/common/node_includes.h"
template<>
struct Converter<ui::ClipboardType> {
- static bool FromV8(v8::Isolate* isolate,
- v8::Handle<v8::Value> val,
+ static bool FromV8(v8::Isolate* isolate, v8::Handle<v8::Value> val,
ui::ClipboardType* out) {
std::string type;
if (!Converter<std::string>::FromV8(isolate, val, &type))
writer.WriteText(text);
}
+gfx::Image ReadImage(ui::ClipboardType type) {
+ SkBitmap bitmap = ui::Clipboard::GetForCurrentThread()->ReadImage(type);
+ return gfx::Image::CreateFrom1xBitmap(bitmap);
+}
+
void Clear(ui::ClipboardType type) {
ui::Clipboard::GetForCurrentThread()->Clear(type);
}
dict.SetMethod("_read", &Read);
dict.SetMethod("_readText", &ReadText);
dict.SetMethod("_writeText", &WriteText);
+ dict.SetMethod("_readImage", &ReadImage);
dict.SetMethod("_clear", &Clear);
}
read: (format, type='standard') -> binding._read format, type
readText: (type='standard') -> binding._readText type
writeText: (text, type='standard') -> binding._writeText text, type
+ readImage: (type='standard') -> binding._readImage type
clear: (type='standard') -> binding._clear type