| LEFT | RIGHT |
| (no file at all) | |
| 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" |
| 11 #include "PluginClientFactory.h" | 11 #include "PluginClientFactory.h" |
| 12 #include "PluginHttpRequest.h" | |
| 13 #include "PluginMutex.h" | 12 #include "PluginMutex.h" |
| 14 #include "DownloadSource.h" | |
| 15 #include "sddl.h" | 13 #include "sddl.h" |
| 16 #include "PluginUtil.h" | 14 #include "PluginUtil.h" |
| 17 #include "PluginUserSettings.h" | 15 #include "PluginUserSettings.h" |
| 18 | 16 |
| 19 #include "../shared/Dictionary.h" | 17 #include "../shared/Dictionary.h" |
| 20 | 18 |
| 21 #ifdef DEBUG_HIDE_EL | 19 #ifdef DEBUG_HIDE_EL |
| 22 DWORD profileTime = 0; | 20 DWORD profileTime = 0; |
| 23 #endif | 21 #endif |
| 24 | 22 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 m_hStatusBarWnd = NULL; | 63 m_hStatusBarWnd = NULL; |
| 66 m_hPaneWnd = NULL; | 64 m_hPaneWnd = NULL; |
| 67 m_nPaneWidth = 0; | 65 m_nPaneWidth = 0; |
| 68 m_pWndProcStatus = NULL; | 66 m_pWndProcStatus = NULL; |
| 69 m_hTheme = NULL; | 67 m_hTheme = NULL; |
| 70 m_isInitializedOk = false; | 68 m_isInitializedOk = false; |
| 71 | 69 |
| 72 | 70 |
| 73 m_tab = new CPluginTab(this); | 71 m_tab = new CPluginTab(this); |
| 74 | 72 |
| 75 // Load / create settings | |
| 76 CPluginSettings* settings = CPluginSettings::GetInstance(); | |
| 77 | |
| 78 CPluginSystem* system = CPluginSystem::GetInstance(); | 73 CPluginSystem* system = CPluginSystem::GetInstance(); |
| 79 | 74 |
| 80 std::wstring locale((LPCWSTR)system->GetBrowserLanguage()); | 75 std::wstring locale((LPCWSTR)system->GetBrowserLanguage()); |
| 81 Dictionary::Create(locale); | 76 Dictionary::Create(locale); |
| 82 | |
| 83 bool isMainTab = settings->IncrementTabCount(); | |
| 84 | |
| 85 if (isMainTab) | |
| 86 { | |
| 87 // Prepare settings | |
| 88 settings->SetMainProcessId(); | |
| 89 settings->SetMainUiThreadId(); | |
| 90 | |
| 91 // Ensure plugin version | |
| 92 if (!settings->Has(SETTING_PLUGIN_VERSION)) | |
| 93 { | |
| 94 settings->SetString(SETTING_PLUGIN_VERSION, IEPLUGIN_VERSION); | |
| 95 settings->SetFirstRunUpdate(); | |
| 96 } | |
| 97 | |
| 98 // First run or deleted settings file (dictionary version = 1) | |
| 99 if (settings->GetString(SETTING_DICTIONARY_VERSION, L"1").Compare(L"1") == 0
) | |
| 100 { | |
| 101 settings->SetFirstRun(); | |
| 102 } | |
| 103 | |
| 104 // Update? | |
| 105 CString oldVersion = settings->GetString(SETTING_PLUGIN_VERSION); | |
| 106 if (settings->IsFirstRunUpdate() || settings->GetString(SETTING_PLUGIN_UPDAT
E_VERSION) == IEPLUGIN_VERSION || oldVersion != IEPLUGIN_VERSION) | |
| 107 { | |
| 108 settings->SetString(SETTING_PLUGIN_VERSION, IEPLUGIN_VERSION); | |
| 109 | |
| 110 settings->SetFirstRunUpdate(); | |
| 111 } | |
| 112 | |
| 113 int info = settings->GetValue(SETTING_PLUGIN_INFO_PANEL, 0); | |
| 114 | |
| 115 #ifdef ENABLE_DEBUG_RESULT | |
| 116 CPluginDebug::DebugResultClear(); | |
| 117 #endif | |
| 118 | |
| 119 #ifdef ENABLE_DEBUG_INFO | |
| 120 if (info == 0 || info > 2) | |
| 121 { | |
| 122 CPluginDebug::DebugClear(); | |
| 123 } | |
| 124 #endif // ENABLE_DEBUG_INFO | |
| 125 | |
| 126 settings->Write(false); | |
| 127 } | |
| 128 } | 77 } |
| 129 | 78 |
| 130 CPluginClass::~CPluginClass() | 79 CPluginClass::~CPluginClass() |
| 131 { | 80 { |
| 132 delete m_tab; | 81 delete m_tab; |
| 133 | |
| 134 CPluginSettings* settings = CPluginSettings::GetInstance(); | |
| 135 | |
| 136 settings->DecrementTabCount(); | |
| 137 } | 82 } |
| 138 | 83 |
| 139 | 84 |
| 140 ///////////////////////////////////////////////////////////////////////////// | 85 ///////////////////////////////////////////////////////////////////////////// |
| 141 // Initialization | 86 // Initialization |
| 142 | 87 |
| 143 HRESULT CPluginClass::FinalConstruct() | 88 HRESULT CPluginClass::FinalConstruct() |
| 144 { | 89 { |
| 145 return S_OK; | 90 return S_OK; |
| 146 } | 91 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 url = bstrURL; | 202 url = bstrURL; |
| 258 CPluginClient::UnescapeUrl(url); | 203 CPluginClient::UnescapeUrl(url); |
| 259 } | 204 } |
| 260 } | 205 } |
| 261 else | 206 else |
| 262 { | 207 { |
| 263 url = m_tab->GetDocumentUrl(); | 208 url = m_tab->GetDocumentUrl(); |
| 264 } | 209 } |
| 265 | 210 |
| 266 return url; | 211 return url; |
| 267 } | |
| 268 | |
| 269 void CPluginClass::LaunchUpdater(const CString& strPath) | |
| 270 { | |
| 271 PROCESS_INFORMATION pi; | |
| 272 ::ZeroMemory(&pi, sizeof(pi)); | |
| 273 | |
| 274 STARTUPINFO si; | |
| 275 ::ZeroMemory(&si, sizeof(si)); | |
| 276 si.cb = sizeof(si); | |
| 277 si.wShowWindow = FALSE; | |
| 278 CString cpath; | |
| 279 if (strPath.Find(L".exe") == strPath.GetLength() - 4) | |
| 280 { | |
| 281 cpath = strPath; | |
| 282 } | |
| 283 else | |
| 284 { | |
| 285 cpath = _T("\"msiexec.exe\" /i \"") + strPath + _T("\" UPDATEPLUGIN=\"True\"
"); | |
| 286 } | |
| 287 | |
| 288 if (!::CreateProcess(NULL, cpath.GetBuffer(), NULL, NULL, FALSE, CREATE_BREAKA
WAY_FROM_JOB, NULL, NULL, &si, &pi)) | |
| 289 { | |
| 290 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UPDATER, PLUGIN_ERROR_UPDATER
_CREATE_PROCESS, "Class::Updater - Failed to start process"); | |
| 291 return; | |
| 292 } | |
| 293 #ifndef AUTOMATIC_SHUTDOWN | |
| 294 else | |
| 295 { | |
| 296 ::WaitForSingleObject(pi.hProcess, INFINITE); | |
| 297 } | |
| 298 #endif // not AUTOMATIC_SHUTDOWN | |
| 299 | |
| 300 ::CloseHandle(pi.hProcess); | |
| 301 ::CloseHandle(pi.hThread); | |
| 302 } | 212 } |
| 303 | 213 |
| 304 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr) | 214 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr) |
| 305 { | 215 { |
| 306 if (thisPtr == NULL) | 216 if (thisPtr == NULL) |
| 307 return 0; | 217 return 0; |
| 308 if (!((CPluginClass*)thisPtr)->InitObject(true)) | 218 if (!((CPluginClass*)thisPtr)->InitObject(true)) |
| 309 { | 219 { |
| 310 ((CPluginClass*)thisPtr)->Unadvice(); | 220 ((CPluginClass*)thisPtr)->Unadvice(); |
| 311 } | 221 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 326 // so we should handle that it is called this way several times during a session | 236 // so we should handle that it is called this way several times during a session |
| 327 STDMETHODIMP CPluginClass::SetSite(IUnknown* unknownSite) | 237 STDMETHODIMP CPluginClass::SetSite(IUnknown* unknownSite) |
| 328 { | 238 { |
| 329 CPluginSettings* settings = CPluginSettings::GetInstance(); | 239 CPluginSettings* settings = CPluginSettings::GetInstance(); |
| 330 CPluginSystem* system = CPluginSystem::GetInstance(); | 240 CPluginSystem* system = CPluginSystem::GetInstance(); |
| 331 | 241 |
| 332 MULTIPLE_VERSIONS_CHECK(); | 242 MULTIPLE_VERSIONS_CHECK(); |
| 333 | 243 |
| 334 if (unknownSite) | 244 if (unknownSite) |
| 335 { | 245 { |
| 336 if (settings->IsMainProcess() && settings->IsMainUiThread()) | 246 DEBUG_GENERAL(L"============================================================
====================\nNEW TAB UI\n==============================================
==================================") |
| 337 { | |
| 338 DEBUG_GENERAL(L"==========================================================
======================\nMAIN TAB UI\n===========================================
=====================================") | |
| 339 } | |
| 340 else | |
| 341 { | |
| 342 DEBUG_GENERAL(L"==========================================================
======================\nNEW TAB UI\n============================================
====================================") | |
| 343 } | |
| 344 | 247 |
| 345 HRESULT hr = ::CoInitialize(NULL); | 248 HRESULT hr = ::CoInitialize(NULL); |
| 346 if (FAILED(hr)) | 249 if (FAILED(hr)) |
| 347 { | 250 { |
| 348 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_COINIT, "
Class::SetSite - CoInitialize"); | 251 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_COINIT, "
Class::SetSite - CoInitialize"); |
| 349 } | 252 } |
| 350 | 253 |
| 351 s_criticalSectionBrowser.Lock(); | 254 s_criticalSectionBrowser.Lock(); |
| 352 { | 255 { |
| 353 m_webBrowser2 = unknownSite; | 256 m_webBrowser2 = unknownSite; |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 m_hStatusBarWnd = NULL; | 361 m_hStatusBarWnd = NULL; |
| 459 | 362 |
| 460 // Remove instance from the list, shutdown threads | 363 // Remove instance from the list, shutdown threads |
| 461 HANDLE hMainThread = NULL; | 364 HANDLE hMainThread = NULL; |
| 462 HANDLE hTabThread = NULL; | 365 HANDLE hTabThread = NULL; |
| 463 | 366 |
| 464 s_criticalSectionLocal.Lock(); | 367 s_criticalSectionLocal.Lock(); |
| 465 { | 368 { |
| 466 s_instances.Remove(this); | 369 s_instances.Remove(this); |
| 467 | 370 |
| 468 if (s_instances.GetSize() == 0) | |
| 469 { | |
| 470 if (settings->IsMainProcess() && settings->IsMainUiThread()) | |
| 471 { | |
| 472 hMainThread = s_hMainThread; | |
| 473 s_hMainThread = NULL; | |
| 474 } | |
| 475 } | |
| 476 | |
| 477 std::map<DWORD,CPluginClass*>::iterator it = s_threadInstances.find(::GetC
urrentThreadId()); | 371 std::map<DWORD,CPluginClass*>::iterator it = s_threadInstances.find(::GetC
urrentThreadId()); |
| 478 if (it != s_threadInstances.end()) | 372 if (it != s_threadInstances.end()) |
| 479 { | 373 { |
| 480 s_threadInstances.erase(it); | 374 s_threadInstances.erase(it); |
| 481 } | 375 } |
| 482 if (s_instances.GetSize() == 0) | 376 if (s_instances.GetSize() == 0) |
| 483 { | 377 { |
| 484 CPluginClientFactory::ReleaseMimeFilterClientInstance(); | 378 CPluginClientFactory::ReleaseMimeFilterClientInstance(); |
| 485 } | 379 } |
| 486 } | 380 } |
| 487 s_criticalSectionLocal.Unlock(); | 381 s_criticalSectionLocal.Unlock(); |
| 488 | 382 |
| 489 if (hMainThread != NULL) | |
| 490 { | |
| 491 s_isMainThreadDone = true; | |
| 492 | |
| 493 ::WaitForSingleObject(hMainThread, INFINITE); | |
| 494 ::CloseHandle(hMainThread); | |
| 495 } | |
| 496 | |
| 497 // Release browser interface | 383 // Release browser interface |
| 498 s_criticalSectionBrowser.Lock(); | 384 s_criticalSectionBrowser.Lock(); |
| 499 { | 385 { |
| 500 m_webBrowser2.Release(); | 386 m_webBrowser2.Release(); |
| 501 } | 387 } |
| 502 s_criticalSectionBrowser.Unlock(); | 388 s_criticalSectionBrowser.Unlock(); |
| 503 | 389 |
| 504 if (settings->IsMainProcess() && settings->IsMainUiThread()) | 390 DEBUG_GENERAL("=============================================================
===================\nNEW TAB UI - END\n=========================================
=======================================") |
| 505 { | |
| 506 DEBUG_GENERAL("===========================================================
=====================\nMAIN TAB UI - END\n======================================
==========================================") | |
| 507 } | |
| 508 else | |
| 509 { | |
| 510 DEBUG_GENERAL("===========================================================
=====================\nNEW TAB UI - END\n=======================================
=========================================") | |
| 511 } | |
| 512 | 391 |
| 513 ::CoUninitialize(); | 392 ::CoUninitialize(); |
| 514 } | 393 } |
| 515 | 394 |
| 516 return IObjectWithSiteImpl<CPluginClass>::SetSite(unknownSite); | 395 return IObjectWithSiteImpl<CPluginClass>::SetSite(unknownSite); |
| 517 } | 396 } |
| 518 | 397 |
| 519 bool CPluginClass::IsStatusBarEnabled() | 398 bool CPluginClass::IsStatusBarEnabled() |
| 520 { | 399 { |
| 521 HKEY pHkey; | 400 HKEY pHkey; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 549 | 428 |
| 550 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); | 429 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); |
| 551 if (browser) | 430 if (browser) |
| 552 { | 431 { |
| 553 HRESULT hr = S_OK; | 432 HRESULT hr = S_OK; |
| 554 hr = browser->get_StatusBar(&isVisible); | 433 hr = browser->get_StatusBar(&isVisible); |
| 555 if (SUCCEEDED(hr)) | 434 if (SUCCEEDED(hr)) |
| 556 { | 435 { |
| 557 if (!isVisible) | 436 if (!isVisible) |
| 558 { | 437 { |
| 559 if (!settings->GetBool("statusbarasked", false)) | 438 if (!settings->GetStatusBarAsked()) |
| 560 { | 439 { |
| 561 SHANDLE_PTR pBrowserHWnd; | 440 SHANDLE_PTR pBrowserHWnd; |
| 562 browser->get_HWND((SHANDLE_PTR*)&pBrowserHWnd); | 441 browser->get_HWND((SHANDLE_PTR*)&pBrowserHWnd); |
| 563 Dictionary* dictionary = Dictionary::GetInstance(); | 442 Dictionary* dictionary = Dictionary::GetInstance(); |
| 564 settings->SetBool("statusbarasked", true); | 443 settings->SetStatusBarAsked(); |
| 565 settings->Write(); | |
| 566 | 444 |
| 567 HKEY pHkey; | 445 HKEY pHkey; |
| 568 HKEY pHkeySub; | 446 HKEY pHkeySub; |
| 569 LSTATUS regRes = 0; | 447 LSTATUS regRes = 0; |
| 570 regRes = RegOpenCurrentUser(KEY_WRITE, &pHkey); | 448 regRes = RegOpenCurrentUser(KEY_WRITE, &pHkey); |
| 571 | 449 |
| 572 // Do we have enough rights to enable a status bar? | 450 // Do we have enough rights to enable a status bar? |
| 573 if (regRes != 0) | 451 if (regRes != 0) |
| 574 { | 452 { |
| 575 // We use the tab window here and in the next few calls, since the b
rowser window may still not be available | 453 // We use the tab window here and in the next few calls, since the b
rowser window may still not be available |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 935 // Create status pane | 813 // Create status pane |
| 936 if (bBHO) | 814 if (bBHO) |
| 937 { | 815 { |
| 938 if (!CreateStatusBarPane()) | 816 if (!CreateStatusBarPane()) |
| 939 { | 817 { |
| 940 return false; | 818 return false; |
| 941 } | 819 } |
| 942 } | 820 } |
| 943 | 821 |
| 944 CPluginSettings* settings = CPluginSettings::GetInstance(); | 822 CPluginSettings* settings = CPluginSettings::GetInstance(); |
| 945 | |
| 946 // Create main thread | |
| 947 if (GetMainThreadHandle() == NULL && settings->IsMainProcess() && settings->Is
MainUiThread()) | |
| 948 { | |
| 949 DWORD id; | |
| 950 HANDLE handle = ::CreateThread(NULL, 0, MainThreadProc, (LPVOID)m_tab, CREAT
E_SUSPENDED, &id); | |
| 951 if (handle == NULL) | |
| 952 { | |
| 953 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_THREAD, PLUGIN_ERROR_MAIN_T
HREAD_CREATE_PROCESS, "Class::Thread - Failed to create main thread"); | |
| 954 } | |
| 955 | |
| 956 s_hMainThread = handle; | |
| 957 | |
| 958 ::ResumeThread(handle); | |
| 959 } | |
| 960 | |
| 961 return true; | 823 return true; |
| 962 } | 824 } |
| 963 | 825 |
| 964 bool CPluginClass::CreateStatusBarPane() | 826 bool CPluginClass::CreateStatusBarPane() |
| 965 { | 827 { |
| 966 DEBUG_GENERAL(L"Getting client"); | 828 DEBUG_GENERAL(L"Getting client"); |
| 967 | 829 |
| 968 CPluginClient* client = CPluginClient::GetInstance(); | 830 CPluginClient* client = CPluginClient::GetInstance(); |
| 969 | 831 |
| 970 DEBUG_GENERAL(L"Getting ieversion"); | 832 DEBUG_GENERAL(L"Getting ieversion"); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 | 989 |
| 1128 ::SendMessage(m_hStatusBarWnd, SB_GETPARTS, nPartCount, (LPARAM)pData); | 990 ::SendMessage(m_hStatusBarWnd, SB_GETPARTS, nPartCount, (LPARAM)pData); |
| 1129 ::SendMessage(m_hStatusBarWnd, SB_SETPARTS, nPartCount, (LPARAM)pData); | 991 ::SendMessage(m_hStatusBarWnd, SB_SETPARTS, nPartCount, (LPARAM)pData); |
| 1130 | 992 |
| 1131 delete[] pData; | 993 delete[] pData; |
| 1132 } | 994 } |
| 1133 HDC hdc = GetWindowDC(m_hStatusBarWnd); | 995 HDC hdc = GetWindowDC(m_hStatusBarWnd); |
| 1134 SendMessage(m_hStatusBarWnd, WM_PAINT, (WPARAM)hdc, 0); | 996 SendMessage(m_hStatusBarWnd, WM_PAINT, (WPARAM)hdc, 0); |
| 1135 ReleaseDC(m_hStatusBarWnd, hdc); | 997 ReleaseDC(m_hStatusBarWnd, hdc); |
| 1136 return true; | 998 return true; |
| 1137 }///////////////////////////////////////////////////////////////////////////// | 999 } |
| 1138 // Implementation | |
| 1139 | 1000 |
| 1140 void CPluginClass::CloseTheme() | 1001 void CPluginClass::CloseTheme() |
| 1141 { | 1002 { |
| 1142 if (m_hTheme) | 1003 if (m_hTheme) |
| 1143 { | 1004 { |
| 1144 if (pfnClose) | 1005 if (pfnClose) |
| 1145 { | 1006 { |
| 1146 pfnClose(m_hTheme); | 1007 pfnClose(m_hTheme); |
| 1147 } | 1008 } |
| 1148 | 1009 |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1393 else | 1254 else |
| 1394 { | 1255 { |
| 1395 s_mimeFilter = NULL; | 1256 s_mimeFilter = NULL; |
| 1396 | 1257 |
| 1397 CPluginClientFactory::ReleaseMimeFilterClientInstance(); | 1258 CPluginClientFactory::ReleaseMimeFilterClientInstance(); |
| 1398 } | 1259 } |
| 1399 } | 1260 } |
| 1400 s_criticalSectionLocal.Unlock(); | 1261 s_criticalSectionLocal.Unlock(); |
| 1401 } | 1262 } |
| 1402 break; | 1263 break; |
| 1403 #ifndef ENTERPRISE | |
| 1404 case ID_SETTINGS: | |
| 1405 { | |
| 1406 url = CString(UserSettingsFileUrl().c_str()); | |
| 1407 } | |
| 1408 break; | |
| 1409 #endif | |
| 1410 case ID_INVITEFRIENDS: | |
| 1411 { | |
| 1412 url = CPluginHttpRequest::GetStandardUrl(USERS_SCRIPT_INVITATION); | |
| 1413 navigationErrorId = PLUGIN_ERROR_NAVIGATION_INVITATION; | |
| 1414 } | |
| 1415 break; | |
| 1416 | |
| 1417 case ID_FAQ: | |
| 1418 { | |
| 1419 url = CPluginHttpRequest::GetStandardUrl(USERS_SCRIPT_FAQ); | |
| 1420 navigationErrorId = PLUGIN_ERROR_NAVIGATION_FAQ; | |
| 1421 } | |
| 1422 break; | |
| 1423 | |
| 1424 case ID_FEEDBACK: | |
| 1425 { | |
| 1426 CPluginHttpRequest httpRequest(USERS_SCRIPT_FEEDBACK); | |
| 1427 | |
| 1428 httpRequest.AddPluginId(); | |
| 1429 httpRequest.Add("reason", 0); | |
| 1430 httpRequest.Add(L"url", m_tab->GetDocumentUrl(), false); | |
| 1431 | |
| 1432 url = httpRequest.GetUrl(); | |
| 1433 navigationErrorId = PLUGIN_ERROR_NAVIGATION_FEEDBACK; | |
| 1434 } | |
| 1435 break; | |
| 1436 | |
| 1437 case ID_ABOUT: | |
| 1438 { | |
| 1439 url = CPluginHttpRequest::GetStandardUrl(USERS_SCRIPT_ABOUT); | |
| 1440 navigationErrorId = PLUGIN_ERROR_NAVIGATION_ABOUT; | |
| 1441 } | |
| 1442 break; | |
| 1443 | |
| 1444 default: | 1264 default: |
| 1445 | |
| 1446 break; | 1265 break; |
| 1447 } | 1266 } |
| 1448 | 1267 |
| 1449 // Invalidate and redraw the control | 1268 // Invalidate and redraw the control |
| 1450 UpdateStatusBar(); | 1269 UpdateStatusBar(); |
| 1451 | 1270 |
| 1452 CComQIPtr<IWebBrowser2> browser = GetBrowser(); | 1271 CComQIPtr<IWebBrowser2> browser = GetBrowser(); |
| 1453 if (!url.IsEmpty() && browser) | 1272 if (!url.IsEmpty() && browser) |
| 1454 { | 1273 { |
| 1455 VARIANT vFlags; | 1274 VARIANT vFlags; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1497 | 1316 |
| 1498 MENUITEMINFOW miiSep; | 1317 MENUITEMINFOW miiSep; |
| 1499 memset(&miiSep, 0, sizeof(MENUITEMINFO)); | 1318 memset(&miiSep, 0, sizeof(MENUITEMINFO)); |
| 1500 miiSep.cbSize = sizeof(MENUITEMINFO); | 1319 miiSep.cbSize = sizeof(MENUITEMINFO); |
| 1501 miiSep.fMask = MIIM_TYPE | MIIM_FTYPE; | 1320 miiSep.fMask = MIIM_TYPE | MIIM_FTYPE; |
| 1502 miiSep.fType = MFT_SEPARATOR; | 1321 miiSep.fType = MFT_SEPARATOR; |
| 1503 | 1322 |
| 1504 CPluginClient* client = CPluginClient::GetInstance(); | 1323 CPluginClient* client = CPluginClient::GetInstance(); |
| 1505 | 1324 |
| 1506 CPluginSettings* settings = CPluginSettings::GetInstance(); | 1325 CPluginSettings* settings = CPluginSettings::GetInstance(); |
| 1507 | |
| 1508 settings->RefreshTab(); | |
| 1509 | |
| 1510 // Update settings | |
| 1511 m_tab->OnUpdateSettings(false); | |
| 1512 | 1326 |
| 1513 #ifdef SUPPORT_WHITELIST | 1327 #ifdef SUPPORT_WHITELIST |
| 1514 { | 1328 { |
| 1515 // White list domain | 1329 // White list domain |
| 1516 ctext = dictionary->Lookup("menu", "disable-on-site"); | 1330 ctext = dictionary->Lookup("menu", "disable-on-site"); |
| 1517 fmii.fMask = MIIM_STRING | MIIM_STATE; | 1331 fmii.fMask = MIIM_STRING | MIIM_STATE; |
| 1518 fmii.fState = MFS_DISABLED; | 1332 fmii.fState = MFS_DISABLED; |
| 1519 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); | 1333 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); |
| 1520 fmii.cch = ctext.size(); | 1334 fmii.cch = ctext.size(); |
| 1521 | 1335 |
| 1522 UINT index = WM_WHITELIST_DOMAIN; | 1336 UINT index = WM_WHITELIST_DOMAIN; |
| 1523 | 1337 |
| 1524 ::SetMenuItemInfoW(hMenu, ID_WHITELISTDOMAIN, FALSE, &fmii); | 1338 ::SetMenuItemInfoW(hMenu, ID_WHITELISTDOMAIN, FALSE, &fmii); |
| 1525 } | 1339 } |
| 1526 #else | 1340 #else |
| 1527 { | 1341 { |
| 1528 ::DeleteMenu(hMenu, ID_WHITELISTDOMAIN, FALSE); | 1342 ::DeleteMenu(hMenu, ID_WHITELISTDOMAIN, FALSE); |
| 1529 } | 1343 } |
| 1530 #endif // SUPPORT_WHITELIST | 1344 #endif // SUPPORT_WHITELIST |
| 1531 | 1345 |
| 1532 // Invite friends | |
| 1533 ctext = dictionary->Lookup("menu", "invite"); | |
| 1534 fmii.fMask = MIIM_STATE | MIIM_STRING; | |
| 1535 fmii.fState = MFS_ENABLED; | |
| 1536 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); | |
| 1537 fmii.cch = ctext.size(); | |
| 1538 ::SetMenuItemInfoW(hMenu, ID_INVITEFRIENDS, FALSE, &fmii); | |
| 1539 | |
| 1540 // FAQ | |
| 1541 ctext = dictionary->Lookup("menu", "faq"); | |
| 1542 fmii.fMask = MIIM_STATE | MIIM_STRING; | |
| 1543 fmii.fState = MFS_ENABLED; | |
| 1544 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); | |
| 1545 fmii.cch = ctext.size(); | |
| 1546 ::SetMenuItemInfoW(hMenu, ID_FAQ, FALSE, &fmii); | |
| 1547 | |
| 1548 // About | |
| 1549 ctext = dictionary->Lookup("menu", "about"); | |
| 1550 fmii.fMask = MIIM_STATE | MIIM_STRING; | |
| 1551 fmii.fState = MFS_ENABLED; | |
| 1552 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); | |
| 1553 fmii.cch = ctext.size(); | |
| 1554 ::SetMenuItemInfoW(hMenu, ID_ABOUT, FALSE, &fmii); | |
| 1555 | |
| 1556 // Feedback | |
| 1557 ctext = dictionary->Lookup("menu", "feedback"); | |
| 1558 fmii.fMask = MIIM_STATE | MIIM_STRING; | |
| 1559 fmii.fState = MFS_ENABLED; | |
| 1560 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); | |
| 1561 fmii.cch = ctext.size(); | |
| 1562 ::SetMenuItemInfoW(hMenu, ID_FEEDBACK, FALSE, &fmii); | |
| 1563 | |
| 1564 // Plugin enable | 1346 // Plugin enable |
| 1565 if (settings->GetPluginEnabled()) | 1347 if (settings->GetPluginEnabled()) |
| 1566 { | 1348 { |
| 1567 ctext = dictionary->Lookup("menu", "disable"); | 1349 ctext = dictionary->Lookup("menu", "disable"); |
| 1568 } | 1350 } |
| 1569 else | 1351 else |
| 1570 { | 1352 { |
| 1571 ctext = dictionary->Lookup("menu", "enable"); | 1353 ctext = dictionary->Lookup("menu", "enable"); |
| 1572 } | 1354 } |
| 1573 fmii.fMask = MIIM_STATE | MIIM_STRING; | 1355 fmii.fMask = MIIM_STATE | MIIM_STRING; |
| 1574 fmii.fState = client ? MFS_ENABLED : MFS_DISABLED; | 1356 fmii.fState = client ? MFS_ENABLED : MFS_DISABLED; |
| 1575 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); | 1357 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); |
| 1576 fmii.cch = ctext.size(); | 1358 fmii.cch = ctext.size(); |
| 1577 ::SetMenuItemInfoW(hMenu, ID_PLUGIN_ENABLE, FALSE, &fmii); | 1359 ::SetMenuItemInfoW(hMenu, ID_PLUGIN_ENABLE, FALSE, &fmii); |
| 1578 | 1360 |
| 1579 // Settings | 1361 // Settings |
| 1580 #ifndef ENTERPRISE | |
| 1581 ctext = dictionary->Lookup("menu", "settings"); | 1362 ctext = dictionary->Lookup("menu", "settings"); |
| 1582 fmii.fMask = MIIM_STATE | MIIM_STRING; | 1363 fmii.fMask = MIIM_STATE | MIIM_STRING; |
| 1583 fmii.fState = MFS_ENABLED; | 1364 fmii.fState = MFS_ENABLED; |
| 1584 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); | 1365 fmii.dwTypeData = const_cast<LPWSTR>(ctext.c_str()); |
| 1585 fmii.cch = ctext.size(); | 1366 fmii.cch = ctext.size(); |
| 1586 ::SetMenuItemInfoW(hMenu, ID_SETTINGS, FALSE, &fmii); | 1367 ::SetMenuItemInfoW(hMenu, ID_SETTINGS, FALSE, &fmii); |
| 1587 #else | |
| 1588 RemoveMenu(hMenu, ID_SETTINGS, MF_BYCOMMAND); | |
| 1589 RemoveMenu(hMenu, 5, MF_BYPOSITION); | |
| 1590 #endif | |
| 1591 | 1368 |
| 1592 return true; | 1369 return true; |
| 1593 } | 1370 } |
| 1594 | 1371 |
| 1595 | 1372 |
| 1596 STDMETHODIMP CPluginClass::Exec(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, V
ARIANTARG*) | 1373 STDMETHODIMP CPluginClass::Exec(const GUID*, DWORD nCmdID, DWORD, VARIANTARG*, V
ARIANTARG*) |
| 1597 { | 1374 { |
| 1598 HWND hBrowserWnd = GetBrowserHWND(); | 1375 HWND hBrowserWnd = GetBrowserHWND(); |
| 1599 if (!hBrowserWnd) | 1376 if (!hBrowserWnd) |
| 1600 { | 1377 { |
| (...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1945 if (FAILED(hr)) | 1722 if (FAILED(hr)) |
| 1946 { | 1723 { |
| 1947 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION
_SETTINGS, "Navigation::Failed") | 1724 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION
_SETTINGS, "Navigation::Failed") |
| 1948 } | 1725 } |
| 1949 } | 1726 } |
| 1950 } | 1727 } |
| 1951 #endif | 1728 #endif |
| 1952 } | 1729 } |
| 1953 break; | 1730 break; |
| 1954 | 1731 |
| 1955 #ifndef ENTERPRISE | 1732 |
| 1956 | 1733 // First run page |
| 1957 case WM_LAUNCH_INFO: | 1734 case WM_LAUNCH_INFO: |
| 1958 { | 1735 { |
| 1959 // Set the status bar visible, if it isn't | 1736 // Set the status bar visible, if it isn't |
| 1960 // Otherwise the user won't see the icon the first time | 1737 // Otherwise the user won't see the icon the first time |
| 1961 | 1738 |
| 1962 if (wParam == 1) | 1739 if (wParam == 1) |
| 1963 { | 1740 { |
| 1964 // Redirect to welcome page | 1741 // Redirect to welcome page |
| 1965 VARIANT_BOOL isVisible; | 1742 VARIANT_BOOL isVisible; |
| 1966 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); | 1743 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); |
| 1967 if (browser) | 1744 if (browser) |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1989 } | 1766 } |
| 1990 } | 1767 } |
| 1991 } | 1768 } |
| 1992 else | 1769 else |
| 1993 { | 1770 { |
| 1994 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR,
"Class::Get statusbar state"); | 1771 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_GET_STATUSBAR,
"Class::Get statusbar state"); |
| 1995 } | 1772 } |
| 1996 | 1773 |
| 1997 CPluginSettings* settings = CPluginSettings::GetInstance(); | 1774 CPluginSettings* settings = CPluginSettings::GetInstance(); |
| 1998 | 1775 |
| 1999 CPluginHttpRequest httpRequest(USERS_SCRIPT_WELCOME); | 1776 //TODO: Navigate to first run page here |
| 2000 | 1777 /* hr = browser->Navigate(CComBSTR("FIRST_RUN_PAGE_URL"), NULL, NULL, NUL
L, NULL); |
| 2001 httpRequest.Add("errors", settings->GetErrorList()); | |
| 2002 | |
| 2003 | |
| 2004 hr = browser->Navigate(CComBSTR(httpRequest.GetUrl() + "&src=" + DOWNL
OAD_SOURCE), NULL, NULL, NULL, NULL); | |
| 2005 if (FAILED(hr)) | 1778 if (FAILED(hr)) |
| 2006 { | 1779 { |
| 2007 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION
_WELCOME, "Navigation::Welcome page failed") | 1780 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATION
_WELCOME, "Navigation::Welcome page failed") |
| 2008 } | 1781 } |
| 2009 | 1782 */ |
| 2010 // Update settings server side on next IE start, as they have possibly
changed | |
| 2011 settings->ForceConfigurationUpdateOnStart(); | |
| 2012 } | 1783 } |
| 2013 } | 1784 } |
| 2014 else | 1785 else |
| 2015 { | 1786 { |
| 2016 // Redirect to info page | 1787 // Redirect to info page |
| 2017 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); | 1788 CComQIPtr<IWebBrowser2> browser = GetAsyncBrowser(); |
| 2018 if (browser) | 1789 if (browser) |
| 2019 { | 1790 { |
| 2020 CPluginHttpRequest httpRequest(USERS_SCRIPT_INFO); | |
| 2021 | |
| 2022 httpRequest.Add("info", wParam); | |
| 2023 | |
| 2024 VARIANT vFlags; | 1791 VARIANT vFlags; |
| 2025 vFlags.vt = VT_I4; | 1792 vFlags.vt = VT_I4; |
| 2026 vFlags.intVal = navOpenInNewTab; | 1793 vFlags.intVal = navOpenInNewTab; |
| 2027 | 1794 |
| 2028 HRESULT hr = browser->Navigate(CComBSTR(httpRequest.GetUrl()), &vFlags
, NULL, NULL, NULL); | 1795 // TODO: Navigate to info page here or remove this clause |
| 1796 /* HRESULT hr = browser->Navigate(CComBSTR(INFO_PAGE_URL), &vFlags, NUL
L, NULL, NULL); |
| 2029 if (FAILED(hr)) | 1797 if (FAILED(hr)) |
| 2030 { | 1798 { |
| 2031 vFlags.intVal = navOpenInNewWindow; | 1799 vFlags.intVal = navOpenInNewWindow; |
| 2032 | 1800 |
| 2033 hr = browser->Navigate(CComBSTR(httpRequest.GetUrl()), &vFlags, NULL
, NULL, NULL); | 1801 hr = browser->Navigate(CComBSTR(httpRequest.GetUrl()), &vFlags, NULL
, NULL, NULL); |
| 2034 if (FAILED(hr)) | 1802 if (FAILED(hr)) |
| 2035 { | 1803 { |
| 2036 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATI
ON_INFO, "Navigation::Info page failed") | 1804 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_NAVIGATION, PLUGIN_ERROR_NAVIGATI
ON_INFO, "Navigation::Info page failed") |
| 2037 } | 1805 } |
| 2038 } | 1806 } |
| 1807 */ |
| 2039 } | 1808 } |
| 2040 } | 1809 } |
| 2041 } | 1810 } |
| 2042 break; | 1811 break; |
| 2043 #endif | |
| 2044 | 1812 |
| 2045 case WM_DESTROY: | 1813 case WM_DESTROY: |
| 2046 break; | 1814 break; |
| 2047 case SC_CLOSE: | 1815 case SC_CLOSE: |
| 2048 break; | 1816 break; |
| 2049 | 1817 |
| 2050 case WM_UPDATEUISTATE: | 1818 case WM_UPDATEUISTATE: |
| 2051 { | 1819 { |
| 2052 CPluginTab* tab = GetTab(::GetCurrentThreadId()); | 1820 CPluginTab* tab = GetTab(::GetCurrentThreadId()); |
| 2053 if (tab) | 1821 if (tab) |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2192 } | 1960 } |
| 2193 } | 1961 } |
| 2194 } | 1962 } |
| 2195 | 1963 |
| 2196 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 1964 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
| 2197 } | 1965 } |
| 2198 | 1966 |
| 2199 return hTabWnd; | 1967 return hTabWnd; |
| 2200 | 1968 |
| 2201 } | 1969 } |
| LEFT | RIGHT |