Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit implement internal interface #302

Merged
merged 5 commits into from
May 21, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions CefSharp.WinForms/WebView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ protected override void OnSizeChanged(EventArgs e)
managedCefBrowserAdapter.OnSizeChanged(Handle);
}

public void SetAddress(string address)
void IWebBrowserInternal.SetAddress(string address)
{
Address = address;

Expand All @@ -131,12 +131,12 @@ public void SetAddress(string address)
}
}

public void SetIsLoading(bool isLoading)
void IWebBrowserInternal.SetIsLoading(bool isLoading)
{
IsLoading = isLoading;
}

public void SetNavState(bool canGoBack, bool canGoForward, bool canReload)
void IWebBrowserInternal.SetNavState(bool canGoBack, bool canGoForward, bool canReload)
{
CanGoBack = canGoBack;
CanGoForward = canGoForward;
Expand All @@ -149,7 +149,7 @@ public void SetNavState(bool canGoBack, bool canGoForward, bool canReload)
}
}

public void SetTitle(string title)
void IWebBrowserInternal.SetTitle(string title)
{
Title = title;

Expand All @@ -160,12 +160,12 @@ public void SetTitle(string title)
}
}

public void SetTooltipText(string tooltipText)
void IWebBrowserInternal.SetTooltipText(string tooltipText)
{
TooltipText = tooltipText;
}

public void OnFrameLoadStart(string url, bool isMainFrame)
void IWebBrowserInternal.OnFrameLoadStart(string url, bool isMainFrame)
{
var handler = FrameLoadStart;
if (handler != null)
Expand All @@ -174,7 +174,7 @@ public void OnFrameLoadStart(string url, bool isMainFrame)
}
}

public void OnFrameLoadEnd(string url, bool isMainFrame, int httpStatusCode)
void IWebBrowserInternal.OnFrameLoadEnd(string url, bool isMainFrame, int httpStatusCode)
{
var handler = FrameLoadEnd;
if (handler != null)
Expand All @@ -183,12 +183,12 @@ public void OnFrameLoadEnd(string url, bool isMainFrame, int httpStatusCode)
}
}

public void OnTakeFocus(bool next)
void IWebBrowserInternal.OnTakeFocus(bool next)
{
SelectNextControl(this, next, true, true, true);
}

public void OnConsoleMessage(string message, string source, int line)
void IWebBrowserInternal.OnConsoleMessage(string message, string source, int line)
{
var handler = ConsoleMessage;
if (handler != null)
Expand All @@ -197,7 +197,7 @@ public void OnConsoleMessage(string message, string source, int line)
}
}

public void OnLoadError(string url, CefErrorCode errorCode, string errorText)
void IWebBrowserInternal.OnLoadError(string url, CefErrorCode errorCode, string errorText)
{
var handler = LoadError;
if (handler != null)
Expand All @@ -216,14 +216,14 @@ public void StopFinding(bool clearSelection)
managedCefBrowserAdapter.StopFinding(clearSelection);
}

public void ShowDevTools()
void IWebBrowserInternal.ShowDevTools()
{
// TODO: Do something about this one.
var devToolsUrl = managedCefBrowserAdapter.DevToolsUrl;
throw new NotImplementedException();
}

public void CloseDevTools()
void IWebBrowserInternal.CloseDevTools()
{
throw new NotImplementedException();
}
Expand Down
51 changes: 24 additions & 27 deletions CefSharp.Wpf/WebView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,13 @@ private IntPtr SourceHook(IntPtr hWnd, int message, IntPtr wParam, IntPtr lParam
return IntPtr.Zero;
}

public void InvokeRenderAsync(BitmapInfo bitmapInfo)
void IRenderWebBrowser.InvokeRenderAsync(BitmapInfo bitmapInfo)
{
DoInUi(() => SetBitmap(bitmapInfo), DispatcherPriority.Render);
IRenderWebBrowser renderer = this;
DoInUi(() => renderer.SetBitmap(bitmapInfo), DispatcherPriority.Render);
}

public void SetAddress(string address)
void IWebBrowserInternal.SetAddress(string address)
{
DoInUi(() =>
{
Expand All @@ -605,7 +606,7 @@ public void SetIsLoading(bool isLoading)
});
}

public void SetNavState(bool canGoBack, bool canGoForward, bool canReload)
void IWebBrowserInternal.SetNavState(bool canGoBack, bool canGoForward, bool canReload)
{
CanGoBack = canGoBack;
CanGoForward = canGoForward;
Expand All @@ -621,31 +622,31 @@ private void RaiseCommandsCanExecuteChanged()
((DelegateCommand)ReloadCommand).RaiseCanExecuteChanged();
}

public void SetTitle(string title)
void IWebBrowserInternal.SetTitle(string title)
{
DoInUi(() =>
{
SetCurrentValue(TitleProperty, title);
});
}

public void SetTooltipText(string tooltipText)
void IWebBrowserInternal.SetTooltipText(string tooltipText)
{
DoInUi(() =>
{
SetCurrentValue(TooltipTextProperty, tooltipText);
});
}

