<commit_before>﻿// Copyright © 2010-2015 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.

#include "Stdafx.h"

#include "include/wrapper/cef_stream_resource_handler.h"
#include "ClientAdapter.h"
#include "CefRequestWrapper.h"
#include "CefContextMenuParamsWrapper.h"
#include "CefDragDataWrapper.h"
#include "TypeConversion.h"
#include "CefSharpBrowserWrapper.h"
#include "CefDownloadItemCallbackWrapper.h"
#include "CefBeforeDownloadCallbackWrapper.h"
#include "CefGeolocationCallbackWrapper.h"
#include "CefFileDialogCallbackWrapper.h"
#include "CefAuthCallbackWrapper.h"
#include "CefJSDialogCallbackWrapper.h"
#include "CefRequestCallbackWrapper.h"
#include "CefWindowInfoWrapper.h"
#include "Serialization\Primitives.h"
#include "Serialization\V8Serialization.h"
#include "Messaging\Messages.h"

using namespace CefSharp::Internals::Messaging;
using namespace CefSharp::Internals::Serialization;

namespace CefSharp
{
    namespace Internals
    {
        IBrowser^ ClientAdapter::GetBrowserWrapper(int browserId, bool isPopup)
        {
            if(isPopup)
            {
                IBrowser^ browserWrapper;
                if (_popupBrowsers->TryGetValue(browserId, browserWrapper))
                {
                    return browserWrapper;
                }

                auto stackFrame = gcnew StackFrame(1);
                auto callingMethodName = stackFrame->GetMethod()->Name;

                ThrowUnknownPopupBrowser(gcnew String(L"ClientAdapter::" + callingMethodName));
            }

            return _browserAdapter->GetBrowser();
        }

        void ClientAdapter::CloseAllPopups(bool forceClose)<commit_msg>Quick fix to make sure the correct IBrowser instance is used<commit_after>﻿// Copyright © 2010-2015 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.

#include "Stdafx.h"

#include "include/wrapper/cef_stream_resource_handler.h"
#include "ClientAdapter.h"
#include "CefRequestWrapper.h"
#include "CefContextMenuParamsWrapper.h"
#include "CefDragDataWrapper.h"
#include "TypeConversion.h"
#include "CefSharpBrowserWrapper.h"
#include "CefDownloadItemCallbackWrapper.h"
#include "CefBeforeDownloadCallbackWrapper.h"
#include "CefGeolocationCallbackWrapper.h"
#include "CefFileDialogCallbackWrapper.h"
#include "CefAuthCallbackWrapper.h"
#include "CefJSDialogCallbackWrapper.h"
#include "CefRequestCallbackWrapper.h"
#include "CefWindowInfoWrapper.h"
#include "Serialization\Primitives.h"
#include "Serialization\V8Serialization.h"
#include "Messaging\Messages.h"

using namespace CefSharp::Internals::Messaging;
using namespace CefSharp::Internals::Serialization;

namespace CefSharp
{
    namespace Internals
    {
        IBrowser^ ClientAdapter::GetBrowserWrapper(int browserId, bool isPopup)
        {
            if (_browserControl->HasParent)
            {
                return _browserAdapter->GetBrowser();
            }

            if(isPopup)
            {
                IBrowser^ browserWrapper;
                if (_popupBrowsers->TryGetValue(browserId, browserWrapper))
                {
                    return browserWrapper;
                }

                auto stackFrame = gcnew StackFrame(1);
                auto callingMethodName = stackFrame->GetMethod()->Name;

                ThrowUnknownPopupBrowser(gcnew String(L"ClientAdapter::" + callingMethodName));
            }

            return _browserAdapter->GetBrowser();
        }

        void ClientAdapter::CloseAllPopups(bool forceClose)
{'fraction_non_alphanumeric': 0.0923202614379085, 'fraction_numerical': 0.0054466230936819175, 'mean_word_length': 3.3726190476190476, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2876665', 'n_tokens_mistral': 1058, 'n_tokens_neox': 1014, 'n_words': 223}