Skip to content

Commit

Permalink
IBrowserHost.Find remove identifier param
Browse files Browse the repository at this point in the history
Resolves cefsharp#4013
  • Loading branch information
amaitland committed Feb 22, 2022
1 parent 54bd29a commit 597e54f
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 16 deletions.
4 changes: 2 additions & 2 deletions CefSharp.Core.Runtime/Internals/CefBrowserHostWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,11 +315,11 @@ void CefBrowserHostWrapper::RunFileDialog(CefFileDialogMode mode, String^ title,
new CefRunFileDialogCallbackAdapter(callback));
}

void CefBrowserHostWrapper::Find(int identifier, String^ searchText, bool forward, bool matchCase, bool findNext)
void CefBrowserHostWrapper::Find(String^ searchText, bool forward, bool matchCase, bool findNext)
{
ThrowIfDisposed();

_browserHost->Find(identifier, StringUtils::ToNative(searchText), forward, matchCase, findNext);
_browserHost->Find(StringUtils::ToNative(searchText), forward, matchCase, findNext);
}

void CefBrowserHostWrapper::StopFinding(bool clearSelection)
Expand Down
2 changes: 1 addition & 1 deletion CefSharp.Core.Runtime/Internals/CefBrowserHostWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ namespace CefSharp

virtual void RunFileDialog(CefFileDialogMode mode, String^ title, String^ defaultFilePath, IList<String^>^ acceptFilters, int selectedAcceptFilter, IRunFileDialogCallback^ callback);

virtual void Find(int identifier, String^ searchText, bool forward, bool matchCase, bool findNext);
virtual void Find(String^ searchText, bool forward, bool matchCase, bool findNext);
virtual void StopFinding(bool clearSelection);

virtual void SetFocus(bool focus);
Expand Down
2 changes: 1 addition & 1 deletion CefSharp.WinForms.Example/BrowserTabUserControl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,7 @@ private void Find(bool next)
{
if (!string.IsNullOrEmpty(findTextBox.Text))
{
Browser.Find(0, findTextBox.Text, next, false, false);
Browser.Find(findTextBox.Text, next, false, false);
}
}

Expand Down
2 changes: 1 addition & 1 deletion CefSharp.Wpf/Handler/ContextMenuHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ protected virtual void ExecuteCommand(IBrowser browser, ContextMenuExecuteModel
}
case CefMenuCommand.Find:
{
browser.GetHost().Find(0, model.SelectionText, true, false, false);
browser.GetHost().Find(model.SelectionText, true, false, false);
break;
}

Expand Down
6 changes: 1 addition & 5 deletions CefSharp/IBrowserHost.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,12 @@ public interface IBrowserHost : IDisposable
/// <summary>
/// Search for <paramref name="searchText"/>.
/// </summary>
/// <param name="identifier">must be a unique ID and these IDs
/// must strictly increase so that newer requests always have greater IDs than
/// older requests. If identifier is zero or less than the previous ID value
/// then it will be automatically assigned a new valid ID. </param>
/// <param name="searchText">text to search for</param>
/// <param name="forward">indicates whether to search forward or backward within the page</param>
/// <param name="matchCase">indicates whether the search should be case-sensitive</param>
/// <param name="findNext">indicates whether this is the first request or a follow-up</param>
/// <remarks>The <see cref="IFindHandler"/> instance, if any, will be called to report find results.</remarks>
void Find(int identifier, string searchText, bool forward, bool matchCase, bool findNext);
void Find(string searchText, bool forward, bool matchCase, bool findNext);

/// <summary>
/// Returns the extension hosted in this browser or null if no extension is hosted. See <see cref="IRequestContext.LoadExtension"/> for details.
Expand Down
10 changes: 4 additions & 6 deletions CefSharp/WebBrowserExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -957,34 +957,32 @@ public static void SetZoomLevel(this IChromiumWebBrowserBase browser, double zoo
/// Search for text within the current page.
/// </summary>
/// <param name="cefBrowser">The ChromiumWebBrowser instance this method extends.</param>
/// <param name="identifier">Can be used in can conjunction with searchText to have multiple searches running simultaneously.</param>
/// <param name="searchText">search text.</param>
/// <param name="forward">indicates whether to search forward or backward within the page.</param>
/// <param name="matchCase">indicates whether the search should be case-sensitive.</param>
/// <param name="findNext">indicates whether this is the first request or a follow-up.</param>
public static void Find(this IBrowser cefBrowser, int identifier, string searchText, bool forward, bool matchCase, bool findNext)
public static void Find(this IBrowser cefBrowser, string searchText, bool forward, bool matchCase, bool findNext)
{
var host = cefBrowser.GetHost();
ThrowExceptionIfBrowserHostNull(host);

host.Find(identifier, searchText, forward, matchCase, findNext);
host.Find(searchText, forward, matchCase, findNext);
}

/// <summary>
/// Search for text within the current page.
/// </summary>
/// <param name="browser">The ChromiumWebBrowser instance this method extends.</param>
/// <param name="identifier">Can be used in can conjunction with searchText to have multiple searches running simultaneously.</param>
/// <param name="searchText">search text.</param>
/// <param name="forward">indicates whether to search forward or backward within the page.</param>
/// <param name="matchCase">indicates whether the search should be case-sensitive.</param>
/// <param name="findNext">indicates whether this is the first request or a follow-up.</param>
public static void Find(this IChromiumWebBrowserBase browser, int identifier, string searchText, bool forward, bool matchCase, bool findNext)
public static void Find(this IChromiumWebBrowserBase browser, string searchText, bool forward, bool matchCase, bool findNext)
{
var cefBrowser = browser.BrowserCore;
cefBrowser.ThrowExceptionIfBrowserNull();

cefBrowser.Find(identifier, searchText, forward, matchCase, findNext);
cefBrowser.Find(searchText, forward, matchCase, findNext);
}

/// <summary>
Expand Down

0 comments on commit 597e54f

Please sign in to comment.