diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index 1042e4080d3..0083ac71eb9 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1146,6 +1146,12 @@ void WebContents::ShowDefinitionForSelection() { #endif } +void WebContents::CopyImageAt(int x, int y) { + const auto host = web_contents()->GetRenderViewHost(); + if (host) + host->CopyImageAt(x, y); +} + void WebContents::Focus() { web_contents()->Focus(); } @@ -1425,6 +1431,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate, .SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace) .SetMethod("showDefinitionForSelection", &WebContents::ShowDefinitionForSelection) + .SetMethod("copyImageAt", &WebContents::CopyImageAt) .SetMethod("capturePage", &WebContents::CapturePage) .SetMethod("isFocused", &WebContents::IsFocused) .SetProperty("id", &WebContents::ID) diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index f55ab9ca441..381f3770d39 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -126,6 +126,7 @@ class WebContents : public mate::TrackableObject, uint32_t FindInPage(mate::Arguments* args); void StopFindInPage(content::StopFindAction action); void ShowDefinitionForSelection(); + void CopyImageAt(int x, int y); // Focus. void Focus();