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

package walk

import (
	"log"
	"syscall"
	"unsafe"
)

import (
	. "walk/winapi"
	. "walk/winapi/ole32"
	//	. "walk/winapi/oleaut32"
	. "walk/winapi/shdocvw"
)

var webViewIOleClientSiteVtbl *IOleClientSiteVtbl

func init() {
	webViewIOleClientSiteVtbl = &IOleClientSiteVtbl{
		syscall.NewCallback(webView_IOleClientSite_QueryInterface),
		syscall.NewCallback(webView_IOleClientSite_AddRef),
		syscall.NewCallback(webView_IOleClientSite_Release),
		syscall.NewCallback(webView_IOleClientSite_SaveObject),
		syscall.NewCallback(webView_IOleClientSite_GetMoniker),
		syscall.NewCallback(webView_IOleClientSite_GetContainer),
		syscall.NewCallback(webView_IOleClientSite_ShowObject),
		syscall.NewCallback(webView_IOleClientSite_OnShowWindow),
		syscall.NewCallback(webView_IOleClientSite_RequestNewObjectLayout),
	}
}

type webViewIOleClientSite struct {
	IOleClientSite
	inPlaceSite       webViewIOleInPlaceSite
	docHostUIHandler  webViewIDocHostUIHandler
	webBrowserEvents2 webViewDWebBrowserEvents2
}

func webView_IOleClientSite_QueryInterface(clientSite *webViewIOleClientSite, riid REFIID, ppvObject *unsafe.Pointer) HRESULT {
	if EqualREFIID(riid, &IID_IUnknown) {
		log.Println("webView_IOleClientSite_QueryInterface IID_IUnknown")
		*ppvObject = unsafe.Pointer(clientSite)
	} else if EqualREFIID(riid, &IID_IOleClientSite) {
		log.Println("webView_IOleClientSite_QueryInterface IID_IOleClientSite")
		*ppvObject = unsafe.Pointer(clientSite)
	} else if EqualREFIID(riid, &IID_IOleInPlaceSite) {
		log.Println("webView_IOleClientSite_QueryInterface IID_IOleInPlaceSite")
		*ppvObject = unsafe.Pointer(&clientSite.inPlaceSite)
	} else if EqualREFIID(riid, &IID_IDocHostUIHandler) {
		log.Println("webView_IOleClientSite_QueryInterface IID_IDocHostUIHandler")
		*ppvObject = unsafe.Pointer(&clientSite.docHostUIHandler)
		// FIXME: Reactivate after fixing crash
		//	} else if EqualREFIID(riid, &IID_IDispatch) {
		//		*ppvObject = unsafe.Pointer(&clientSite.webBrowserEvents2)
	} else {
		log.Println("webView_IOleClientSite_QueryInterface ?")
		*ppvObject = nil
		return E_NOINTERFACE
	}
<commit_msg>Remove logging from WebView<commit_after>// Copyright 2010 The Walk Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

package walk

import (
	"syscall"
	"unsafe"
)

import (
	. "walk/winapi"
	. "walk/winapi/ole32"
	//	. "walk/winapi/oleaut32"
	. "walk/winapi/shdocvw"
)

var webViewIOleClientSiteVtbl *IOleClientSiteVtbl

func init() {
	webViewIOleClientSiteVtbl = &IOleClientSiteVtbl{
		syscall.NewCallback(webView_IOleClientSite_QueryInterface),
		syscall.NewCallback(webView_IOleClientSite_AddRef),
		syscall.NewCallback(webView_IOleClientSite_Release),
		syscall.NewCallback(webView_IOleClientSite_SaveObject),
		syscall.NewCallback(webView_IOleClientSite_GetMoniker),
		syscall.NewCallback(webView_IOleClientSite_GetContainer),
		syscall.NewCallback(webView_IOleClientSite_ShowObject),
		syscall.NewCallback(webView_IOleClientSite_OnShowWindow),
		syscall.NewCallback(webView_IOleClientSite_RequestNewObjectLayout),
	}
}

type webViewIOleClientSite struct {
	IOleClientSite
	inPlaceSite       webViewIOleInPlaceSite
	docHostUIHandler  webViewIDocHostUIHandler
	webBrowserEvents2 webViewDWebBrowserEvents2
}

func webView_IOleClientSite_QueryInterface(clientSite *webViewIOleClientSite, riid REFIID, ppvObject *unsafe.Pointer) HRESULT {
	if EqualREFIID(riid, &IID_IUnknown) {
		*ppvObject = unsafe.Pointer(clientSite)
	} else if EqualREFIID(riid, &IID_IOleClientSite) {
		*ppvObject = unsafe.Pointer(clientSite)
	} else if EqualREFIID(riid, &IID_IOleInPlaceSite) {
		*ppvObject = unsafe.Pointer(&clientSite.inPlaceSite)
	} else if EqualREFIID(riid, &IID_IDocHostUIHandler) {
		*ppvObject = unsafe.Pointer(&clientSite.docHostUIHandler)
		// FIXME: Reactivate after fixing crash
		//	} else if EqualREFIID(riid, &IID_IDispatch) {
		//		*ppvObject = unsafe.Pointer(&clientSite.webBrowserEvents2)
	} else {
		*ppvObject = nil
		return E_NOINTERFACE
	}

{'fraction_non_alphanumeric': 0.08677098150782361, 'fraction_numerical': 0.005215742057847321, 'mean_word_length': 6.493783303730018, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2874147', 'n_tokens_mistral': 1579, 'n_tokens_neox': 1470, 'n_words': 235}