mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-01 03:10:06 +00:00
Added a method BrowserPluginComponent::getBrowserURL() so that plugins can find out what URL they are embedded in
This commit is contained in:
parent
98b9baa880
commit
5df4ac7dec
3 changed files with 1332 additions and 1242 deletions
|
|
@ -43,6 +43,7 @@
|
|||
#include <windowsx.h>
|
||||
#include <olectl.h>
|
||||
#include <objsafe.h>
|
||||
#include <exdisp.h>
|
||||
#pragma warning (disable:4584)
|
||||
|
||||
#include "../../../juce_amalgamated.h"
|
||||
|
|
@ -458,7 +459,8 @@ public:
|
|||
//==============================================================================
|
||||
AXBrowserPluginHolderComponent()
|
||||
: child (0),
|
||||
parentHWND (0)
|
||||
parentHWND (0),
|
||||
browser (0)
|
||||
{
|
||||
setOpaque (true);
|
||||
setWantsKeyboardFocus (false);
|
||||
|
|
@ -490,12 +492,28 @@ public:
|
|||
|
||||
void setWindow (IOleInPlaceSite* site)
|
||||
{
|
||||
if (browser != 0)
|
||||
{
|
||||
browser->Release();
|
||||
browser = 0;
|
||||
}
|
||||
|
||||
HWND newHWND = 0;
|
||||
|
||||
if (site != 0)
|
||||
{
|
||||
site->GetWindow (&newHWND);
|
||||
|
||||
//log ("setWindow: " + String ((int) newHWND));
|
||||
IServiceProvider* sp = 0;
|
||||
site->QueryInterface (IID_IServiceProvider, (void**) &sp);
|
||||
|
||||
if (sp != 0)
|
||||
{
|
||||
sp->QueryService (IID_IWebBrowserApp, IID_IWebBrowser2, (void**) &browser);
|
||||
sp->Release();
|
||||
}
|
||||
}
|
||||
|
||||
if (parentHWND != newHWND)
|
||||
{
|
||||
removeFromDesktop();
|
||||
|
|
@ -521,10 +539,21 @@ public:
|
|||
site->OnInPlaceActivate();
|
||||
}
|
||||
|
||||
const String getBrowserURL() const
|
||||
{
|
||||
if (browser == 0)
|
||||
return String::empty;
|
||||
|
||||
BSTR url = 0;
|
||||
browser->get_LocationURL (&url);
|
||||
return URL::removeEscapeChars (url);
|
||||
}
|
||||
|
||||
private:
|
||||
//==============================================================================
|
||||
BrowserPluginComponent* child;
|
||||
HWND parentHWND;
|
||||
IWebBrowser2* browser;
|
||||
};
|
||||
|
||||
//==============================================================================
|
||||
|
|
@ -759,6 +788,12 @@ static const String getExeVersion (const String& exeFileName, const String& fiel
|
|||
return resultString;
|
||||
}
|
||||
|
||||
const String getActiveXBrowserURL (const BrowserPluginComponent* comp)
|
||||
{
|
||||
AXBrowserPluginHolderComponent* const ax = dynamic_cast <AXBrowserPluginHolderComponent*> (comp->getParentComponent());
|
||||
return ax != 0 ? ax->getBrowserURL() : String::empty;
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
extern "C" BOOL WINAPI DllMain (HANDLE instance, DWORD reason, LPVOID)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue