<commit_before>// Copyright © 2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

namespace CefSharp.WinForms.Internals
{
    /// <summary>
    /// Default implementation of <see cref="IFocusHandler" />
    /// for the WinForms implementation
    /// </summary>
    /// <seealso cref="CefSharp.IFocusHandler" />
    public class DefaultFocusHandler : IFocusHandler
    {
        /// <summary>
        /// Called when the browser component has received focus.
        /// </summary>
        /// <param name="chromiumWebBrowser">the ChromiumWebBrowser control</param>
        /// <param name="browser">the browser object</param>
        /// <remarks>Try to avoid needing to override this logic in a subclass. The implementation in
        /// DefaultFocusHandler relies on very detailed behavior of how WinForms and
        /// Windows interact during window activation.</remarks>
        public virtual void OnGotFocus(IWebBrowser chromiumWebBrowser, IBrowser browser)
        {
            //We don't deal with popups as they're rendered by default entirely by CEF
            if (browser.IsPopup)
            {<commit_msg>DefaultFocusHandler.OnGotFocus - Add browser null check<commit_after>// Copyright © 2014 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.

namespace CefSharp.WinForms.Internals
{
    /// <summary>
    /// Default implementation of <see cref="IFocusHandler" />
    /// for the WinForms implementation
    /// </summary>
    /// <seealso cref="CefSharp.IFocusHandler" />
    public class DefaultFocusHandler : IFocusHandler
    {
        /// <summary>
        /// Called when the browser component has received focus.
        /// </summary>
        /// <param name="chromiumWebBrowser">the ChromiumWebBrowser control</param>
        /// <param name="browser">the browser object</param>
        /// <remarks>Try to avoid needing to override this logic in a subclass. The implementation in
        /// DefaultFocusHandler relies on very detailed behavior of how WinForms and
        /// Windows interact during window activation.</remarks>
        public virtual void OnGotFocus(IWebBrowser chromiumWebBrowser, IBrowser browser)
        {
            //We don't deal with popups as they're rendered by default entirely by CEF
            //For print dialogs the browser will be null, we don't want to deal with that either.
            if (browser == null || browser.IsPopup)
            {
{'fraction_non_alphanumeric': 0.09397775220560031, 'fraction_numerical': 0.0030686612965093976, 'mean_word_length': 2.5290933694181326, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3101381', 'n_tokens_mistral': 655, 'n_tokens_neox': 626, 'n_words': 256}