Add showDefinitionForSelection to webContents/webview

This commit is contained in:
Kevin Sawicki 2016-06-02 10:12:38 -07:00
parent b2bea57eff
commit 4f0a52628e
3 changed files with 14 additions and 1 deletions

View file

@ -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)

View file

@ -116,6 +116,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
void ReplaceMisspelling(const base::string16& word);
uint32_t FindInPage(mate::Arguments* args);
void StopFindInPage(content::StopFindAction action);
void ShowDefinitionForSelection();
// Focus.
void Focus();

View file

@ -379,7 +379,8 @@ var registerWebViewElement = function () {
'downloadURL',
'inspectServiceWorker',
'print',
'printToPDF'
'printToPDF',
'showDefinitionForSelection'
]
nonblockMethods = [
'insertCSS',