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

Unified Diff: src/plugin/PluginClass.cpp

Issue 5750789393874944: [IE] First round of ATL removal (Closed)
Patch Set: Created June 20, 2014, 9:22 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/plugin/PluginClass.cpp
===================================================================
--- a/src/plugin/PluginClass.cpp
+++ b/src/plugin/PluginClass.cpp
@@ -17,6 +17,9 @@
#include "../shared/Dictionary.h"
#include <thread>
+#include "COM_Client.h"
+#include "Wrapper.h"
+
#ifdef DEBUG_HIDE_EL
DWORD profileTime = 0;
#endif
@@ -46,7 +49,7 @@
CComQIPtr<IWebBrowser2> CPluginClass::s_asyncWebBrowser2;
#ifdef SUPPORT_WHITELIST
-std::map<UINT,CString> CPluginClass::s_menuDomains;
+std::map<UINT,std::wstring> CPluginClass::s_menuDomains;
#endif
@@ -70,8 +73,7 @@
CPluginSystem* system = CPluginSystem::GetInstance();
- std::wstring locale((LPCWSTR)system->GetBrowserLanguage());
- Dictionary::Create(locale);
+ Dictionary::Create( system->GetBrowserLanguage() );
}
CPluginClass::~CPluginClass()
@@ -112,7 +114,7 @@
HRESULT hr = pContainer->FindConnectionPoint(DIID_DWebBrowserEvents2, &pPoint);
if (FAILED(hr))
{
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_FIND_CONNECTION_POINT, "Class::GetConnectionPoint - FindConnectionPoint")
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_FIND_CONNECTION_POINT, L"Class::GetConnectionPoint - FindConnectionPoint")
return NULL;
}
@@ -133,7 +135,7 @@
HRESULT hr = pContainer->FindConnectionPoint(IID_IPropertyNotifySink, &pPoint);
if (FAILED(hr))
{
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_FIND_CONNECTION_POINT, "Class::GetConnectionPoint - FindConnectionPoint")
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_FIND_CONNECTION_POINT, L"Class::GetConnectionPoint - FindConnectionPoint")
return NULL;
}
@@ -151,7 +153,7 @@
HRESULT hr = browser->get_HWND(&hBrowserWndHandle);
if (FAILED(hr))
{
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_BROWSER_WINDOW, "Class::GetBrowserHWND - failed")
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_BROWSER_WINDOW, L"Class::GetBrowserHWND - failed")
}
}
@@ -186,26 +188,23 @@
return browser;
}
-CString CPluginClass::GetBrowserUrl() const
+std::wstring CPluginClass::GetBrowserUrl() const
{
- CString url;
+ std::wstring url;
- CComQIPtr<IWebBrowser2> browser = GetBrowser();
- if (browser)
+ CComQIPtr<IWebBrowser2> ccom_browser = GetBrowser();
+ if (ccom_browser)
{
- CComBSTR bstrURL;
-
- if (SUCCEEDED(browser->get_LocationURL(&bstrURL)))
+ Wrapper::Browser browser( ccom_browser );
+ if ( browser.Location_URL( url ) )
{
- url = bstrURL;
- CPluginClient::UnescapeUrl(url);
+ Wrapper::Unescape_URL( url );
}
}
else
{
url = m_tab->GetDocumentUrl();
}
-
return url;
}
@@ -237,13 +236,17 @@
if (unknownSite)
{
-
- DEBUG_GENERAL(L"================================================================================\nNEW TAB UI\n================================================================================")
+ std::wstring t[] = {
+ L"================================================================================",
+ L"NEW TAB UI",
+ L"================================================================================"
+ };
+ DEBUG_GENERAL(t);
HRESULT hr = ::CoInitialize(NULL);
if (FAILED(hr))
{
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_COINIT, "Class::SetSite - CoInitialize");
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_COINIT, L"Class::SetSite - CoInitialize");
}
s_criticalSectionBrowser.Lock();
@@ -270,7 +273,7 @@
// Check if loaded as BHO
if (GetBrowser())
{
- DEBUG_GENERAL("Loaded as BHO");
+ DEBUG_GENERAL(L"Loaded as BHO");
CComPtr<IConnectionPoint> pPoint = GetConnectionPoint();
if (pPoint)
{
@@ -286,20 +289,20 @@
}
catch (const std::system_error& ex)
{
- auto errDescription = std::string("Class::Thread - Failed to create StartInitObject thread, ") +
- ex.code().message() + ex.what();
- DEBUG_ERROR_LOG(ex.code().value(), PLUGIN_ERROR_THREAD, PLUGIN_ERROR_MAIN_THREAD_CREATE_PROCESS, errDescription.c_str());
+ std::wstring errDescription( L"Class::Thread - Failed to create StartInitObject thread, " );
+ errDescription += ABP::debug::widen( ex.code().message() + ex.what() );
+ DEBUG_ERROR_LOG( ex.code().value(), PLUGIN_ERROR_THREAD, PLUGIN_ERROR_MAIN_THREAD_CREATE_PROCESS, errDescription );
}
}
else
{
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_ADVICE, "Class::SetSite - Advice");
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_ADVICE, L"Class::SetSite - Advice");
}
}
}
else // Check if loaded as toolbar handler
{
- DEBUG_GENERAL("Loaded as toolbar handler");
+ DEBUG_GENERAL(L"Loaded as toolbar handler");
CComPtr<IServiceProvider> pServiceProvider;
HRESULT hr = unknownSite->QueryInterface(&pServiceProvider);
@@ -319,7 +322,7 @@
}
else
{
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_QUERY_BROWSER, "Class::SetSite - QueryService (IID_IWebBrowserApp)");
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_QUERY_BROWSER, L"Class::SetSite - QueryService (IID_IWebBrowserApp)");
}
}
s_criticalSectionBrowser.Unlock();
@@ -327,7 +330,7 @@
}
else
{
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_QUERY_SERVICE_PROVIDER, "Class::SetSite - QueryInterface (service provider)");
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_QUERY_SERVICE_PROVIDER, L"Class::SetSite - QueryInterface (service provider)");
}
}
}
@@ -386,7 +389,12 @@
}
s_criticalSectionBrowser.Unlock();
- DEBUG_GENERAL("================================================================================\nNEW TAB UI - END\n================================================================================")
+ std::wstring t[] = {
+ L"================================================================================",
+ L"NEW TAB UI - END",
+ L"================================================================================"
+ };
+ DEBUG_GENERAL( t );
::CoUninitialize();
}
@@ -396,7 +404,7 @@
bool CPluginClass::IsStatusBarEnabled()
{
- DEBUG_GENERAL("IsStatusBarEnabled start");
+ DEBUG_GENERAL(L"IsStatusBarEnabled start");
HKEY pHkey;
HKEY pHkeySub;
RegOpenCurrentUser(KEY_QUERY_VALUE, &pHkey);
@@ -417,28 +425,29 @@
}
}
}
- DEBUG_GENERAL("IsStatusBarEnabled end");
+ DEBUG_GENERAL(L"IsStatusBarEnabled end");
return trueth == 1;
}
void CPluginClass::ShowStatusBar()
{
- DEBUG_GENERAL("ShowStatusBar start");
+ DEBUG_GENERAL(L"ShowStatusBar start");
VARIANT_BOOL isVisible;
- CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser();
- if (browser)
+ CComQIPtr<IWebBrowser2> ccom_browser = GetAsyncBrowser();
+ if (ccom_browser)
{
+ Wrapper::Browser browser( ccom_browser );
HRESULT hr = S_OK;
- hr = browser->get_StatusBar(&isVisible);
+ hr = ccom_browser->get_StatusBar(&isVisible);
if (SUCCEEDED(hr))
{
if (!isVisible)
{
SHANDLE_PTR pBrowserHWnd;
- browser->get_HWND((SHANDLE_PTR*)&pBrowserHWnd);
+ ccom_browser->get_HWND((SHANDLE_PTR*)&pBrowserHWnd);
Dictionary* dictionary = Dictionary::GetInstance();
HKEY pHkey;
@@ -470,41 +479,33 @@
regRes = RegOpenKey(pHkey, L"Software\\Microsoft\\Internet Explorer\\Main", &pHkeySub);
regRes = RegSetValueEx(pHkeySub, L"StatusBarWeb", 0, REG_DWORD, (BYTE*)&trueth, sizeof(DWORD));
regRes = RegCloseKey(pHkeySub);
- hr = browser->put_StatusBar(TRUE);
+ hr = ccom_browser->put_StatusBar(TRUE);
if (FAILED(hr))
{
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_PUT_STATUSBAR, "Class::Enable statusbar");
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_PUT_STATUSBAR, L"Class::Enable statusbar");
}
CreateStatusBarPane();
- // We need to restart the tab now, to enable the status bar properly
- VARIANT vFlags;
- vFlags.vt = VT_I4;
- vFlags.intVal = navOpenInNewTab;
-
- CComBSTR curLoc;
- browser->get_LocationURL(&curLoc);
- HRESULT hr = browser->Navigate(curLoc, &vFlags, NULL, NULL, NULL);
- if (FAILED(hr))
+ /*
+ * We need to restart the tab now, to enable the status bar properly
+ */
+ std::wstring location;
+ browser.Location_URL( location );
+ HRESULT hr = browser.navigate( location );
+ if ( FAILED(hr) )
{
- vFlags.intVal = navOpenInNewWindow;
-
- hr = browser->Navigate(CComBSTR(curLoc), &vFlags, NULL, NULL, NULL);
- if (FAILED(hr))
- {
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION, "Navigation::Failed")
- }
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION, L"Navigation::Failed")
}
- browser->Quit();
+ ccom_browser->Quit();
}
}
}
else
{
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, "Class::Get statusbar state");
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, L"Class::Get statusbar state");
}
}
- DEBUG_GENERAL("ShowStatusBar end");
+ DEBUG_GENERAL(L"ShowStatusBar end");
}
void CPluginClass::BeforeNavigate2(DISPPARAMS* pDispParams)
@@ -525,6 +526,7 @@
VARTYPE vt = pDispParams->rgvarg[6].vt;
if (vt == VT_DISPATCH)
{
+ // The implementation of this assignment operator contains the QueryInterface call.
WebBrowser2Ptr = pDispParams->rgvarg[6].pdispVal;
}
else
@@ -534,13 +536,12 @@
}
// Get the URL
- CString url;
+ std::wstring url;
vt = pDispParams->rgvarg[5].vt;
if (vt == VT_BYREF + VT_VARIANT)
{
url = pDispParams->rgvarg[5].pvarVal->bstrVal;
-
- CPluginClient::UnescapeUrl(url);
+ Wrapper::Unescape_URL( url );
}
else
{
@@ -551,17 +552,23 @@
// If webbrowser2 is equal to top level browser (as set in SetSite), we are navigating new page
CPluginClient* client = CPluginClient::GetInstance();
- if (url.Find(L"javascript") == 0)
+ // This comparison means "begins with"
+ if ( url.compare( 0, 10, L"javascript" ) == 0 )
{
}
else if (GetBrowser().IsEqualObject(WebBrowser2Ptr))
{
- m_tab->OnNavigate(url);
+ m_tab->OnNavigate( url );
- DEBUG_GENERAL(L"================================================================================\nBegin main navigation url:" + url + "\n================================================================================")
+ std::wstring t[] = {
+ L"================================================================================",
+ L"Begin main navigation url:" + url,
+ L"================================================================================"
+ };
+ DEBUG_GENERAL( t );
#ifdef ENABLE_DEBUG_RESULT
- CPluginDebug::DebugResultDomain(url);
+ CPluginDebug::DebugResultDomain( url );
#endif
UpdateStatusBar();
@@ -571,13 +578,13 @@
DEBUG_NAVI(L"Navi::Begin navigation url:" + url)
#ifdef SUPPORT_FRAME_CACHING
- m_tab->CacheFrame(url);
+ m_tab->CacheFrame( url );
#endif
}
}
STDMETHODIMP CPluginClass::OnTabChanged(DISPPARAMS* pDispParams, WORD wFlags)
{
- DEBUG_GENERAL("Tab changed");
+ DEBUG_GENERAL(L"Tab changed");
bool newtabshown = pDispParams->rgvarg[1].intVal==3;
if (newtabshown)
{
@@ -599,7 +606,7 @@
}
}
notificationMessage.Hide();
- DEBUG_GENERAL("Tab change end");
+ DEBUG_GENERAL(L"Tab change end");
return VARIANT_TRUE;
}
@@ -700,22 +707,19 @@
{
DEBUG_NAVI("Navi::Document Complete")
- CComQIPtr<IWebBrowser2> browser = GetBrowser();
+ CComQIPtr<IWebBrowser2> ccom_browser = GetBrowser();
- if (browser && pDispParams->cArgs >= 2 && pDispParams->rgvarg[1].vt == VT_DISPATCH)
+ if (ccom_browser && pDispParams->cArgs >= 2 && pDispParams->rgvarg[1].vt == VT_DISPATCH)
{
CComQIPtr<IWebBrowser2> pBrowser = pDispParams->rgvarg[1].pdispVal;
if (pBrowser)
{
- CString url;
- CComBSTR bstrUrl;
- if (SUCCEEDED(pBrowser->get_LocationURL(&bstrUrl)) && ::SysStringLen(bstrUrl) > 0)
+ Wrapper::Browser browser( pBrowser );
+ std::wstring url;
+ if ( browser.Location_URL( url ) && !url.empty() )
{
- url = bstrUrl;
-
- CPluginClient::UnescapeUrl(url);
-
- m_tab->OnDocumentComplete(browser, url, browser.IsEqualObject(pBrowser));
+ Wrapper::Unescape_URL(url);
+ m_tab->OnDocumentComplete(ccom_browser, url, ccom_browser.IsEqualObject(pBrowser));
}
}
}
@@ -731,10 +735,10 @@
default:
{
- CString did;
- did.Format(L"DispId:%u", dispidMember);
-
- DEBUG_NAVI(L"Navi::Default " + did)
+ std::wostringstream msg;
+ msg << L"Navi::Default DispId:";
+ msg << static_cast< unsigned long >( dispidMember );
+ DEBUG_NAVI( msg.str() )
}
// do nothing
@@ -746,7 +750,7 @@
bool CPluginClass::InitObject(bool bBHO)
{
- DEBUG_GENERAL("InitObject");
+ DEBUG_GENERAL(L"InitObject");
CPluginSettings* settings = CPluginSettings::GetInstance();
if (!settings->GetPluginEnabled())
@@ -759,30 +763,30 @@
{
if (!s_hUxtheme)
{
- s_hUxtheme = ::GetModuleHandle(_T("uxtheme.dll"));
+ s_hUxtheme = ::GetModuleHandleW(L"uxtheme.dll");
if (s_hUxtheme)
{
pfnClose = (CLOSETHEMEDATA)::GetProcAddress(s_hUxtheme, "CloseThemeData");
if (!pfnClose)
{
- DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_UXTHEME_CLOSE, "Class::InitObject - GetProcAddress(CloseThemeData)");
+ DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_UXTHEME_CLOSE, L"Class::InitObject - GetProcAddress(CloseThemeData)");
}
pfnDrawThemeBackground = (DRAWTHEMEBACKGROUND)::GetProcAddress(s_hUxtheme, "DrawThemeBackground");
if (!pfnDrawThemeBackground)
{
- DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_UXTHEME_DRAW_BACKGROUND, "Class::InitObject - GetProcAddress(DrawThemeBackground)");
+ DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_UXTHEME_DRAW_BACKGROUND, L"Class::InitObject - GetProcAddress(DrawThemeBackground)");
}
pfnOpenThemeData = (OPENTHEMEDATA)::GetProcAddress(s_hUxtheme, "OpenThemeData");
if (!pfnOpenThemeData)
{
- DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_UXTHEME_OPEN, "Class::InitObject - GetProcAddress(pfnOpenThemeData)");
+ DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_UXTHEME_OPEN, L"Class::InitObject - GetProcAddress(pfnOpenThemeData)");
}
}
else
{
- DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_UXTHEME, "Class::InitObject - GetModuleHandle(uxtheme.dll)");
+ DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_UXTHEME, L"Class::InitObject - GetModuleHandle(uxtheme.dll)");
}
}
}
@@ -814,7 +818,7 @@
if (!GetAtomPaneClass())
{
- DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_REGISTER_PANE_CLASS, "Class::InitObject - RegisterClassEx");
+ DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_REGISTER_PANE_CLASS, L"Class::InitObject - RegisterClassEx");
return false;
}
}
@@ -858,7 +862,7 @@
HWND hBrowserWnd = GetBrowserHWND();
if (!hBrowserWnd)
{
- DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "Class::CreateStatusBarPane - No status bar")
+ DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, L"Class::CreateStatusBarPane - No status bar")
return false;
}
@@ -940,7 +944,7 @@
if (!hWndStatusBar)
{
- DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, "Class::CreateStatusBarPane - No status bar")
+ DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, L"Class::CreateStatusBarPane - No status bar")
return true;
}
@@ -978,11 +982,11 @@
if (!hWndNewPane)
{
- DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_STATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx")
+ DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_STATUSBAR_PANE, L"Class::CreateStatusBarPane - CreateWindowEx")
return false;
}
- DEBUG_GENERAL("ABP window created");
+ DEBUG_GENERAL(L"ABP window created");
m_hTabWnd = hTabWnd;
m_hStatusBarWnd = hWndStatusBar;
m_hPaneWnd = hWndNewPane;
@@ -1015,24 +1019,15 @@
void CPluginClass::FirstRunThread()
{
CoInitialize(NULL);
- VARIANT vFlags;
- vFlags.vt = VT_I4;
- vFlags.intVal = navOpenInNewTab;
- CComBSTR navigatePath = CComBSTR(FirstRunPageFileUrl().c_str());
-
- HRESULT hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL);
- if (FAILED(hr))
+ Wrapper::Browser browser( GetAsyncBrowser() );
+ HRESULT hr = browser.navigate( FirstRunPageFileUrl() );
+ if ( FAILED( hr ) )
{
- vFlags.intVal = navOpenInNewWindow;
- hr = GetAsyncBrowser()->Navigate(navigatePath, &vFlags, NULL, NULL, NULL);
- }
-
- if (FAILED(hr))
- {
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME, "Navigation::Welcome page failed")
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME, L"Navigation::Welcome page failed")
}
}
+
void CPluginClass::CloseTheme()
{
if (m_hTheme)
@@ -1113,9 +1108,9 @@
return S_OK;
}
-HMENU CPluginClass::CreatePluginMenu(const CString& url)
+HMENU CPluginClass::CreatePluginMenu(const std::wstring & url)
{
- DEBUG_GENERAL("CreatePluginMenu");
+ DEBUG_GENERAL(L"CreatePluginMenu");
HINSTANCE hInstance = _AtlBaseModule.GetModuleInstance();
HMENU hMenu = ::LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1));
@@ -1310,21 +1305,11 @@
CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser();
if (browser)
{
- VARIANT vFlags;
- vFlags.vt = VT_I4;
- vFlags.intVal = navOpenInNewTab;
-
- BSTR urlToNavigate = BString(UserSettingsFileUrl());
- HRESULT hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL);
- if (FAILED(hr))
+ Wrapper::Browser b( browser );
+ HRESULT hr = b.navigate( UserSettingsFileUrl() );
+ if ( FAILED(hr) )
{
- vFlags.intVal = navOpenInNewWindow;
-
- hr = browser->Navigate(urlToNavigate, &vFlags, NULL, NULL, NULL);
- if (FAILED(hr))
- {
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_SETTINGS, "Navigation::Failed")
- }
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_SETTINGS, L"Navigation::Failed")
}
}
break;
@@ -1332,14 +1317,14 @@
case ID_MENU_DISABLE_ON_SITE:
{
CPluginSettings* settings = CPluginSettings::GetInstance();
- CString urlString = GetTab()->GetDocumentUrl();
- if (client->IsWhitelistedUrl(std::wstring(urlString)))
+ std::wstring urlString = GetTab()->GetDocumentUrl();
+ if (client->IsWhitelistedUrl(urlString))
{
- settings->RemoveWhiteListedDomain(client->GetHostFromUrl(urlString.GetString()).c_str());
+ settings->RemoveWhiteListedDomain( client->GetHostFromUrl( urlString ).c_str() );
}
else
{
- settings->AddWhiteListedDomain(client->GetHostFromUrl(urlString.GetString()).c_str());
+ settings->AddWhiteListedDomain( client->GetHostFromUrl( urlString).c_str());
}
GetBrowser()->Refresh();
}
@@ -1352,9 +1337,9 @@
}
-bool CPluginClass::SetMenuBar(HMENU hMenu, const CString& url)
+bool CPluginClass::SetMenuBar(HMENU hMenu, const std::wstring & url)
{
- DEBUG_GENERAL("SetMenuBar");
+ DEBUG_GENERAL(L"SetMenuBar");
std::wstring ctext;
@@ -1387,7 +1372,7 @@
{
ctext = dictionary->Lookup("menu", "menu-disable-on-site");
// Is domain in white list?
- ReplaceString(ctext, L"?1?", client->GetHostFromUrl(url.GetString()));
+ ReplaceString(ctext, L"?1?", client->GetHostFromUrl(url));
if (client->IsWhitelistedUrl(std::wstring(GetTab()->GetDocumentUrl())))
{
fmii.fState = MFS_CHECKED | MFS_ENABLED;
@@ -1608,7 +1593,7 @@
}
-HICON CPluginClass::GetStatusBarIcon(const CString& url)
+HICON CPluginClass::GetStatusBarIcon(const std::wstring & url)
{
// use the disable icon as defualt, if the client doesn't exists
HICON hIcon = GetIcon(ICON_PLUGIN_DEACTIVATED);
@@ -1623,7 +1608,7 @@
{
}
#ifdef SUPPORT_WHITELIST
- else if (client->IsWhitelistedUrl(std::wstring(url)))
+ else if (client->IsWhitelistedUrl( url ))
{
hIcon = GetIcon(ICON_PLUGIN_DISABLED);
}
@@ -1715,7 +1700,7 @@
// Draw icon
if (CPluginClient::GetInstance())
{
- HICON hIcon = GetStatusBarIcon(pClass->GetTab()->GetDocumentUrl());
+ HICON hIcon = GetStatusBarIcon(pClass->GetTab()->GetDocumentUrl().c_str());
int offx = (rcClient.Height() - 16)/2 + nDrawEdge;
if (hIcon)
@@ -1746,14 +1731,14 @@
case WM_LBUTTONUP:
case WM_RBUTTONUP:
{
- CString strURL = pClass->GetBrowserUrl();
- if (strURL != pClass->GetTab()->GetDocumentUrl())
+ std::wstring url = pClass->GetBrowserUrl();
+ if (url != pClass->GetTab()->GetDocumentUrl())
{
- pClass->GetTab()->SetDocumentUrl(strURL);
+ pClass->GetTab()->SetDocumentUrl( url );
}
// Create menu
- HMENU hMenu = pClass->CreatePluginMenu(strURL);
+ HMENU hMenu = pClass->CreatePluginMenu( url );
if (!hMenu)
{
return 0;
@@ -1847,14 +1832,14 @@
void CPluginClass::UpdateStatusBar()
{
- DEBUG_GENERAL("*** Updating statusbar")
+ DEBUG_GENERAL(L"*** Updating statusbar")
if (m_hPaneWnd == NULL)
{
CreateStatusBarPane();
}
if ((m_hPaneWnd != NULL) && !::InvalidateRect(m_hPaneWnd, NULL, FALSE))
{
- DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_INVALIDATE_STATUSBAR, "Class::Invalidate statusbar");
+ DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_INVALIDATE_STATUSBAR, L"Class::Invalidate statusbar");
}
}
@@ -1871,7 +1856,7 @@
HRESULT hr = pPoint->Unadvise(m_nConnectionID);
if (FAILED(hr))
{
- DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_UNADVICE, "Class::Unadvice - Unadvise");
+ DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_UNADVICE, L"Class::Unadvice - Unadvise");
}
}
@@ -1892,7 +1877,7 @@
s_hIcons[type] = ::LoadIcon(_Module.m_hInst, MAKEINTRESOURCE(s_hIconTypes[type]));
if (!s_hIcons[type])
{
- DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_LOAD_ICON, "Class::GetIcon - LoadIcon")
+ DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_LOAD_ICON, L"Class::GetIcon - LoadIcon")
}
}
@@ -1916,7 +1901,7 @@
HWND hBrowserWnd = GetBrowserHWND();
if (!hBrowserWnd)
{
- DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "Class::GetTabWindow - No tab window")
+ DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, L"Class::GetTabWindow - No tab window")
s_criticalSectionWindow.Unlock();
return false;

Powered by Google App Engine
This is Rietveld