public void SetPopupSizeAndPosition(int width, int height, int x, int y)
void IRenderWebBrowser.SetPopupSizeAndPosition(int width, int height, int x, int y)
{
DoInUi(() =>
{
this.SetPopupSizeAndPositionImpl(width, height, x, y);
});
}

public void SetPopupIsOpen(bool isOpen)
void IRenderWebBrowser.SetPopupIsOpen(bool isOpen)
{
DoInUi(() =>
{
Expand All @@ -671,7 +672,7 @@ private static CefEventFlags GetModifiers(MouseEventArgs e)
}
return modifiers;
}

private static CefEventFlags GetModifiers(KeyEventArgs e)
{
CefEventFlags modifiers = 0;
Expand Down Expand Up @@ -700,7 +701,6 @@ private void SetPopupSizeAndPositionImpl(int width, int height, int x, int y)
popup.Height = height;

var popupOffset = new Point(x, y);

popup.HorizontalOffset = popupOffset.X / matrix.M11;
popup.VerticalOffset = popupOffset.Y / matrix.M22;
}
Expand Down Expand Up @@ -882,7 +882,7 @@ private void OnMouseButton(MouseButtonEventArgs e)
managedCefBrowserAdapter.OnMouseButton((int)point.X, (int)point.Y, mouseButtonType, mouseUp, e.ClickCount, modifiers);
}

public void OnInitialized()
void IWebBrowserInternal.OnInitialized()
{
//browserCore.OnInitialized();
}
Expand Down Expand Up @@ -961,19 +961,19 @@ private void ZoomReset()
});
}

public void ShowDevTools()
void IWebBrowserInternal.ShowDevTools()
{
// TODO: Do something about this one.
var devToolsUrl = managedCefBrowserAdapter.DevToolsUrl;
throw new NotImplementedException();
}

public void CloseDevTools()
void IWebBrowserInternal.CloseDevTools()
{
throw new NotImplementedException();
}

public void OnFrameLoadStart(string url, bool isMainFrame)
void IWebBrowserInternal.OnFrameLoadStart(string url, bool isMainFrame)
{
var handler = FrameLoadStart;
if (handler != null)
Expand All @@ -982,7 +982,7 @@ public void OnFrameLoadStart(string url, bool isMainFrame)
}
}

public void OnFrameLoadEnd(string url, bool isMainFrame, int httpStatusCode)
void IWebBrowserInternal.OnFrameLoadEnd(string url, bool isMainFrame, int httpStatusCode)
{
var handler = FrameLoadEnd;

Expand All @@ -992,12 +992,12 @@ public void OnFrameLoadEnd(string url, bool isMainFrame, int httpStatusCode)
}
}

public void OnTakeFocus(bool next)
void IWebBrowserInternal.OnTakeFocus(bool next)
{
throw new NotImplementedException();
}

public void OnConsoleMessage(string message, string source, int line)
void IWebBrowserInternal.OnConsoleMessage(string message, string source, int line)
{
var handler = ConsoleMessage;
if (handler != null)
Expand All @@ -1006,7 +1006,7 @@ public void OnConsoleMessage(string message, string source, int line)
}
}

public void OnLoadError(string url, CefErrorCode errorCode, string errorText)
void IWebBrowserInternal.OnLoadError(string url, CefErrorCode errorCode, string errorText)
{
var handler = LoadError;
if (handler != null)
Expand Down Expand Up @@ -1042,23 +1042,20 @@ public object EvaluateScript(string script, TimeSpan? timeout)
return managedCefBrowserAdapter.EvaluateScript(script, timeout.Value);
}

public void SetCursor(IntPtr handle)
void IRenderWebBrowser.SetCursor(IntPtr handle)
{
if (!Dispatcher.CheckAccess())
DoInUi(() =>
{
Dispatcher.BeginInvoke((Action<IntPtr>)SetCursor, handle);
return;
}

Cursor = CursorInteropHelper.Create(new SafeFileHandle(handle, ownsHandle: false));
Cursor = CursorInteropHelper.Create(new SafeFileHandle(handle, ownsHandle: false));
});
}

public void ClearBitmap(BitmapInfo bitmapInfo)
void IRenderWebBrowser.ClearBitmap(BitmapInfo bitmapInfo)
{
bitmapInfo.InteropBitmap = null;
}

public void SetBitmap(BitmapInfo bitmapInfo)
void IRenderWebBrowser.SetBitmap(BitmapInfo bitmapInfo)
{
lock (bitmapInfo.BitmapLock)
{
Expand Down
2 changes: 2 additions & 0 deletions CefSharp/Internals/IWebBrowserInternal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ public interface IWebBrowserInternal : IWebBrowser
{
IDictionary<string, object> BoundObjects { get; }

//TODO: shouldnt this be part of IWebBrowser
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once this PR is merged, I'd like to get some more API cleanup done, moving these to IWebBrowser is on that list.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also ShowDevTools and CloseDevTools should probably be moved to IWebBrowser as well. I'm thinking in the short term we move them as it's a minor change, and update down the track when we have a clearer picture of what's happening with DevTools in general.

ILifeSpanHandler LifeSpanHandler { get; set; }
IKeyboardHandler KeyboardHandler { get; set; }
IJsDialogHandler JsDialogHandler { get; set; }
//end

void OnInitialized();

Expand Down