From eea4e60b7320dc498c14be06478f93875ca6112a Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Tue, 6 Mar 2018 15:10:44 +0900 Subject: [PATCH] Remove NativeWindow's webview APIs --- atom/browser/api/atom_api_browser_window.cc | 7 ++++--- atom/browser/native_window.cc | 13 ------------- atom/browser/native_window.h | 5 ----- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/atom/browser/api/atom_api_browser_window.cc b/atom/browser/api/atom_api_browser_window.cc index 5c21634b1d3b..0f8eb04a2006 100644 --- a/atom/browser/api/atom_api_browser_window.cc +++ b/atom/browser/api/atom_api_browser_window.cc @@ -803,15 +803,16 @@ double BrowserWindow::GetOpacity() { } void BrowserWindow::FocusOnWebView() { - window_->FocusOnWebView(); + web_contents()->GetRenderViewHost()->GetWidget()->Focus(); } void BrowserWindow::BlurWebView() { - window_->BlurWebView(); + web_contents()->GetRenderViewHost()->GetWidget()->Blur(); } bool BrowserWindow::IsWebViewFocused() { - return window_->IsWebViewFocused(); + auto host_view = web_contents()->GetRenderViewHost()->GetWidget()->GetView(); + return host_view && host_view->HasFocus(); } void BrowserWindow::SetRepresentedFilename(const std::string& filename) { diff --git a/atom/browser/native_window.cc b/atom/browser/native_window.cc index 6251a181aab3..c4bc75c6db3b 100644 --- a/atom/browser/native_window.cc +++ b/atom/browser/native_window.cc @@ -354,19 +354,6 @@ void NativeWindow::SetEscapeTouchBarItem( const mate::PersistentDictionary& item) { } -void NativeWindow::FocusOnWebView() { - web_contents()->GetRenderViewHost()->GetWidget()->Focus(); -} - -void NativeWindow::BlurWebView() { - web_contents()->GetRenderViewHost()->GetWidget()->Blur(); -} - -bool NativeWindow::IsWebViewFocused() { - auto host_view = web_contents()->GetRenderViewHost()->GetWidget()->GetView(); - return host_view && host_view->HasFocus(); -} - void NativeWindow::SetAutoHideMenuBar(bool auto_hide) { } diff --git a/atom/browser/native_window.h b/atom/browser/native_window.h index 87276facb346..491bc51d0ad8 100644 --- a/atom/browser/native_window.h +++ b/atom/browser/native_window.h @@ -194,11 +194,6 @@ class NativeWindow : public base::SupportsUserData, virtual void ToggleTabBar(); virtual bool AddTabbedWindow(NativeWindow* window); - // Webview APIs. - virtual void FocusOnWebView(); - virtual void BlurWebView(); - virtual bool IsWebViewFocused(); - // Toggle the menu bar. virtual void SetAutoHideMenuBar(bool auto_hide); virtual bool IsMenuBarAutoHide();