| OLD | NEW |
| 1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
| 2 | 2 |
| 3 #include "PluginClass.h" | 3 #include "PluginClass.h" |
| 4 #include "PluginSettings.h" | 4 #include "PluginSettings.h" |
| 5 #include "PluginSystem.h" | 5 #include "PluginSystem.h" |
| 6 #ifdef SUPPORT_FILTER | 6 #ifdef SUPPORT_FILTER |
| 7 #include "PluginFilter.h" | 7 #include "PluginFilter.h" |
| 8 #endif | 8 #endif |
| 9 #include "PluginMimeFilterClient.h" | 9 #include "PluginMimeFilterClient.h" |
| 10 #include "PluginClient.h" | 10 #include "PluginClient.h" |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 815 | 815 |
| 816 // Create status pane | 816 // Create status pane |
| 817 if (bBHO) | 817 if (bBHO) |
| 818 { | 818 { |
| 819 if (!CreateStatusBarPane()) | 819 if (!CreateStatusBarPane()) |
| 820 { | 820 { |
| 821 return false; | 821 return false; |
| 822 } | 822 } |
| 823 } | 823 } |
| 824 | 824 |
| 825 if (CPluginClient::GetInstance()->IsFirstRun()) |
| 826 { |
| 827 CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)CPluginClass::FirstRunThrea
d, NULL, NULL, NULL); |
| 828 } |
| 829 |
| 825 CPluginSettings* settings = CPluginSettings::GetInstance(); | 830 CPluginSettings* settings = CPluginSettings::GetInstance(); |
| 826 return true; | 831 return true; |
| 827 } | 832 } |
| 828 | 833 |
| 829 bool CPluginClass::CreateStatusBarPane() | 834 bool CPluginClass::CreateStatusBarPane() |
| 830 { | 835 { |
| 831 DEBUG_GENERAL(L"Getting client"); | 836 DEBUG_GENERAL(L"Getting client"); |
| 832 | 837 |
| 833 CPluginClient* client = CPluginClient::GetInstance(); | 838 CPluginClient* client = CPluginClient::GetInstance(); |
| 834 | 839 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 | 997 |
| 993 ::SendMessage(m_hStatusBarWnd, SB_GETPARTS, nPartCount, (LPARAM)pData); | 998 ::SendMessage(m_hStatusBarWnd, SB_GETPARTS, nPartCount, (LPARAM)pData); |
| 994 ::SendMessage(m_hStatusBarWnd, SB_SETPARTS, nPartCount, (LPARAM)pData); | 999 ::SendMessage(m_hStatusBarWnd, SB_SETPARTS, nPartCount, (LPARAM)pData); |
| 995 | 1000 |
| 996 delete[] pData; | 1001 delete[] pData; |
| 997 } | 1002 } |
| 998 HDC hdc = GetWindowDC(m_hStatusBarWnd); | 1003 HDC hdc = GetWindowDC(m_hStatusBarWnd); |
| 999 SendMessage(m_hStatusBarWnd, WM_PAINT, (WPARAM)hdc, 0); | 1004 SendMessage(m_hStatusBarWnd, WM_PAINT, (WPARAM)hdc, 0); |
| 1000 ReleaseDC(m_hStatusBarWnd, hdc); | 1005 ReleaseDC(m_hStatusBarWnd, hdc); |
| 1001 | 1006 |
| 1002 if (CPluginClient::GetInstance()->GetIsFirstRun()) | |
| 1003 { | |
| 1004 CreateThread(NULL, NULL, (LPTHREAD_START_ROUTINE)CPluginClass::FirstRunThrea
d, NULL, NULL, NULL); | |
| 1005 } | |
| 1006 | |
| 1007 return true; | 1007 return true; |
| 1008 } | 1008 } |
| 1009 | 1009 |
| 1010 void CPluginClass::FirstRunThread() | 1010 void CPluginClass::FirstRunThread() |
| 1011 { | 1011 { |
| 1012 // IE may still be not ready to navigate. Try until it is. | |
| 1013 VARIANT_BOOL isBusy = VARIANT_FALSE; | |
| 1014 while (GetAsyncBrowser()->get_Busy(&isBusy) == S_OK && isBusy != VARIANT_FALSE
) | |
| 1015 { | |
| 1016 Sleep(100); | |
| 1017 } | |
| 1018 VARIANT vFlags; | 1012 VARIANT vFlags; |
| 1019 vFlags.vt = VT_I4; | 1013 vFlags.vt = VT_I4; |
| 1020 vFlags.intVal = navOpenInNewTab; | 1014 vFlags.intVal = navOpenInNewTab; |
| 1021 | 1015 |
| 1022 READYSTATE readyState; | |
| 1023 HRESULT hr; | |
| 1024 while ((hr = GetAsyncBrowser()->get_ReadyState(&readyState) == S_OK) && (ready
State <= READYSTATE_LOADED)) | |
| 1025 { | |
| 1026 Sleep(100); | |
| 1027 } | |
| 1028 CComBSTR bTest = CComBSTR(UserSettingsFirstRunPageUrl().c_str()); | 1016 CComBSTR bTest = CComBSTR(UserSettingsFirstRunPageUrl().c_str()); |
| 1029 | 1017 |
| 1030 //Try 10 times, or until successful | 1018 //Try 10 times, or until successful |
| 1031 int numberOfAttempts = 0; | 1019 int numberOfAttempts = 0; |
| 1032 while ((hr != S_OK) && (numberOfAttempts < 10)) | 1020 HRESULT hr = S_FALSE; |
| 1021 hr = GetAsyncBrowser()->Navigate(bTest, &vFlags, NULL, NULL, NULL); |
| 1022 if (FAILED(hr)) |
| 1033 { | 1023 { |
| 1034 hr = GetAsyncBrowser()->Navigate(bTest, &vFlags, NULL, NULL, NULL); | 1024 vFlags.intVal = navOpenInNewWindow; |
| 1035 if (FAILED(hr)) | 1025 hr = GetAsyncBrowser()->Navigate(bTest, &vFlags, NULL, NULL, NULL); |
| 1036 { | 1026 } |
| 1037 vFlags.intVal = navOpenInNewWindow; | |
| 1038 | 1027 |
| 1039 hr = GetAsyncBrowser()->Navigate(bTest, &vFlags, NULL, NULL, NULL); | 1028 |
| 1040 if (FAILED(hr)) | |
| 1041 { | |
| 1042 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_SET
TINGS, "Navigation::Failed") | |
| 1043 } | |
| 1044 } | |
| 1045 Sleep(100); | |
| 1046 } | |
| 1047 if (FAILED(hr)) | 1029 if (FAILED(hr)) |
| 1048 { | 1030 { |
| 1049 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME
, "Navigation::Welcome page failed") | 1031 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION_WELCOME
, "Navigation::Welcome page failed") |
| 1050 } | 1032 } |
| 1051 } | 1033 } |
| 1052 void CPluginClass::CloseTheme() | 1034 void CPluginClass::CloseTheme() |
| 1053 { | 1035 { |
| 1054 if (m_hTheme) | 1036 if (m_hTheme) |
| 1055 { | 1037 { |
| 1056 if (pfnClose) | 1038 if (pfnClose) |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1929 } | 1911 } |
| 1930 } | 1912 } |
| 1931 } | 1913 } |
| 1932 | 1914 |
| 1933 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1915 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
| 1934 } | 1916 } |
| 1935 | 1917 |
| 1936 return hTabWnd; | 1918 return hTabWnd; |
| 1937 | 1919 |
| 1938 } | 1920 } |
| OLD | NEW |