LEFT | RIGHT |
1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
2 | 2 |
3 #include "PluginClass.h" | 3 #include "PluginClass.h" |
4 #include "PluginDictionary.h" | 4 #include "PluginDictionary.h" |
5 #include "PluginSettings.h" | 5 #include "PluginSettings.h" |
6 #include "PluginSystem.h" | 6 #include "PluginSystem.h" |
7 #ifdef SUPPORT_FILTER | 7 #ifdef SUPPORT_FILTER |
8 #include "PluginFilter.h" | 8 #include "PluginFilter.h" |
9 #endif | 9 #endif |
10 #include "PluginMimeFilterClient.h" | 10 #include "PluginMimeFilterClient.h" |
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
923 } | 923 } |
924 s_criticalSectionLocal.Unlock(); | 924 s_criticalSectionLocal.Unlock(); |
925 | 925 |
926 if (!GetAtomPaneClass()) | 926 if (!GetAtomPaneClass()) |
927 { | 927 { |
928 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_REGISTE
R_PANE_CLASS, "Class::InitObject - RegisterClassEx"); | 928 DEBUG_ERROR_LOG(::GetLastError(), PLUGIN_ERROR_UI, PLUGIN_ERROR_UI_REGISTE
R_PANE_CLASS, "Class::InitObject - RegisterClassEx"); |
929 return false; | 929 return false; |
930 } | 930 } |
931 } | 931 } |
932 | 932 |
| 933 |
933 // Create status pane | 934 // Create status pane |
934 if (bBHO) | 935 if (bBHO) |
935 { | 936 { |
936 if (!CreateStatusBarPane()) | 937 if (!CreateStatusBarPane()) |
937 { | 938 { |
938 return false; | 939 return false; |
939 } | 940 } |
940 } | 941 } |
941 | 942 |
942 CPluginSettings* settings = CPluginSettings::GetInstance(); | 943 CPluginSettings* settings = CPluginSettings::GetInstance(); |
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1435 | 1436 |
1436 case ID_ABOUT: | 1437 case ID_ABOUT: |
1437 { | 1438 { |
1438 url = CPluginHttpRequest::GetStandardUrl(USERS_SCRIPT_ABOUT); | 1439 url = CPluginHttpRequest::GetStandardUrl(USERS_SCRIPT_ABOUT); |
1439 navigationErrorId = PLUGIN_ERROR_NAVIGATION_ABOUT; | 1440 navigationErrorId = PLUGIN_ERROR_NAVIGATION_ABOUT; |
1440 } | 1441 } |
1441 break; | 1442 break; |
1442 | 1443 |
1443 default: | 1444 default: |
1444 | 1445 |
1445 #ifdef SUPPORT_WHITELIST | |
1446 { | |
1447 if (nCommand >= WM_WHITELIST_DOMAIN && nCommand <= WM_WHITELIST_DOMAIN_MAX
) | |
1448 { | |
1449 CPluginSettings* settings = CPluginSettings::GetInstance(); | |
1450 | |
1451 CString domain; | |
1452 | |
1453 s_criticalSectionLocal.Lock(); | |
1454 { | |
1455 domain = s_menuDomains[nCommand]; | |
1456 } | |
1457 s_criticalSectionLocal.Unlock(); | |
1458 | |
1459 if (settings->IsWhiteListedDomain(domain)) | |
1460 { | |
1461 settings->AddWhiteListedDomain(domain, 3, true); | |
1462 } | |
1463 else | |
1464 { | |
1465 settings->AddWhiteListedDomain(domain, 1, true); | |
1466 } | |
1467 | |
1468 client->ClearWhiteListCache(); | |
1469 } | |
1470 } | |
1471 #endif // SUPPORT_WHITELIST | |
1472 break; | 1446 break; |
1473 } | 1447 } |
1474 | 1448 |
1475 // Invalidate and redraw the control | 1449 // Invalidate and redraw the control |
1476 UpdateStatusBar(); | 1450 UpdateStatusBar(); |
1477 | 1451 |
1478 CComQIPtr<IWebBrowser2> browser = GetBrowser(); | 1452 CComQIPtr<IWebBrowser2> browser = GetBrowser(); |
1479 if (!url.IsEmpty() && browser) | 1453 if (!url.IsEmpty() && browser) |
1480 { | 1454 { |
1481 VARIANT vFlags; | 1455 VARIANT vFlags; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1553 #ifdef SUPPORT_WHITELIST | 1527 #ifdef SUPPORT_WHITELIST |
1554 { | 1528 { |
1555 // White list domain | 1529 // White list domain |
1556 ctext = dictionary->Lookup("MENU_DISABLE_ON"); | 1530 ctext = dictionary->Lookup("MENU_DISABLE_ON"); |
1557 fmii.fMask = MIIM_STRING | MIIM_STATE; | 1531 fmii.fMask = MIIM_STRING | MIIM_STATE; |
1558 fmii.fState = MFS_DISABLED; | 1532 fmii.fState = MFS_DISABLED; |
1559 fmii.dwTypeData = ctext.GetBuffer(); | 1533 fmii.dwTypeData = ctext.GetBuffer(); |
1560 fmii.cch = ctext.GetLength(); | 1534 fmii.cch = ctext.GetLength(); |
1561 | 1535 |
1562 UINT index = WM_WHITELIST_DOMAIN; | 1536 UINT index = WM_WHITELIST_DOMAIN; |
1563 | |
1564 // Add domains from history | |
1565 if (client) | |
1566 { | |
1567 bool isFirst = true; | |
1568 | |
1569 TDomainHistory domainHistory = settings->GetDomainHistory(); | |
1570 | |
1571 CString documentDomain = tab->GetDocumentDomain(); | |
1572 | |
1573 if (CPluginClient::IsValidDomain(documentDomain)) | |
1574 { | |
1575 CString documentDomainT = documentDomain; | |
1576 | |
1577 for (TDomainHistory::const_reverse_iterator it = domainHistory.rbegin();
it != domainHistory.rend(); ++it) | |
1578 { | |
1579 if (documentDomain == it->first) | |
1580 { | |
1581 if (isFirst) | |
1582 { | |
1583 fmii.fState = MFS_ENABLED; | |
1584 fmii.fMask |= MIIM_SUBMENU; | |
1585 fmii.hSubMenu = ::CreateMenu(); | |
1586 } | |
1587 | |
1588 MENUITEMINFO smii; | |
1589 memset(&smii, 0, sizeof(MENUITEMINFO)); | |
1590 smii.cbSize = sizeof(MENUITEMINFO); | |
1591 | |
1592 smii.fMask = MIIM_STRING | MIIM_ID; | |
1593 smii.dwTypeData = documentDomainT.GetBuffer(); | |
1594 smii.cch = documentDomainT.GetLength(); | |
1595 smii.wID = index; | |
1596 | |
1597 bool isWhitelisted = settings->IsWhiteListedDomain(it->first); | |
1598 if (isWhitelisted) | |
1599 { | |
1600 smii.fMask |= MIIM_STATE; | |
1601 smii.fState |= MFS_CHECKED; | |
1602 } | |
1603 | |
1604 if (isFirst) | |
1605 { | |
1606 smii.fMask |= MIIM_STATE; | |
1607 smii.fState |= MFS_DEFAULT; | |
1608 | |
1609 isFirst = false; | |
1610 } | |
1611 | |
1612 InsertMenuItem(fmii.hSubMenu, index, FALSE, &smii); | |
1613 | |
1614 s_criticalSectionLocal.Lock(); | |
1615 { | |
1616 s_menuDomains[index++] = documentDomain; | |
1617 } | |
1618 s_criticalSectionLocal.Unlock(); | |
1619 } | |
1620 } | |
1621 } | |
1622 | |
1623 // Add last domains | |
1624 for (TDomainHistory::const_reverse_iterator it = domainHistory.rbegin(); i
t != domainHistory.rend(); ++it) | |
1625 { | |
1626 if (it->first != documentDomain) | |
1627 { | |
1628 if (isFirst) | |
1629 { | |
1630 fmii.fMask |= MIIM_STATE | MIIM_SUBMENU; | |
1631 fmii.fState = MFS_ENABLED; | |
1632 fmii.hSubMenu = CreateMenu(); | |
1633 | |
1634 isFirst = false; | |
1635 } | |
1636 | |
1637 CString domain = it->first; | |
1638 | |
1639 MENUITEMINFO smii; | |
1640 memset(&smii, 0, sizeof(MENUITEMINFO)); | |
1641 smii.cbSize = sizeof(MENUITEMINFO); | |
1642 smii.fMask = MIIM_STRING | MIIM_ID; | |
1643 smii.dwTypeData = domain.GetBuffer(); | |
1644 smii.cch = domain.GetLength(); | |
1645 smii.wID = index; | |
1646 | |
1647 bool isWhitelisted = settings->IsWhiteListedDomain(it->first); | |
1648 if (isWhitelisted) | |
1649 { | |
1650 smii.fMask |= MIIM_STATE; | |
1651 smii.fState |= MFS_CHECKED; | |
1652 } | |
1653 | |
1654 ::InsertMenuItem(fmii.hSubMenu, index, FALSE, &smii); | |
1655 | |
1656 s_criticalSectionLocal.Lock(); | |
1657 { | |
1658 s_menuDomains[index++] = it->first; | |
1659 } | |
1660 s_criticalSectionLocal.Unlock(); | |
1661 } | |
1662 } | |
1663 } | |
1664 | 1537 |
1665 ::SetMenuItemInfo(hMenu, ID_WHITELISTDOMAIN, FALSE, &fmii); | 1538 ::SetMenuItemInfo(hMenu, ID_WHITELISTDOMAIN, FALSE, &fmii); |
1666 } | 1539 } |
1667 #else | 1540 #else |
1668 { | 1541 { |
1669 ::DeleteMenu(hMenu, ID_WHITELISTDOMAIN, FALSE); | 1542 ::DeleteMenu(hMenu, ID_WHITELISTDOMAIN, FALSE); |
1670 } | 1543 } |
1671 #endif // SUPPORT_WHITELIST | 1544 #endif // SUPPORT_WHITELIST |
1672 | 1545 |
1673 // Invite friends | 1546 // Invite friends |
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2332 } | 2205 } |
2333 } | 2206 } |
2334 } | 2207 } |
2335 | 2208 |
2336 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); | 2209 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); |
2337 } | 2210 } |
2338 | 2211 |
2339 return hTabWnd; | 2212 return hTabWnd; |
2340 | 2213 |
2341 } | 2214 } |
LEFT | RIGHT |