mirror of
https://github.com/cefsharp/CefSharp.git
synced 2026-12-04 19:25:01 +00:00
Start to remove some of the methods from ManagedCefBrowserAdapter that are now available through IBrowserHost
This commit is contained in:
@@ -69,46 +69,6 @@ void ManagedCefBrowserAdapter::OnAfterBrowserCreated(int browserId)
|
||||
}
|
||||
}
|
||||
|
||||
void ManagedCefBrowserAdapter::WasResized()
|
||||
{
|
||||
auto browser = _clientAdapter->GetCefBrowser();
|
||||
|
||||
if (browser != nullptr)
|
||||
{
|
||||
browser->GetHost()->WasResized();
|
||||
}
|
||||
}
|
||||
|
||||
void ManagedCefBrowserAdapter::WasHidden(bool hidden)
|
||||
{
|
||||
auto browser = _clientAdapter->GetCefBrowser();
|
||||
|
||||
if (browser != nullptr)
|
||||
{
|
||||
browser->GetHost()->WasHidden(hidden);
|
||||
}
|
||||
}
|
||||
|
||||
void ManagedCefBrowserAdapter::SendFocusEvent(bool isFocused)
|
||||
{
|
||||
auto browser = _clientAdapter->GetCefBrowser();
|
||||
|
||||
if (browser != nullptr)
|
||||
{
|
||||
browser->GetHost()->SendFocusEvent(isFocused);
|
||||
}
|
||||
}
|
||||
|
||||
void ManagedCefBrowserAdapter::SetFocus(bool isFocused)
|
||||
{
|
||||
auto browser = _clientAdapter->GetCefBrowser();
|
||||
|
||||
if (browser != nullptr)
|
||||
{
|
||||
browser->GetHost()->SetFocus(isFocused);
|
||||
}
|
||||
}
|
||||
|
||||
bool ManagedCefBrowserAdapter::SendKeyEvent(int message, int wParam, int lParam)
|
||||
{
|
||||
auto browser = _clientAdapter->GetCefBrowser();
|
||||
@@ -259,26 +219,6 @@ void ManagedCefBrowserAdapter::Resize(int width, int height)
|
||||
}
|
||||
}
|
||||
|
||||
void ManagedCefBrowserAdapter::NotifyMoveOrResizeStarted()
|
||||
{
|
||||
auto browser = _clientAdapter->GetCefBrowser();
|
||||
|
||||
if (browser != nullptr)
|
||||
{
|
||||
browser->GetHost()->NotifyMoveOrResizeStarted();
|
||||
}
|
||||
}
|
||||
|
||||
void ManagedCefBrowserAdapter::NotifyScreenInfoChanged()
|
||||
{
|
||||
auto browser = _clientAdapter->GetCefBrowser();
|
||||
|
||||
if (browser != nullptr)
|
||||
{
|
||||
browser->GetHost()->NotifyScreenInfoChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void ManagedCefBrowserAdapter::RegisterJsObject(String^ name, Object^ object, bool lowerCaseJavascriptNames)
|
||||
{
|
||||
if (!CefSharpSettings::WcfEnabled)
|
||||
|
||||
@@ -121,14 +121,8 @@ namespace CefSharp
|
||||
virtual void OnAfterBrowserCreated(int browserId);
|
||||
void CreateOffscreenBrowser(IntPtr windowHandle, BrowserSettings^ browserSettings, RequestContext^ requestContext, String^ address);
|
||||
void CreateBrowser(BrowserSettings^ browserSettings, RequestContext^ requestContext, IntPtr sourceHandle, String^ address);
|
||||
void WasResized();
|
||||
void WasHidden(bool hidden);
|
||||
void SendFocusEvent(bool isFocused);
|
||||
void SetFocus(bool isFocused);
|
||||
bool SendKeyEvent(int message, int wParam, int lParam);
|
||||
void Resize(int width, int height);
|
||||
void NotifyMoveOrResizeStarted();
|
||||
void NotifyScreenInfoChanged();
|
||||
void RegisterJsObject(String^ name, Object^ object, bool lowerCaseJavascriptNames);
|
||||
void RegisterAsyncJsObject(String^ name, Object^ object, bool lowerCaseJavascriptNames);
|
||||
void OnDragTargetDragEnter(CefDragDataWrapper^ dragData, MouseEvent^ mouseEvent, DragOperationsMask allowedOperations);
|
||||
|
||||
@@ -198,7 +198,10 @@ namespace CefSharp.OffScreen
|
||||
if (size != value)
|
||||
{
|
||||
size = value;
|
||||
managedCefBrowserAdapter.WasResized();
|
||||
|
||||
var browser = GetBrowser();
|
||||
|
||||
browser.GetHost().WasResized();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,18 +347,23 @@ namespace CefSharp.WinForms
|
||||
}
|
||||
}
|
||||
|
||||
[Obsolete("Use GetBrowser().GetHost().NotifyMoveOrResizeStarted() instead")]
|
||||
public void NotifyMoveOrResizeStarted()
|
||||
{
|
||||
this.ThrowExceptionIfBrowserNotInitialized();
|
||||
|
||||
managedCefBrowserAdapter.NotifyMoveOrResizeStarted();
|
||||
var browser = GetBrowser();
|
||||
if (browser != null)
|
||||
{
|
||||
browser.GetHost().NotifyMoveOrResizeStarted();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnGotFocus(EventArgs e)
|
||||
{
|
||||
if (IsBrowserInitialized)
|
||||
{
|
||||
SetFocus(true);
|
||||
GetBrowser().GetHost().SetFocus(true);
|
||||
}
|
||||
|
||||
base.OnGotFocus(e);
|
||||
@@ -367,11 +372,16 @@ namespace CefSharp.WinForms
|
||||
/// <summary>
|
||||
/// Tell the browser to acquire/release focus.
|
||||
/// </summary>
|
||||
[Obsolete("Use GetBrowser().GetHost().SetFocus(isFocused) instead")]
|
||||
public void SetFocus(bool isFocused)
|
||||
{
|
||||
this.ThrowExceptionIfBrowserNotInitialized();
|
||||
|
||||
managedCefBrowserAdapter.SetFocus(isFocused);
|
||||
var browser = GetBrowser();
|
||||
if (browser != null)
|
||||
{
|
||||
browser.GetHost().SetFocus(isFocused);
|
||||
}
|
||||
}
|
||||
|
||||
public IBrowser GetBrowser()
|
||||
|
||||
@@ -840,7 +840,11 @@ namespace CefSharp.Wpf
|
||||
|
||||
if (notifyDpiChanged)
|
||||
{
|
||||
managedCefBrowserAdapter.NotifyScreenInfoChanged();
|
||||
var browser = GetBrowser();
|
||||
if(browser != null)
|
||||
{
|
||||
browser.GetHost().NotifyScreenInfoChanged();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -890,13 +894,25 @@ namespace CefSharp.Wpf
|
||||
{
|
||||
// Initialize RenderClientAdapter when WPF has calculated the actual size of current content.
|
||||
CreateOffscreenBrowserWhenActualSizeChanged();
|
||||
managedCefBrowserAdapter.WasResized();
|
||||
|
||||
var browser = GetBrowser();
|
||||
|
||||
if (browser != null)
|
||||
{
|
||||
browser.GetHost().WasResized();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs args)
|
||||
{
|
||||
var isVisible = (bool)args.NewValue;
|
||||
managedCefBrowserAdapter.WasHidden(!isVisible);
|
||||
|
||||
var browser = GetBrowser();
|
||||
|
||||
if (browser != null)
|
||||
{
|
||||
browser.GetHost().WasHidden(!isVisible);
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnApplicationExit(object sender, ExitEventArgs e)
|
||||
@@ -1048,17 +1064,21 @@ namespace CefSharp.Wpf
|
||||
|
||||
private void OnGotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
if (managedCefBrowserAdapter != null)
|
||||
var browser = GetBrowser();
|
||||
|
||||
if (browser != null)
|
||||
{
|
||||
managedCefBrowserAdapter.SendFocusEvent(true);
|
||||
browser.GetHost().SendFocusEvent(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
|
||||
{
|
||||
if (managedCefBrowserAdapter != null)
|
||||
var browser = GetBrowser();
|
||||
|
||||
if (browser != null)
|
||||
{
|
||||
managedCefBrowserAdapter.SendFocusEvent(false);
|
||||
browser.GetHost().SendFocusEvent(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user