| Index: src/plugin/PluginTabBase.cpp |
| diff --git a/src/plugin/PluginTabBase.cpp b/src/plugin/PluginTabBase.cpp |
| index 7422d417c812d2f3c586d4e359a39502c0a96f02..bfca0c1e9b07d4247317692c820496904a55a182 100644 |
| --- a/src/plugin/PluginTabBase.cpp |
| +++ b/src/plugin/PluginTabBase.cpp |
| @@ -177,6 +177,51 @@ void CPluginTabBase::InjectABP(IWebBrowser2* browser) |
| } |
| } |
| +namespace |
| +{ |
| + ATL::CComPtr<IWebBrowser2> GetParent(IWebBrowser2& browser) |
| + { |
| + ATL::CComPtr<IDispatch> browserParentDispatch; |
|
Eric
2015/05/14 17:07:26
I'd call this 'parentDispatch' here, in analogy wi
sergei
2015/05/15 11:55:55
renamed
|
| + if (FAILED(browser.get_Parent(&browserParentDispatch)) || !browserParentDispatch) |
| + { |
| + return nullptr; |
| + } |
| + // The InternetExplorer application always returns a pointer to itself. |
| + if (browserParentDispatch.IsEqualObject(&browser)) |
| + { |
| + return nullptr; |
| + } |
| + ATL::CComQIPtr<IServiceProvider> parentDocumentServiceProvider = browserParentDispatch; |
| + if (!parentDocumentServiceProvider) |
| + { |
| + return nullptr; |
| + } |
| + ATL::CComPtr<IWebBrowserApp> webBrowserApp; |
| + if (FAILED(parentDocumentServiceProvider->QueryService(IID_IWebBrowserApp, &webBrowserApp)) || !webBrowserApp) |
| + { |
| + return nullptr; |
| + } |
| + return ATL::CComQIPtr<IWebBrowser2>(webBrowserApp); |
| + } |
| + |
| + bool IsFrameWhiteListed(ATL::CComPtr<IWebBrowser2> frame) |
| + { |
| + if (!frame) |
| + { |
| + return false; |
| + } |
| + auto url = GetLocationUrl(*frame); |
| + std::vector<std::string> frameHierarchy; |
| + for(frame = GetParent(*frame); frame; frame = GetParent(*frame)) |
| + { |
| + frameHierarchy.push_back(ToUtf8String(GetLocationUrl(*frame))); |
| + } |
| + CPluginClient* client = CPluginClient::GetInstance(); |
| + return client->IsWhitelistedUrl(url, frameHierarchy) |
| + || client->IsElemhideWhitelistedOnDomain(url, frameHierarchy); |
| + } |
| +} |
| + |
| void CPluginTabBase::OnDownloadComplete(IWebBrowser2* browser) |
| { |
| CPluginClient* client = CPluginClient::GetInstance(); |