Add showDefinitionForSelection to webContents/webview
This commit is contained in:
parent
b2bea57eff
commit
4f0a52628e
3 changed files with 14 additions and 1 deletions
|
@ -1094,6 +1094,16 @@ void WebContents::StopFindInPage(content::StopFindAction action) {
|
||||||
web_contents()->StopFinding(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() {
|
void WebContents::Focus() {
|
||||||
web_contents()->Focus();
|
web_contents()->Focus();
|
||||||
}
|
}
|
||||||
|
@ -1289,6 +1299,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
|
||||||
.SetMethod("_printToPDF", &WebContents::PrintToPDF)
|
.SetMethod("_printToPDF", &WebContents::PrintToPDF)
|
||||||
.SetMethod("addWorkSpace", &WebContents::AddWorkSpace)
|
.SetMethod("addWorkSpace", &WebContents::AddWorkSpace)
|
||||||
.SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
|
.SetMethod("removeWorkSpace", &WebContents::RemoveWorkSpace)
|
||||||
|
.SetMethod("showDefinitionForSelection", &WebContents::ShowDefinitionForSelection)
|
||||||
.SetProperty("id", &WebContents::ID)
|
.SetProperty("id", &WebContents::ID)
|
||||||
.SetProperty("session", &WebContents::Session)
|
.SetProperty("session", &WebContents::Session)
|
||||||
.SetProperty("hostWebContents", &WebContents::HostWebContents)
|
.SetProperty("hostWebContents", &WebContents::HostWebContents)
|
||||||
|
|
|
@ -116,6 +116,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
|
||||||
void ReplaceMisspelling(const base::string16& word);
|
void ReplaceMisspelling(const base::string16& word);
|
||||||
uint32_t FindInPage(mate::Arguments* args);
|
uint32_t FindInPage(mate::Arguments* args);
|
||||||
void StopFindInPage(content::StopFindAction action);
|
void StopFindInPage(content::StopFindAction action);
|
||||||
|
void ShowDefinitionForSelection();
|
||||||
|
|
||||||
// Focus.
|
// Focus.
|
||||||
void Focus();
|
void Focus();
|
||||||
|
|
|
@ -379,7 +379,8 @@ var registerWebViewElement = function () {
|
||||||
'downloadURL',
|
'downloadURL',
|
||||||
'inspectServiceWorker',
|
'inspectServiceWorker',
|
||||||
'print',
|
'print',
|
||||||
'printToPDF'
|
'printToPDF',
|
||||||
|
'showDefinitionForSelection'
|
||||||
]
|
]
|
||||||
nonblockMethods = [
|
nonblockMethods = [
|
||||||
'insertCSS',
|
'insertCSS',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue