diff --git a/atom/browser/api/atom_api_web_contents.cc b/atom/browser/api/atom_api_web_contents.cc index c33b9f1d9bd..59cdf746ab1 100644 --- a/atom/browser/api/atom_api_web_contents.cc +++ b/atom/browser/api/atom_api_web_contents.cc @@ -1094,6 +1094,16 @@ void WebContents::StopFindInPage(content::StopFindAction action) { web_contents()->StopFinding(action); } +void WebContents::ShowDefinitionForSelection() { +#if defined(OS_WIN) + const auto view = web_contents()->GetRenderWidgetHostView(); + if (view) + view->ShowDefinitionForSelection(); +#else + NOTIMPLEMENTED(); +#endif +} + void WebContents::Focus() { web_contents()->Focus(); } @@ -1289,6 +1299,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate, .SetMethod("_printToPDF", &WebContents::PrintToPDF) .SetMethod("addWorkSpace", &WebContents::AddWorkSpace) .SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace) + .SetMethod("showDefinitionForSelection", &WebContents::ShowDefinitionForSelection) .SetProperty("id", &WebContents::ID) .SetProperty("session", &WebContents::Session) .SetProperty("hostWebContents", &WebContents::HostWebContents) diff --git a/atom/browser/api/atom_api_web_contents.h b/atom/browser/api/atom_api_web_contents.h index dfaac8791fb..f8e6710a5c5 100644 --- a/atom/browser/api/atom_api_web_contents.h +++ b/atom/browser/api/atom_api_web_contents.h @@ -116,6 +116,7 @@ class WebContents : public mate::TrackableObject, void ReplaceMisspelling(const base::string16& word); uint32_t FindInPage(mate::Arguments* args); void StopFindInPage(content::StopFindAction action); + void ShowDefinitionForSelection(); // Focus. void Focus(); diff --git a/lib/renderer/web-view/web-view.js b/lib/renderer/web-view/web-view.js index e9d300aabbc..82ed62dd3a5 100644 --- a/lib/renderer/web-view/web-view.js +++ b/lib/renderer/web-view/web-view.js @@ -379,7 +379,8 @@ var registerWebViewElement = function () { 'downloadURL', 'inspectServiceWorker', 'print', - 'printToPDF' + 'printToPDF', + 'showDefinitionForSelection' ] nonblockMethods = [ 'insertCSS',