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

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

Issue 6032593782833152: Issue 1173 - proposal for entry point (Closed)
Patch Set: base on current tip Created Jan. 29, 2015, 1:29 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
« no previous file with comments | « src/plugin/PluginUtil.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
(...skipping 27 matching lines...) Expand all
38 { 38 {
39 return FileUrl(HtmlFolderPath() + L"firstRun.html"); 39 return FileUrl(HtmlFolderPath() + L"firstRun.html");
40 } 40 }
41 41
42 std::wstring FileUrl(const std::wstring& path) 42 std::wstring FileUrl(const std::wstring& path)
43 { 43 {
44 std::wstring url = path; 44 std::wstring url = path;
45 std::replace(url.begin(), url.end(), L'\\', L'/'); 45 std::replace(url.begin(), url.end(), L'\\', L'/');
46 return L"file:///" + url; 46 return L"file:///" + url;
47 } 47 }
48
49 bool EntryPoint(const std::function<void()>& functionBody)
50 {
51 bool withoutException = true;
52 if (!functionBody)
53 {
54 return withoutException;
55 }
56 try
57 {
58 functionBody();
59 } catch(...)
60 {
61 withoutException = false;
62 }
63 return withoutException;
64 }
65
66 HRESULT EntryPointWithHResult(const std::function<HRESULT()>& functionBody)
67 {
68 HRESULT retValue = S_OK;
69 if (!functionBody)
70 {
71 return retValue;
72 }
73 try
74 {
75 functionBody();
76 } catch(...)
77 {
78 retValue = E_FAIL;
79 }
80 return retValue;
81 }
82
OLDNEW
« no previous file with comments | « src/plugin/PluginUtil.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld