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

Side by Side Diff: src/plugin/PluginDebug.cpp

Issue 4912420225024000: Issue #1234 - Convert strings associated with URL's (Closed)
Patch Set: Created Jan. 5, 2015, 4:15 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 #include "PluginStdAfx.h" 1 #include "PluginStdAfx.h"
2 2
3 #include "PluginDebug.h" 3 #include "PluginDebug.h"
4 #include "PluginMutex.h" 4 #include "PluginMutex.h"
5 #include "PluginSettings.h" 5 #include "PluginSettings.h"
6 6
7 7
8 class CPluginDebugLock : public CPluginMutex 8 class CPluginDebugLock : public CPluginMutex
9 { 9 {
10 10
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 176 }
177 177
178 void CPluginDebug::DebugResultDomain(const CString& domain) 178 void CPluginDebug::DebugResultDomain(const CString& domain)
179 { 179 {
180 DebugResult(L"================================================================ ================================================================================ ==========================================="); 180 DebugResult(L"================================================================ ================================================================================ ===========================================");
181 DebugResult(domain); 181 DebugResult(domain);
182 DebugResult(L"================================================================ ================================================================================ ==========================================="); 182 DebugResult(L"================================================================ ================================================================================ ===========================================");
183 } 183 }
184 184
185 185
186 void CPluginDebug::DebugResultBlocking(const CString& type, const CString& src, const std::wstring& domain) 186 void CPluginDebug::DebugResultBlocking(const CString& type, const std::wstring& src, const std::wstring& domain)
187 { 187 {
188 CString srcTrunc = src; 188 CString srcTrunc = ToCString(src);
189 if (srcTrunc.GetLength() > 100) 189 if (src.length() > 100)
190 { 190 {
191 srcTrunc = src.Left(67) + L"..." + src.Right(30); 191 srcTrunc = srcTrunc.Left(67) + L"..." + srcTrunc.Right(30);
192 } 192 }
193 193
194 CString blocking; 194 CString blocking;
195 blocking.Format(L"Blocked %-12s %-20s %s", type, domain.empty()? L"-" : to_ CString(domain), srcTrunc); 195 blocking.Format(L"Blocked %-12s %-20s %s", type, domain.empty()? L"-" : to_ CString(domain), srcTrunc);
196 196
197 DebugResult(blocking); 197 DebugResult(blocking);
198 } 198 }
199 199
200 200
201 void CPluginDebug::DebugResultHiding(const CString& tag, const CString& src, con st CString& filter) 201 void CPluginDebug::DebugResultHiding(const CString& tag, const CString& id, cons t CString& filter)
202 { 202 {
203 CString srcTrunc = src; 203 CString srcTrunc = id;
204 if (srcTrunc.GetLength() > 100) 204 if (srcTrunc.GetLength() > 100)
205 { 205 {
206 srcTrunc = src.Left(67) + L"..." + src.Right(30); 206 srcTrunc = srcTrunc.Left(67) + L"..." + srcTrunc.Right(30);
207 } 207 }
208 208
209 CString blocking; 209 CString blocking;
210 blocking.Format(L"Hidden %-12s - %s %s", tag, srcTrunc, filter); 210 blocking.Format(L"Hidden %-12s - %s %s", tag, srcTrunc, filter);
211 211
212 DebugResult(blocking); 212 DebugResult(blocking);
213 } 213 }
214 214
215 215
216 void CPluginDebug::DebugResultClear() 216 void CPluginDebug::DebugResultClear()
217 { 217 {
218 CPluginDebugLock lock; 218 CPluginDebugLock lock;
219 if (lock.IsLocked()) 219 if (lock.IsLocked())
220 { 220 {
221 DeleteFileW(GetDataPath(L"debug_result.txt").c_str()); 221 DeleteFileW(GetDataPath(L"debug_result.txt").c_str());
222 } 222 }
223 } 223 }
224 224
225 #endif // ENABLE_DEBUG_RESULT 225 #endif // ENABLE_DEBUG_RESULT
226 226
227 227
228 #ifdef ENABLE_DEBUG_RESULT_IGNORED 228 #ifdef ENABLE_DEBUG_RESULT_IGNORED
229 229
230 void CPluginDebug::DebugResultIgnoring(const CString& type, const CString& src, const std::wstring& domain) 230 void CPluginDebug::DebugResultIgnoring(const CString& type, const std::wstring& src, const std::wstring& domain)
231 { 231 {
232 CString srcTrunc = src; 232 CString srcTrunc = ToCString(src);
233 if (srcTrunc.GetLength() > 100) 233 if (src.length() > 100)
234 { 234 {
235 srcTrunc = src.Left(67) + L"..." + src.Right(30); 235 srcTrunc = srcTrunc.Left(67) + L"..." + srcTrunc.Right(30);
236 } 236 }
237 237
238 CString blocking; 238 CString blocking;
239 blocking.Format(L"Ignored %-12s %s %s", type, domain.empty()? L"-" : to_CSt ring(domain), srcTrunc); 239 blocking.Format(L"Ignored %-12s %s %s", type, domain.empty()? L"-" : to_CSt ring(domain), srcTrunc);
240 240
241 DebugResult(blocking); 241 DebugResult(blocking);
242 } 242 }
243 243
244 #endif // ENABLE_DEBUG_RESULT_IGNORED 244 #endif // ENABLE_DEBUG_RESULT_IGNORED
OLDNEW

Powered by Google App Engine
This is Rietveld