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

Delta Between Two Patch Sets: src/plugin/PluginClass.cpp

Issue 11756012: Enhanced Protected Mode support (Closed)
Left Patch Set: Created Sept. 15, 2013, 1 a.m.
Right Patch Set: Addressing comments Created Sept. 17, 2013, 2:51 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
LEFTRIGHT
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 "PluginMutex.h" 12 #include "PluginMutex.h"
13 #include "sddl.h" 13 #include "sddl.h"
14 #include "PluginUtil.h" 14 #include "PluginUtil.h"
15 #include "PluginUserSettings.h" 15 #include "PluginUserSettings.h"
16 #include "../shared/Utils.h"
17 16
18 #include "../shared/Dictionary.h" 17 #include "../shared/Dictionary.h"
19
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
25 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR); 23 typedef HANDLE (WINAPI *OPENTHEMEDATA)(HWND, LPCWSTR);
26 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT); 24 typedef HRESULT (WINAPI *DRAWTHEMEBACKGROUND)(HANDLE, HDC, INT, INT, LPRECT, LPR ECT);
27 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE); 25 typedef HRESULT (WINAPI *CLOSETHEMEDATA)(HANDLE);
28 26
29 27
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 else 206 else
209 { 207 {
210 url = m_tab->GetDocumentUrl(); 208 url = m_tab->GetDocumentUrl();
211 } 209 }
212 210
213 return url; 211 return url;
214 } 212 }
215 213
216 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr) 214 DWORD WINAPI CPluginClass::StartInitObject(LPVOID thisPtr)
217 { 215 {
218 INITCOMMONCONTROLSEX commControls;
219 commControls.dwSize = sizeof(INITCOMMONCONTROLSEX);
220 commControls.dwICC = ICC_USEREX_CLASSES | ICC_STANDARD_CLASSES | ICC_BAR_CLASS ES;
221 InitCommonControlsEx(&commControls);
222 if (thisPtr == NULL) 216 if (thisPtr == NULL)
223 return 0; 217 return 0;
224 if (!((CPluginClass*)thisPtr)->InitObject(true)) 218 if (!((CPluginClass*)thisPtr)->InitObject(true))
225 { 219 {
226 ((CPluginClass*)thisPtr)->Unadvice(); 220 ((CPluginClass*)thisPtr)->Unadvice();
227 } 221 }
228 222
229 return 0; 223 return 0;
230 } 224 }
231 225
232 226
233 227
234 // This gets called when a new browser window is created (which also triggers th e 228 // This gets called when a new browser window is created (which also triggers th e
235 // creation of this object). The pointer passed in should be to a IWebBrowser2 229 // creation of this object). The pointer passed in should be to a IWebBrowser2
236 // interface that represents the browser for the window. 230 // interface that represents the browser for the window.
237 // it is also called when a tab is closed, this unknownSite will be null 231 // it is also called when a tab is closed, this unknownSite will be null
238 // so we should handle that it is called this way several times during a session 232 // so we should handle that it is called this way several times during a session
239 STDMETHODIMP CPluginClass::SetSite(IUnknown* unknownSite) 233 STDMETHODIMP CPluginClass::SetSite(IUnknown* unknownSite)
240 { 234 {
241 CPluginSettings* settings = CPluginSettings::GetInstance(); 235 CPluginSettings* settings = CPluginSettings::GetInstance();
242 CPluginSystem* system = CPluginSystem::GetInstance(); 236 CPluginSystem* system = CPluginSystem::GetInstance();
243 237
244 MULTIPLE_VERSIONS_CHECK(); 238 MULTIPLE_VERSIONS_CHECK();
245 239
246 if (unknownSite) 240 if (unknownSite)
247 { 241 {
248 242
Felix Dahlke 2013/09/16 16:30:12 Not really related I think.
249 DEBUG_GENERAL(L"============================================================ ====================\nNEW TAB UI\n============================================== ==================================") 243 DEBUG_GENERAL(L"============================================================ ====================\nNEW TAB UI\n============================================== ==================================")
250 244
251 HRESULT hr = ::CoInitialize(NULL); 245 HRESULT hr = ::CoInitialize(NULL);
252 if (FAILED(hr)) 246 if (FAILED(hr))
253 { 247 {
254 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_COINIT, " Class::SetSite - CoInitialize"); 248 DEBUG_ERROR_LOG(hr, PLUGIN_ERROR_SET_SITE, PLUGIN_ERROR_SET_SITE_COINIT, " Class::SetSite - CoInitialize");
255 } 249 }
256 250
257 s_criticalSectionBrowser.Lock(); 251 s_criticalSectionBrowser.Lock();
258 { 252 {
(...skipping 1011 matching lines...) Expand 10 before | Expand all | Expand 10 after
1270 int nCommand = ::TrackPopupMenu(hMenu, nMenuFlags, pt.x, pt.y, 0, hMenuWnd, 0) ; 1264 int nCommand = ::TrackPopupMenu(hMenu, nMenuFlags, pt.x, pt.y, 0, hMenuWnd, 0) ;
1271 1265
1272 ::DestroyMenu(hMenu); 1266 ::DestroyMenu(hMenu);
1273 ::DestroyWindow(hMenuWnd); 1267 ::DestroyWindow(hMenuWnd);
1274 1268
1275 switch (nCommand) 1269 switch (nCommand)
1276 { 1270 {
1277 case ID_MENU_UPDATE: 1271 case ID_MENU_UPDATE:
1278 { 1272 {
1279 CPluginClient* client = CPluginClient::GetInstance(); 1273 CPluginClient* client = CPluginClient::GetInstance();
1280 notifMessage.SetParent(m_hPaneWnd); 1274 client->CheckForUpdates();
1281 Dictionary* dictionary = Dictionary::GetInstance();
1282 std::wstring checkingText = dictionary->Lookup("updater", "checking-for-up dates-text");
1283 std::wstring checkingTitle = dictionary->Lookup("updater", "checking-for-u pdates-title");
1284
1285 notifMessage.Show(checkingText.c_str(), TTI_INFO);
1286 notifMessage.SetTextAndIcon(checkingText.c_str(), checkingTitle.c_str(), T TI_INFO);
1287 client->CheckForUpdates(m_hPaneWnd);
1288 } 1275 }
1289 break; 1276 break;
1290 case ID_MENU_DISABLE: 1277 case ID_MENU_DISABLE:
1291 { 1278 {
1292 CPluginSettings* settings = CPluginSettings::GetInstance(); 1279 CPluginSettings* settings = CPluginSettings::GetInstance();
1293 1280
1294 settings->TogglePluginEnabled(); 1281 settings->TogglePluginEnabled();
1295 1282
1296 // Enable / disable mime filter 1283 // Enable / disable mime filter
1297 s_criticalSectionLocal.Lock(); 1284 s_criticalSectionLocal.Lock();
(...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after
1784 break; 1771 break;
1785 case SC_CLOSE: 1772 case SC_CLOSE:
1786 break; 1773 break;
1787 1774
1788 case WM_UPDATEUISTATE: 1775 case WM_UPDATEUISTATE:
1789 { 1776 {
1790 CPluginTab* tab = GetTab(::GetCurrentThreadId()); 1777 CPluginTab* tab = GetTab(::GetCurrentThreadId());
1791 if (tab) 1778 if (tab)
1792 { 1779 {
1793 tab->OnActivate(); 1780 tab->OnActivate();
1794 RECT rect; 1781 }
1795 GetWindowRect(pClass->m_hPaneWnd, &rect);
1796 pClass->notifMessage.Move(rect.left + (rect.right - rect.left) / 2, rect .top + (rect.bottom - rect.top) / 2);
1797 }
1798 pClass->notifMessage.Hide();
1799 }
1800 break;
1801 case WM_WINDOWPOSCHANGING:
1802 {
1803 RECT rect;
1804 GetWindowRect(pClass->m_hPaneWnd, &rect);
1805 pClass->notifMessage.Move(rect.left + (rect.right - rect.left) / 2, rect.t op + (rect.bottom - rect.top) / 2);
1806 }
1807 break;
1808 case WM_ALREADY_UP_TO_DATE:
1809 {
1810 Dictionary* dictionary = Dictionary::GetInstance();
1811 std::wstring upToDateText = dictionary->Lookup("updater", "update-already- up-to-date-text");
1812 std::wstring upToDateTitle = dictionary->Lookup("updater", "update-already -up-to-date-title");
1813 pClass->notifMessage.SetTextAndIcon(upToDateText.c_str(), upToDateTitle.c_ str(), TTI_INFO);
1814 }
1815 break;
1816 case WM_UPDATE_CHECK_ERROR:
1817 {
1818 Dictionary* dictionary = Dictionary::GetInstance();
1819 std::wstring errorText = dictionary->Lookup("updater", "update-error-text" );
1820 std::wstring errorTitle = dictionary->Lookup("updater", "update-error-titl e");
1821 pClass->notifMessage.SetTextAndIcon(errorText.c_str(), errorText.c_str(), TTI_ERROR);
1822 }
1823 break;
1824 case WM_DOWNLOADING_UPDATE:
1825 {
1826 Dictionary* dictionary = Dictionary::GetInstance();
1827 std::wstring downloadingText = dictionary->Lookup("updater", "downloading- update-text");
1828 std::wstring downloadingTitle = dictionary->Lookup("updater", "downloading -update-title");
1829 pClass->notifMessage.SetTextAndIcon(downloadingText.c_str(), downloadingTi tle.c_str(), TTI_ERROR);
1830 } 1782 }
1831 break; 1783 break;
1832 } 1784 }
1833 1785
1834 return DefWindowProc(hWnd, message, wParam, lParam); 1786 return DefWindowProc(hWnd, message, wParam, lParam);
1835 } 1787 }
1836 1788
1837 1789
1838 void CPluginClass::UpdateStatusBar() 1790 void CPluginClass::UpdateStatusBar()
1839 { 1791 {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1961 } 1913 }
1962 } 1914 }
1963 } 1915 }
1964 1916
1965 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT); 1917 hTabWnd = ::GetWindow(hTabWnd, GW_HWNDNEXT);
1966 } 1918 }
1967 1919
1968 return hTabWnd; 1920 return hTabWnd;
1969 1921
1970 } 1922 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld