mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Added WebBrowserComponent::pageFinishedLoading()
This commit is contained in:
parent
cb3406d710
commit
f3be0d0392
3 changed files with 22 additions and 10 deletions
|
|
@ -99,6 +99,9 @@ public:
|
|||
*/
|
||||
virtual bool pageAboutToLoad (const String& newURL);
|
||||
|
||||
/** This callback happens when the browser has finished loading a page. */
|
||||
virtual void pageFinishedLoading (const String& url);
|
||||
|
||||
//==============================================================================
|
||||
/** @internal */
|
||||
void paint (Graphics& g);
|
||||
|
|
|
|||
|
|
@ -41,7 +41,9 @@ class WebBrowserComponentInternal;
|
|||
- (void) webView: (WebView*) webView decidePolicyForNavigationAction: (NSDictionary*) actionInformation
|
||||
request: (NSURLRequest*) request
|
||||
frame: (WebFrame*) frame
|
||||
decisionListener: (id<WebPolicyDecisionListener>) listener;
|
||||
decisionListener: (id <WebPolicyDecisionListener>) listener;
|
||||
- (void) webView: (WebView*) webView didFinishLoadForFrame: (WebFrame*) frame;
|
||||
|
||||
@end
|
||||
|
||||
@implementation DownloadClickDetector
|
||||
|
|
@ -68,6 +70,15 @@ class WebBrowserComponentInternal;
|
|||
[listener ignore];
|
||||
}
|
||||
|
||||
- (void) webView: (WebView*) sender didFinishLoadForFrame: (WebFrame*) frame
|
||||
{
|
||||
if ([frame isEqual: [sender mainFrame]])
|
||||
{
|
||||
NSURL* url = [[[frame dataSource] request] URL];
|
||||
ownerComponent->pageFinishedLoading (nsStringToJuce ([url absoluteString]));
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#else
|
||||
|
|
@ -138,6 +149,7 @@ public:
|
|||
|
||||
clickListener = [[DownloadClickDetector alloc] initWithWebBrowserOwner: owner];
|
||||
[webView setPolicyDelegate: clickListener];
|
||||
[webView setFrameLoadDelegate: clickListener];
|
||||
#else
|
||||
webView = [[UIWebView alloc] initWithFrame: CGRectMake (0, 0, 1.0f, 1.0f)];
|
||||
setView (webView);
|
||||
|
|
@ -153,6 +165,7 @@ public:
|
|||
{
|
||||
#if JUCE_MAC
|
||||
[webView setPolicyDelegate: nil];
|
||||
[webView setFrameLoadDelegate: nil];
|
||||
[clickListener release];
|
||||
#else
|
||||
webView.delegate = nil;
|
||||
|
|
@ -342,7 +355,5 @@ void WebBrowserComponent::visibilityChanged()
|
|||
checkWindowAssociation();
|
||||
}
|
||||
|
||||
bool WebBrowserComponent::pageAboutToLoad (const String&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool WebBrowserComponent::pageAboutToLoad (const String&) { return true; }
|
||||
void WebBrowserComponent::pageFinishedLoading (const String&) {}
|
||||
|
|
|
|||
|
|
@ -160,7 +160,7 @@ private:
|
|||
}
|
||||
else if (dispIdMember == DISPID_DOCUMENTCOMPLETE)
|
||||
{
|
||||
//owner.pageFinishedLoading (getStringFromVariant (pDispParams->rgvarg[0].pvarVal);
|
||||
owner.pageFinishedLoading (getStringFromVariant (pDispParams->rgvarg[0].pvarVal));
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
@ -311,7 +311,5 @@ void WebBrowserComponent::visibilityChanged()
|
|||
checkWindowAssociation();
|
||||
}
|
||||
|
||||
bool WebBrowserComponent::pageAboutToLoad (const String&)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
bool WebBrowserComponent::pageAboutToLoad (const String&) { return true; }
|
||||
void WebBrowserComponent::pageFinishedLoading (const String&) {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue