Add webContents.isFocused()
This commit is contained in:
parent
6d2e633c82
commit
7877fa7c0a
5 changed files with 43 additions and 0 deletions
|
@ -789,6 +789,13 @@ WebContents::Type WebContents::GetType() const {
|
|||
return type_;
|
||||
}
|
||||
|
||||
#if !defined(OS_MACOSX)
|
||||
bool WebContents::IsFocused() const {
|
||||
auto view = web_contents()->GetRenderWidgetHostView();
|
||||
return view && view->HasFocus();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool WebContents::Equal(const WebContents* web_contents) const {
|
||||
return GetID() == web_contents->GetID();
|
||||
}
|
||||
|
@ -1418,6 +1425,7 @@ void WebContents::BuildPrototype(v8::Isolate* isolate,
|
|||
.SetMethod("showDefinitionForSelection",
|
||||
&WebContents::ShowDefinitionForSelection)
|
||||
.SetMethod("capturePage", &WebContents::CapturePage)
|
||||
.SetMethod("isFocused", &WebContents::IsFocused)
|
||||
.SetProperty("id", &WebContents::ID)
|
||||
.SetProperty("session", &WebContents::Session)
|
||||
.SetProperty("hostWebContents", &WebContents::HostWebContents)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue