Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginClass.cpp

Issue 5070706781978624: Issue #276 - introduce class BSTR_Argument (Closed)
Patch Set: clarified documentation for operator&, updated to_wstring(CString) Created July 30, 2014, 2:13 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/COM_Value.cpp ('k') | src/plugin/PluginDomTraverserBase.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_Argument 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
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_Argument curLoc;
511 browser->get_LocationURL(&curLoc); 511 browser->get_LocationURL(&curLoc);
512 HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL); 512 HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL);
513 if (FAILED(hr)) 513 if (FAILED(hr))
514 { 514 {
515 vFlags.intVal = navOpenInNewWindow; 515 vFlags.intVal = navOpenInNewWindow;
516 516
517 hr = browser->Navigate(CComBSTR(curLoc), &vFlags, NULL, NULL, NULL); 517 hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL);
518 if (FAILED(hr)) 518 if (FAILED(hr))
519 { 519 {
520 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATI ON, "Navigation::Failed") 520 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATI ON, "Navigation::Failed")
521 } 521 }
522 } 522 }
523 browser->Quit(); 523 browser->Quit();
524 } 524 }
525 } 525 }
526 } 526 }
527 else 527 else
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 DEBUG_NAVI("Navi::Document Complete") 726 DEBUG_NAVI("Navi::Document Complete")
727 727
728 CComQIPtr<IWebBrowser2> browser = GetBrowser(); 728 CComQIPtr<IWebBrowser2> browser = GetBrowser();
729 729
730 if (browser && pDispParams->cArgs >= 2 && pDispParams->rgvarg[1].vt == VT_ DISPATCH) 730 if (browser && pDispParams->cArgs >= 2 && pDispParams->rgvarg[1].vt == VT_ DISPATCH)
731 { 731 {
732 CComQIPtr<IWebBrowser2> pBrowser = pDispParams->rgvarg[1].pdispVal; 732 CComQIPtr<IWebBrowser2> pBrowser = pDispParams->rgvarg[1].pdispVal;
733 if (pBrowser) 733 if (pBrowser)
734 { 734 {
735 CString url; 735 CString url;
736 CComBSTR bstrUrl; 736 AdblockPlus::COM::BSTR_Argument result;
737 if (SUCCEEDED(pBrowser->get_LocationURL(&bstrUrl)) && ::SysStringLen(b strUrl) > 0) 737 if (SUCCEEDED(pBrowser->get_LocationURL(&result)) && !result.operator std::wstring().empty())
738 { 738 {
739 url = bstrUrl; 739 url = to_CString(result);
740 740
741 CPluginClient::UnescapeUrl(url); 741 CPluginClient::UnescapeUrl(url);
742 742
743 m_tab->OnDocumentComplete(browser, url, browser.IsEqualObject(pBrows er)); 743 m_tab->OnDocumentComplete(browser, url, browser.IsEqualObject(pBrows er));
744 } 744 }
745 } 745 }
746 } 746 }
747 } 747 }
748 break; 748 break;
749 749
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 return true; 1035 return true;
1036 } 1036 }
1037 1037
1038 void CPluginClass::FirstRunThread() 1038 void CPluginClass::FirstRunThread()
1039 { 1039 {
1040 CoInitialize(NULL); 1040 CoInitialize(NULL);
1041 VARIANT vFlags; 1041 VARIANT vFlags;
1042 vFlags.vt = VT_I4; 1042 vFlags.vt = VT_I4;
1043 vFlags.intVal = navOpenInNewTab; 1043 vFlags.intVal = navOpenInNewTab;
1044 1044
1045 CComBSTR navigatePath = CComBSTR(FirstRunPageFileUrl().c_str()); 1045 AdblockPlus::COM::BSTR_Argument navigatePath(FirstRunPageFileUrl());
1046
1047 HRESULT hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NU LL); 1046 HRESULT hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NU LL);
1048 if (FAILED(hr)) 1047 if (FAILED(hr))
1049 { 1048 {
1050 vFlags.intVal = navOpenInNewWindow; 1049 vFlags.intVal = navOpenInNewWindow;
1051 hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL); 1050 hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL);
1052 } 1051 }
1053 1052
1054 if (FAILED(hr)) 1053 if (FAILED(hr))
1055 { 1054 {
1056 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME , "Navigation::Welcome page failed") 1055 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
1994 } 1993 }
1995 } 1994 }
1996 } 1995 }
1997 1996
1998 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1997 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1999 } 1998 }
2000 1999
2001 return hTabWnd; 2000 return hTabWnd;
2002 2001
2003 } 2002 }
OLDNEW
« no previous file with comments | « src/plugin/COM_Value.cpp ('k') | src/plugin/PluginDomTraverserBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld