| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 #include "chrome/app/breakpad.h" | 5 #include "chrome/app/breakpad.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <tchar.h> | 8 #include <tchar.h> |
| 9 | 9 |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace | 124 } // namespace |
| 125 | 125 |
| 126 // This function is executed by the child process that DumpDoneCallback() | 126 // This function is executed by the child process that DumpDoneCallback() |
| 127 // spawned and basically just shows the 'chrome has crashed' dialog if | 127 // spawned and basically just shows the 'chrome has crashed' dialog if |
| 128 // the CHROME_CRASHED environment variable is present. | 128 // the CHROME_CRASHED environment variable is present. |
| 129 bool ShowRestartDialogIfCrashed(bool* exit_now) { | 129 bool ShowRestartDialogIfCrashed(bool* exit_now) { |
| 130 if (!::GetEnvironmentVariableW(env_vars::kShowRestart, NULL, 0)) | 130 if (!::GetEnvironmentVariableW(env_vars::kShowRestart, NULL, 0)) |
| 131 return false; | 131 return false; |
| 132 |
| 132 DWORD len = ::GetEnvironmentVariableW(env_vars::kRestartInfo, NULL, 0); | 133 DWORD len = ::GetEnvironmentVariableW(env_vars::kRestartInfo, NULL, 0); |
| 133 if (!len) | 134 if (!len) |
| 134 return false; | 135 return true; |
| 136 |
| 135 wchar_t* restart_data = new wchar_t[len + 1]; | 137 wchar_t* restart_data = new wchar_t[len + 1]; |
| 136 ::GetEnvironmentVariableW(env_vars::kRestartInfo, restart_data, len); | 138 ::GetEnvironmentVariableW(env_vars::kRestartInfo, restart_data, len); |
| 137 restart_data[len] = 0; | 139 restart_data[len] = 0; |
| 138 // The CHROME_RESTART var contains the dialog strings separated by '|'. | 140 // The CHROME_RESTART var contains the dialog strings separated by '|'. |
| 139 // See PrepareRestartOnCrashEnviroment() function for details. | 141 // See PrepareRestartOnCrashEnviroment() function for details. |
| 140 std::vector<std::wstring> dlg_strings; | 142 std::vector<std::wstring> dlg_strings; |
| 141 SplitString(restart_data, L'|', &dlg_strings); | 143 SplitString(restart_data, L'|', &dlg_strings); |
| 142 delete[] restart_data; | 144 delete[] restart_data; |
| 143 if (dlg_strings.size() < 3) | 145 if (dlg_strings.size() < 3) |
| 144 return false; | 146 return true; |
| 145 | 147 |
| 146 // If the UI layout is right-to-left, we need to pass the appropriate MB_XXX | 148 // If the UI layout is right-to-left, we need to pass the appropriate MB_XXX |
| 147 // flags so that an RTL message box is displayed. | 149 // flags so that an RTL message box is displayed. |
| 148 UINT flags = MB_OKCANCEL | MB_ICONWARNING; | 150 UINT flags = MB_OKCANCEL | MB_ICONWARNING; |
| 149 if (dlg_strings[2] == env_vars::kRtlLocale) | 151 if (dlg_strings[2] == env_vars::kRtlLocale) |
| 150 flags |= MB_RIGHT | MB_RTLREADING; | 152 flags |= MB_RIGHT | MB_RTLREADING; |
| 151 | 153 |
| 152 // Show the dialog now. It is ok if another chrome is started by the | 154 // Show the dialog now. It is ok if another chrome is started by the |
| 153 // user since we have not initialized the databases. | 155 // user since we have not initialized the databases. |
| 154 *exit_now = (IDOK != ::MessageBoxW(NULL, dlg_strings[1].c_str(), | 156 *exit_now = (IDOK != ::MessageBoxW(NULL, dlg_strings[1].c_str(), |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 } else { | 264 } else { |
| 263 if (QueueUserWorkItem( | 265 if (QueueUserWorkItem( |
| 264 &InitCrashReporterThread, info, WT_EXECUTELONGFUNCTION) == 0) { | 266 &InitCrashReporterThread, info, WT_EXECUTELONGFUNCTION) == 0) { |
| 265 // We failed to queue to the worker pool, initialize in this thread. | 267 // We failed to queue to the worker pool, initialize in this thread. |
| 266 InitCrashReporterThread(info); | 268 InitCrashReporterThread(info); |
| 267 } | 269 } |
| 268 } | 270 } |
| 269 } | 271 } |
| 270 } | 272 } |
| 271 | 273 |
| OLD | NEW |