| LEFT | RIGHT |
| 1 /* | 1 /* |
| 2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
| 3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
| 4 * | 4 * |
| 5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
| 6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
| 7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
| 8 * | 8 * |
| 9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 #ifndef _PLUGIN_CLIENT_BASE_H_ | 18 #ifndef _PLUGIN_CLIENT_BASE_H_ |
| 19 #define _PLUGIN_CLIENT_BASE_H_ | 19 #define _PLUGIN_CLIENT_BASE_H_ |
| 20 | 20 |
| 21 class CPluginClientFactory; | 21 #include <vector> |
| 22 #include "ATL_Deprecate.h" |
| 22 | 23 |
| 23 class CPluginError | 24 class CPluginError |
| 24 { | 25 { |
| 25 | 26 |
| 26 private: | 27 private: |
| 27 | 28 |
| 28 int m_errorId; | 29 int m_errorId; |
| 29 int m_errorSubid; | 30 int m_errorSubid; |
| 30 DWORD m_errorCode; | 31 DWORD m_errorCode; |
| 31 std::string m_errorDescription; | 32 std::string m_errorDescription; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 49 | 50 |
| 50 int GetErrorId() const { return m_errorId; } | 51 int GetErrorId() const { return m_errorId; } |
| 51 int GetErrorSubid() const { return m_errorSubid; } | 52 int GetErrorSubid() const { return m_errorSubid; } |
| 52 DWORD GetErrorCode() const { return m_errorCode; } | 53 DWORD GetErrorCode() const { return m_errorCode; } |
| 53 std::string GetErrorDescription() const { return m_errorDescription; } | 54 std::string GetErrorDescription() const { return m_errorDescription; } |
| 54 DWORD GetProcessId() const { return m_processId; } | 55 DWORD GetProcessId() const { return m_processId; } |
| 55 DWORD GetThreadId() const { return m_threadId; } | 56 DWORD GetThreadId() const { return m_threadId; } |
| 56 }; | 57 }; |
| 57 | 58 |
| 58 | 59 |
| 59 class CPluginClientBase | 60 class LogQueue |
| 60 { | 61 { |
| 61 friend class CPluginClientFactory; | |
| 62 | |
| 63 private: | 62 private: |
| 64 | |
| 65 static std::vector<CPluginError> s_pluginErrors; | 63 static std::vector<CPluginError> s_pluginErrors; |
| 66 | 64 static CComAutoCriticalSection s_criticalSectionQueue; |
| 67 static bool s_isErrorLogging; | |
| 68 | |
| 69 protected: | |
| 70 | |
| 71 // Protected constructor used by the singleton pattern | |
| 72 CPluginClientBase(); | |
| 73 | |
| 74 static CComAutoCriticalSection s_criticalSectionLocal; | |
| 75 | 65 |
| 76 public: | 66 public: |
| 77 | |
| 78 ~CPluginClientBase(); | |
| 79 | |
| 80 static void SetLocalization(); | |
| 81 | |
| 82 static void LogPluginError(DWORD errorCode, int errorId, int errorSubid, const
std::string& description="", bool isAsync=false, DWORD dwProcessId=0, DWORD dwT
hreadId=0); | 67 static void LogPluginError(DWORD errorCode, int errorId, int errorSubid, const
std::string& description="", bool isAsync=false, DWORD dwProcessId=0, DWORD dwT
hreadId=0); |
| 83 | |
| 84 static void PostPluginError(int errorId, int errorSubid, DWORD errorCode, cons
t std::string& errorDescription); | 68 static void PostPluginError(int errorId, int errorSubid, DWORD errorCode, cons
t std::string& errorDescription); |
| 85 static bool PopFirstPluginError(CPluginError& pluginError); | 69 static bool PopFirstPluginError(CPluginError& pluginError); |
| 86 }; | 70 }; |
| 87 | 71 |
| 88 /** | 72 /** |
| 89 * Wrapper around Microsoft API 'UrlUnescape' | 73 * Wrapper around Microsoft API 'UrlUnescape' |
| 90 * | 74 * |
| 91 * This function has modify-in-place semantics. | 75 * This function has modify-in-place semantics. |
| 92 * This behavior matches that of the legacy version of this function declared ab
ove. | 76 * This behavior matches that of the legacy version of this function declared ab
ove. |
| 93 * At present, callers of this function have no code to handle error conditions
that might arise here. | 77 * At present, callers of this function have no code to handle error conditions
that might arise here. |
| 94 * Because there's no error handling, therefore, this masks failures in UrlUnesc
ape. | 78 * Because there's no error handling, therefore, this masks failures in UrlUnesc
ape. |
| 95 */ | 79 */ |
| 96 void UnescapeUrl(std::wstring& url); | 80 void UnescapeUrl(std::wstring& url); |
| 97 | 81 |
| 98 #endif // _PLUGIN_CLIENT_BASE_H_ | 82 #endif // _PLUGIN_CLIENT_BASE_H_ |
| LEFT | RIGHT |