Index: src/plugin/PluginClass.cpp |
=================================================================== |
--- a/src/plugin/PluginClass.cpp |
+++ b/src/plugin/PluginClass.cpp |
@@ -271,6 +271,7 @@ |
// Check if loaded as BHO |
if (GetBrowser()) |
{ |
+ DEBUG_GENERAL("Loaded as BHO"); |
CComPtr<IConnectionPoint> pPoint = GetConnectionPoint(); |
if (pPoint) |
{ |
@@ -295,6 +296,7 @@ |
} |
else // Check if loaded as toolbar handler |
{ |
+ DEBUG_GENERAL("Loaded as toolbar handler"); |
CComPtr<IServiceProvider> pServiceProvider; |
HRESULT hr = unknownSite->QueryInterface(&pServiceProvider); |
@@ -328,6 +330,7 @@ |
} |
catch (std::runtime_error e) |
{ |
+ DEBUG_ERROR(e.what()); |
Unadvice(); |
} |
} |
@@ -390,6 +393,7 @@ |
bool CPluginClass::IsStatusBarEnabled() |
{ |
+ DEBUG_GENERAL("IsStatusBarEnabled start"); |
HKEY pHkey; |
HKEY pHkeySub; |
RegOpenCurrentUser(KEY_QUERY_VALUE, &pHkey); |
@@ -410,11 +414,14 @@ |
} |
} |
} |
+ DEBUG_GENERAL("IsStatusBarEnabled end"); |
return trueth == 1; |
} |
void CPluginClass::ShowStatusBar() |
{ |
+ DEBUG_GENERAL("ShowStatusBar start"); |
+ |
VARIANT_BOOL isVisible; |
@@ -494,6 +501,7 @@ |
DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR, "Class::Get statusbar state"); |
} |
} |
+ DEBUG_GENERAL("ShowStatusBar end"); |
} |
void CPluginClass::BeforeNavigate2(DISPPARAMS* pDispParams) |
@@ -566,6 +574,7 @@ |
} |
STDMETHODIMP CPluginClass::OnTabChanged(DISPPARAMS* pDispParams, WORD wFlags) |
{ |
+ DEBUG_GENERAL("Tab changed"); |
bool newtabshown = pDispParams->rgvarg[1].intVal==3; |
if (newtabshown) |
{ |
@@ -586,6 +595,7 @@ |
} |
} |
} |
+ DEBUG_GENERAL("Tab change end"); |
return VARIANT_TRUE; |
} |
@@ -646,12 +656,15 @@ |
} |
else |
{ |
- RECT rect; |
- BOOL rectRes = GetClientRect(m_hStatusBarWnd, &rect); |
- if (rectRes == TRUE) |
+ if (CPluginClient::GetInstance()->GetIEVersion() > 6) |
{ |
- MoveWindow(m_hPaneWnd, rect.right - 200, 0, m_nPaneWidth, rect.bottom - rect.top, TRUE); |
- } |
+ RECT rect; |
+ BOOL rectRes = GetClientRect(m_hStatusBarWnd, &rect); |
+ if (rectRes == TRUE) |
+ { |
+ MoveWindow(m_hPaneWnd, rect.right - 200, 0, m_nPaneWidth, rect.bottom - rect.top, TRUE); |
Oleksandr
2013/08/19 08:19:13
This repositions the icon when IE is resized. IE6
|
+ } |
+ } |
} |
break; |
case DISPID_STATUSTEXTCHANGE: |
@@ -729,6 +742,7 @@ |
bool CPluginClass::InitObject(bool bBHO) |
{ |
+ DEBUG_GENERAL("InitObject"); |
CPluginSettings* settings = CPluginSettings::GetInstance(); |
if (!settings->GetPluginEnabled()) |
@@ -802,19 +816,20 @@ |
} |
+ int ieVersion = CPluginClient::GetInstance()->GetIEVersion(); |
// Create status pane |
- if (bBHO) |
+ if (bBHO && ieVersion > 6) |
Oleksandr
2013/08/19 08:19:13
This is an actual fix of the status bar icon for I
|
{ |
if (!CreateStatusBarPane()) |
Wladimir Palant
2013/08/19 14:49:40
This nested if isn't actually necessary, it can be
|
{ |
return false; |
} |
} |
- |
+ |
if (CPluginClient::GetInstance()->IsFirstRun()) |
{ |
// IE6 can't be accessed from another thread, execute in current thread |
- if (CPluginClient::GetInstance()->GetIEVersion() < 7) |
+ if (ieVersion < 7) |
{ |
FirstRunThread(); |
} |
@@ -833,16 +848,12 @@ |
bool CPluginClass::CreateStatusBarPane() |
{ |
- DEBUG_GENERAL(L"Getting client"); |
+ DEBUG_GENERAL(L"Going to create status bar"); |
+ CriticalSection::Lock lock(m_csStatusBar); |
+ DEBUG_GENERAL(L"Create status bar"); |
CPluginClient* client = CPluginClient::GetInstance(); |
- DEBUG_GENERAL(L"Getting ieversion"); |
- |
- if (client->GetIEVersion()< 7) |
- |
- return true; |
- |
TCHAR szClassName[MAX_PATH]; |
DEBUG_GENERAL(L"Getting browser wnd"); |
// Get browser window and url |
@@ -850,7 +861,7 @@ |
if (!hBrowserWnd) |
{ |
DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_BROWSER, "Class::CreateStatusBarPane - No status bar") |
- return false; |
+ return false; |
} |
// Looking for a TabWindowClass window in IE7 |
@@ -938,7 +949,7 @@ |
if (!hWndStatusBar) |
{ |
DEBUG_ERROR_LOG(0, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_NO_STATUSBAR_WIN, "Class::CreateStatusBarPane - No status bar") |
- return true; |
+ return true; |
} |
// Calculate pane height |
@@ -976,9 +987,10 @@ |
if (!hWndNewPane) |
{ |
DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_CREATE_STATUSBAR_PANE, "Class::CreateStatusBarPane - CreateWindowEx") |
- return false; |
+ return false; |
} |
+ DEBUG_GENERAL("ABP window created"); |
m_hTabWnd = hTabWnd; |
m_hStatusBarWnd = hWndStatusBar; |
m_hPaneWnd = hWndNewPane; |
@@ -988,6 +1000,7 @@ |
// Subclass status bar |
m_pWndProcStatus = (WNDPROC)SetWindowLongPtr(hWndStatusBar, GWLP_WNDPROC, (LPARAM)(WNDPROC)NewStatusProc); |
+ DEBUG_GENERAL("SetWindowLongPtr done"); |
// Adjust pane |
UINT nPartCount = ::SendMessage(m_hStatusBarWnd, SB_GETPARTS, 0, 0); |
@@ -998,12 +1011,16 @@ |
::SendMessage(m_hStatusBarWnd, SB_GETPARTS, nPartCount, (LPARAM)pData); |
::SendMessage(m_hStatusBarWnd, SB_SETPARTS, nPartCount, (LPARAM)pData); |
- delete[] pData; |
+ delete []pData; |
} |
+ |
+ DEBUG_GENERAL("Pane adjusted"); |
+ |
HDC hdc = GetWindowDC(m_hStatusBarWnd); |
SendMessage(m_hStatusBarWnd, WM_PAINT, (WPARAM)hdc, 0); |
ReleaseDC(m_hStatusBarWnd, hdc); |
- |
+ |
+ DEBUG_GENERAL("Released DC"); |
return true; |
} |
@@ -1110,6 +1127,7 @@ |
HMENU CPluginClass::CreatePluginMenu(const CString& url) |
{ |
+ DEBUG_GENERAL("CreatePluginMenu"); |
HINSTANCE hInstance = _AtlBaseModule.GetModuleInstance(); |
HMENU hMenu = ::LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU1)); |
@@ -1343,6 +1361,8 @@ |
bool CPluginClass::SetMenuBar(HMENU hMenu, const CString& url) |
{ |
+ DEBUG_GENERAL("SetMenuBar"); |
+ |
std::wstring ctext; |
s_criticalSectionLocal.Lock(); |
@@ -1353,11 +1373,6 @@ |
} |
s_criticalSectionLocal.Unlock(); |
- CPluginTab* tab = GetTab(::GetCurrentThreadId()); |
- if (!tab) |
- { |
- return false; |
- } |
Dictionary* dictionary = Dictionary::GetInstance(); |
@@ -1790,18 +1805,17 @@ |
void CPluginClass::UpdateStatusBar() |
{ |
DEBUG_GENERAL("*** Updating statusbar") |
- |
- if (m_hPaneWnd == NULL) |
+ if (m_hPaneWnd == NULL) |
+ { |
+ CreateStatusBarPane(); |
+ } |
+ if (m_hPaneWnd != NULL) |
+ { |
+ if (!::InvalidateRect(m_hPaneWnd, NULL, FALSE)) |
Felix Dahlke
2013/08/19 08:31:17
No need for a nested if, you can merge this with t
|
{ |
- CreateStatusBarPane(); |
+ DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_INVALIDATE_STATUSBAR, "Class::Invalidate statusbar"); |
} |
- if (m_hPaneWnd != NULL) |
- { |
- if (!::InvalidateRect(m_hPaneWnd, NULL, FALSE)) |
- { |
- DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_INVALIDATE_STATUSBAR, "Class::Invalidate statusbar"); |
- } |
- } |
+ } |
} |