OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SANDBOX_SANDBOX_POC_MAIN_UI_WINDOW_H__ | 5 #ifndef SANDBOX_SANDBOX_POC_MAIN_UI_WINDOW_H__ |
6 #define SANDBOX_SANDBOX_POC_MAIN_UI_WINDOW_H__ | 6 #define SANDBOX_SANDBOX_POC_MAIN_UI_WINDOW_H__ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/strings/string16.h" |
11 | 12 |
12 namespace sandbox { | 13 namespace sandbox { |
13 class BrokerServices; | 14 class BrokerServices; |
14 enum ResultCode; | 15 enum ResultCode; |
15 } | 16 } |
16 | 17 |
17 // Header file for the MainUIWindow, a simple window with a menu bar that | 18 // Header file for the MainUIWindow, a simple window with a menu bar that |
18 // can pop up a dialog (accessible through the menu bar), to specify a path and | 19 // can pop up a dialog (accessible through the menu bar), to specify a path and |
19 // filename of any DLL to load and choose an entry point of his/her choice | 20 // filename of any DLL to load and choose an entry point of his/her choice |
20 // (note: only entry points with no parameters are expected to work). | 21 // (note: only entry points with no parameters are expected to work). |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 // (as command line arguments) the DLL path and the entry point function | 118 // (as command line arguments) the DLL path and the entry point function |
118 // name. The EXE is expected to parse the command line and load the DLL. | 119 // name. The EXE is expected to parse the command line and load the DLL. |
119 // NOTE: The broker does not know if the target EXE successfully loaded the | 120 // NOTE: The broker does not know if the target EXE successfully loaded the |
120 // DLL, for that you have to rely on the EXE providing a log. | 121 // DLL, for that you have to rely on the EXE providing a log. |
121 // Returns true if the broker reports that it was successful in creating | 122 // Returns true if the broker reports that it was successful in creating |
122 // the target and false if not. | 123 // the target and false if not. |
123 bool SpawnTarget(); | 124 bool SpawnTarget(); |
124 | 125 |
125 // Shows a standard File Open dialog and returns the DLL filename selected or | 126 // Shows a standard File Open dialog and returns the DLL filename selected or |
126 // blank string if the user cancelled (or an error occurred). | 127 // blank string if the user cancelled (or an error occurred). |
127 std::wstring OnShowBrowseForDllDlg(HWND owner); | 128 base::string16 OnShowBrowseForDllDlg(HWND owner); |
128 | 129 |
129 // Shows a standard Save As dialog and returns the log filename selected or | 130 // Shows a standard Save As dialog and returns the log filename selected or |
130 // blank string if the user cancelled (or an error occurred). | 131 // blank string if the user cancelled (or an error occurred). |
131 std::wstring OnShowBrowseForLogFileDlg(HWND owner); | 132 base::string16 OnShowBrowseForLogFileDlg(HWND owner); |
132 | 133 |
133 // Formats a message using the supplied format string and prints it in the | 134 // Formats a message using the supplied format string and prints it in the |
134 // listview in the main UI window. Passing a NULL param in 'fmt' results in | 135 // listview in the main UI window. Passing a NULL param in 'fmt' results in |
135 // no action being performed. Maximum message length is 1K. | 136 // no action being performed. Maximum message length is 1K. |
136 void AddDebugMessage(const wchar_t* format, ...); | 137 void AddDebugMessage(const wchar_t* format, ...); |
137 | 138 |
138 // Assists AddDebugMessage in displaying a message in the ListView. It | 139 // Assists AddDebugMessage in displaying a message in the ListView. It |
139 // simply wraps ListView_InsertItem to insert a debugging message to the | 140 // simply wraps ListView_InsertItem to insert a debugging message to the |
140 // top of the list view. Passing a NULL param in 'fmt' results in no action | 141 // top of the list view. Passing a NULL param in 'fmt' results in no action |
141 // being performed. | 142 // being performed. |
(...skipping 15 matching lines...) Expand all Loading... |
157 | 158 |
158 // The BrokerServices will be used to spawn an EXE in a sandbox and ask | 159 // The BrokerServices will be used to spawn an EXE in a sandbox and ask |
159 // it to load a DLL. | 160 // it to load a DLL. |
160 sandbox::BrokerServices* broker_; | 161 sandbox::BrokerServices* broker_; |
161 | 162 |
162 // Contains the information about the running target. | 163 // Contains the information about the running target. |
163 PROCESS_INFORMATION target_; | 164 PROCESS_INFORMATION target_; |
164 | 165 |
165 // This is essentially a command line to a target executable that the | 166 // This is essentially a command line to a target executable that the |
166 // broker will spawn and ask to load the DLL. | 167 // broker will spawn and ask to load the DLL. |
167 std::wstring spawn_target_; | 168 base::string16 spawn_target_; |
168 | 169 |
169 // A handle to the current instance of the app. Passed in to this class | 170 // A handle to the current instance of the app. Passed in to this class |
170 // through CreateMainWindowAndLoop. | 171 // through CreateMainWindowAndLoop. |
171 HINSTANCE instance_handle_; | 172 HINSTANCE instance_handle_; |
172 | 173 |
173 // A path to the DLL that the target should load once it executes. | 174 // A path to the DLL that the target should load once it executes. |
174 std::wstring dll_path_; | 175 base::string16 dll_path_; |
175 | 176 |
176 // The name of the entry point the target should call after it loads the DLL. | 177 // The name of the entry point the target should call after it loads the DLL. |
177 std::wstring entry_point_; | 178 base::string16 entry_point_; |
178 | 179 |
179 // The name of the log file to use. | 180 // The name of the log file to use. |
180 std::wstring log_file_; | 181 base::string16 log_file_; |
181 | 182 |
182 // This is a static handle to the list view that fills up the entire main | 183 // This is a static handle to the list view that fills up the entire main |
183 // UI window. The list view is used to display debugging information to the | 184 // UI window. The list view is used to display debugging information to the |
184 // user. | 185 // user. |
185 static HWND list_view_; | 186 static HWND list_view_; |
186 | 187 |
187 // Pipe used to communicate the logs between the target and the broker. | 188 // Pipe used to communicate the logs between the target and the broker. |
188 HANDLE pipe_handle_; | 189 HANDLE pipe_handle_; |
189 | 190 |
190 DISALLOW_COPY_AND_ASSIGN(MainUIWindow); | 191 DISALLOW_COPY_AND_ASSIGN(MainUIWindow); |
191 }; | 192 }; |
192 | 193 |
193 #endif // SANDBOX_SANDBOX_POC_MAIN_UI_WINDOW_H__ | 194 #endif // SANDBOX_SANDBOX_POC_MAIN_UI_WINDOW_H__ |
OLD | NEW |