OLD | NEW |
1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
2 | 2 |
3 #include "PluginClass.h" | 3 #include "PluginClass.h" |
| 4 #include "COM_Value.h" |
4 #include "PluginSettings.h" | 5 #include "PluginSettings.h" |
5 #include "PluginSystem.h" | 6 #include "PluginSystem.h" |
6 #ifdef SUPPORT_FILTER | 7 #ifdef SUPPORT_FILTER |
7 #include "PluginFilter.h" | 8 #include "PluginFilter.h" |
8 #endif | 9 #endif |
9 #include "PluginMimeFilterClient.h" | 10 #include "PluginMimeFilterClient.h" |
10 #include "PluginClient.h" | 11 #include "PluginClient.h" |
11 #include "PluginClientFactory.h" | 12 #include "PluginClientFactory.h" |
12 #include "PluginMutex.h" | 13 #include "PluginMutex.h" |
13 #include "sddl.h" | 14 #include "sddl.h" |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 return browser; | 212 return browser; |
212 } | 213 } |
213 | 214 |
214 CString CPluginClass::GetBrowserUrl() const | 215 CString CPluginClass::GetBrowserUrl() const |
215 { | 216 { |
216 CString url; | 217 CString url; |
217 | 218 |
218 CComQIPtr<IWebBrowser2> browser = GetBrowser(); | 219 CComQIPtr<IWebBrowser2> browser = GetBrowser(); |
219 if (browser) | 220 if (browser) |
220 { | 221 { |
221 CComBSTR bstrURL; | 222 AdblockPlus::COM::BSTR_ParamResult result; |
222 | 223 if (SUCCEEDED(browser->get_LocationURL(&result))) |
223 if (SUCCEEDED(browser->get_LocationURL(&bstrURL))) | |
224 { | 224 { |
225 url = bstrURL; | 225 url = to_CString(result); |
226 CPluginClient::UnescapeUrl(url); | 226 CPluginClient::UnescapeUrl(url); |
227 } | 227 } |
228 } | 228 } |
229 else | 229 else |
230 { | 230 { |
231 url = m_tab->GetDocumentUrl(); | 231 url = m_tab->GetDocumentUrl(); |
232 } | 232 } |
233 | 233 |
234 return url; | 234 return url; |
235 } | 235 } |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 { | 500 { |
501 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_PUT_STATUSBAR,
"Class::Enable statusbar"); | 501 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_PUT_STATUSBAR,
"Class::Enable statusbar"); |
502 } | 502 } |
503 CreateStatusBarPane(); | 503 CreateStatusBarPane(); |
504 | 504 |
505 // We need to restart the tab now, to enable the status bar properly | 505 // We need to restart the tab now, to enable the status bar properly |
506 VARIANT vFlags; | 506 VARIANT vFlags; |
507 vFlags.vt = VT_I4; | 507 vFlags.vt = VT_I4; |
508 vFlags.intVal = navOpenInNewTab; | 508 vFlags.intVal = navOpenInNewTab; |
509 | 509 |
510 CComBSTR curLoc; | 510 AdblockPlus::COM::BSTR_ParamResult curLoc; |
511 browser->get_LocationURL(&curLoc); | 511 browser->get_LocationURL(&curLoc); |
512 HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL); | 512 std::wstring location = curLoc; |
| 513 AdblockPlus::COM::BSTR_ParamArgument targetLocation(location); |
| 514 HRESULT hr = browser->Navigate(targetLocation, &vFlags, NULL, NULL, NU
LL); |
513 if (FAILED(hr)) | 515 if (FAILED(hr)) |
514 { | 516 { |
515 vFlags.intVal = navOpenInNewWindow; | 517 vFlags.intVal = navOpenInNewWindow; |
516 | 518 |
517 hr = browser->Navigate(CComBSTR(curLoc), &vFlags, NULL, NULL, NULL); | 519 hr = browser->Navigate(targetLocation, &vFlags, NULL, NULL, NULL); |
518 if (FAILED(hr)) | 520 if (FAILED(hr)) |
519 { | 521 { |
520 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATI
ON, "Navigation::Failed") | 522 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATI
ON, "Navigation::Failed") |
521 } | 523 } |
522 } | 524 } |
523 browser->Quit(); | 525 browser->Quit(); |
524 } | 526 } |
525 } | 527 } |
526 } | 528 } |
527 else | 529 else |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
726 DEBUG_NAVI("Navi::Document Complete") | 728 DEBUG_NAVI("Navi::Document Complete") |
727 | 729 |
728 CComQIPtr<IWebBrowser2> browser = GetBrowser(); | 730 CComQIPtr<IWebBrowser2> browser = GetBrowser(); |
729 | 731 |
730 if (browser && pDispParams->cArgs >= 2 && pDispParams->rgvarg[1].vt == VT_
DISPATCH) | 732 if (browser && pDispParams->cArgs >= 2 && pDispParams->rgvarg[1].vt == VT_
DISPATCH) |
731 { | 733 { |
732 CComQIPtr<IWebBrowser2> pBrowser = pDispParams->rgvarg[1].pdispVal; | 734 CComQIPtr<IWebBrowser2> pBrowser = pDispParams->rgvarg[1].pdispVal; |
733 if (pBrowser) | 735 if (pBrowser) |
734 { | 736 { |
735 CString url; | 737 CString url; |
736 CComBSTR bstrUrl; | 738 AdblockPlus::COM::BSTR_ParamResult result; |
737 if (SUCCEEDED(pBrowser->get_LocationURL(&bstrUrl)) && ::SysStringLen(b
strUrl) > 0) | 739 if (SUCCEEDED(pBrowser->get_LocationURL(&result)) && !result.operator
std::wstring().empty()) |
738 { | 740 { |
739 url = bstrUrl; | 741 url = to_CString(result); |
740 | 742 |
741 CPluginClient::UnescapeUrl(url); | 743 CPluginClient::UnescapeUrl(url); |
742 | 744 |
743 m_tab->OnDocumentComplete(browser, url, browser.IsEqualObject(pBrows
er)); | 745 m_tab->OnDocumentComplete(browser, url, browser.IsEqualObject(pBrows
er)); |
744 } | 746 } |
745 } | 747 } |
746 } | 748 } |
747 } | 749 } |
748 break; | 750 break; |
749 | 751 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 return true; | 1037 return true; |
1036 } | 1038 } |
1037 | 1039 |
1038 void CPluginClass::FirstRunThread() | 1040 void CPluginClass::FirstRunThread() |
1039 { | 1041 { |
1040 CoInitialize(NULL); | 1042 CoInitialize(NULL); |
1041 VARIANT vFlags; | 1043 VARIANT vFlags; |
1042 vFlags.vt = VT_I4; | 1044 vFlags.vt = VT_I4; |
1043 vFlags.intVal = navOpenInNewTab; | 1045 vFlags.intVal = navOpenInNewTab; |
1044 | 1046 |
1045 CComBSTR navigatePath = CComBSTR(FirstRunPageFileUrl().c_str()); | 1047 AdblockPlus::COM::BSTR_ParamArgument navigatePath(FirstRunPageFileUrl()); |
1046 | |
1047 HRESULT hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NU
LL); | 1048 HRESULT hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NU
LL); |
1048 if (FAILED(hr)) | 1049 if (FAILED(hr)) |
1049 { | 1050 { |
1050 vFlags.intVal = navOpenInNewWindow; | 1051 vFlags.intVal = navOpenInNewWindow; |
1051 hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL); | 1052 hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL); |
1052 } | 1053 } |
1053 | 1054 |
1054 if (FAILED(hr)) | 1055 if (FAILED(hr)) |
1055 { | 1056 { |
1056 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME
, "Navigation::Welcome page failed") | 1057 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME
, "Navigation::Welcome page failed") |
(...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1994 } | 1995 } |
1995 } | 1996 } |
1996 } | 1997 } |
1997 | 1998 |
1998 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1999 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
1999 } | 2000 } |
2000 | 2001 |
2001 return hTabWnd; | 2002 return hTabWnd; |
2002 | 2003 |
2003 } | 2004 } |
OLD | NEW |