aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Library/ml_online/browserEvent.cpp
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Library/ml_online/browserEvent.cpp
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Plugins/Library/ml_online/browserEvent.cpp')
-rw-r--r--Src/Plugins/Library/ml_online/browserEvent.cpp100
1 files changed, 100 insertions, 0 deletions
diff --git a/Src/Plugins/Library/ml_online/browserEvent.cpp b/Src/Plugins/Library/ml_online/browserEvent.cpp
new file mode 100644
index 00000000..d24442a7
--- /dev/null
+++ b/Src/Plugins/Library/ml_online/browserEvent.cpp
@@ -0,0 +1,100 @@
+#include "main.h"
+#include "./browserEvent.h"
+#include "./serviceHost.h"
+#include "./serviceHelper.h"
+
+#include <ifc_omservice.h>
+#include <ifc_omserviceeventmngr.h>
+#include <ifc_omservicecommand.h>
+
+#include <browserView.h>
+#include <browserPopup.h>
+
+BrowserEvent::BrowserEvent()
+ : ref(1)
+{
+}
+
+BrowserEvent::~BrowserEvent()
+{
+}
+
+HRESULT BrowserEvent::CreateInstance(BrowserEvent **instance)
+{
+ if (NULL == instance) return E_POINTER;
+ *instance = new BrowserEvent();
+ if (NULL == *instance) return E_OUTOFMEMORY;
+ return S_OK;
+}
+
+size_t BrowserEvent::AddRef()
+{
+ return InterlockedIncrement((LONG*)&ref);
+}
+
+size_t BrowserEvent::Release()
+{
+ if (0 == ref)
+ return ref;
+
+ LONG r = InterlockedDecrement((LONG*)&ref);
+ if (0 == r)
+ delete(this);
+
+ return r;
+}
+
+int BrowserEvent::QueryInterface(GUID interface_guid, void **object)
+{
+ if (NULL == object) return E_POINTER;
+
+ if (IsEqualIID(interface_guid, IFC_OmBrowserEvent))
+ *object = static_cast<ifc_ombrowserevent*>(this);
+ else
+ {
+ *object = NULL;
+ return E_NOINTERFACE;
+ }
+
+ if (NULL == *object)
+ return E_UNEXPECTED;
+
+ AddRef();
+ return S_OK;
+}
+
+void BrowserEvent::WindowCreate(HWND hwnd, const GUID *windowType)
+{
+ if (NULL != windowType)
+ {
+ if (IsEqualGUID(*windowType, WTID_BrowserView) ||
+ IsEqualGUID(*windowType, WTID_BrowserPopup))
+ {
+ ifc_omservice *service;
+ if (FALSE != BrowserControl_GetService(hwnd, &service))
+ {
+ UINT flags;
+ if (SUCCEEDED(service->GetFlags(&flags)) &&
+ 0 == ((SVCF_SPECIAL | SVCF_VALIDATED | SVCF_VERSIONCHECK) & flags))
+ {
+ ServiceHelper_BeginVersionCheck(service);
+ }
+ service->Release();
+ }
+ }
+ }
+}
+
+void BrowserEvent::WindowClose(HWND hwnd, const GUID *windowType)
+{
+}
+
+#define CBCLASS BrowserEvent
+START_DISPATCH;
+CB(ADDREF, AddRef)
+CB(RELEASE, Release)
+CB(QUERYINTERFACE, QueryInterface)
+VCB(API_WINDOWCREATE, WindowCreate)
+VCB(API_WINDOWCLOSE, WindowClose)
+END_DISPATCH;
+#undef CBCLASS