Chromium Code Reviews| Index: win8/delegate_execute/crash_server_init.cc |
| diff --git a/chrome_frame/crash_server_init.cc b/win8/delegate_execute/crash_server_init.cc |
| similarity index 68% |
| copy from chrome_frame/crash_server_init.cc |
| copy to win8/delegate_execute/crash_server_init.cc |
| index 44b404989cf475d8618e65ab776543749616a274..68e787f8678456d77311847e33112ba8a20d6b07 100644 |
| --- a/chrome_frame/crash_server_init.cc |
| +++ b/win8/delegate_execute/crash_server_init.cc |
| @@ -2,12 +2,15 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "chrome_frame/crash_server_init.h" |
| +#include "win8/delegate_execute/crash_server_init.h" |
| #include <sddl.h> |
| -#include <Shlobj.h> |
| +#include <shlobj.h> |
| #include <stdlib.h> |
| -#include "version.h" // NOLINT |
| + |
| +#include "base/file_version_info.h" |
| +#include "base/scoped_ptr.h" |
| +#include "base/win/win_util.h" |
|
grt (UTC plus 2)
2012/11/21 19:27:50
#include "client/windows/handler/exception_handler
robertshield
2012/11/21 21:09:15
Done.
|
| const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices"; |
| const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\"; |
| @@ -20,36 +23,7 @@ const MINIDUMP_TYPE kLargerDumpType = static_cast<MINIDUMP_TYPE>( |
| extern "C" IMAGE_DOS_HEADER __ImageBase; |
| -// Builds a string representation of the user's SID and places it in user_sid. |
| -bool GetUserSidString(std::wstring* user_sid) { |
| - bool success = false; |
| - if (user_sid) { |
| - struct { |
| - TOKEN_USER token_user; |
| - BYTE buffer[SECURITY_MAX_SID_SIZE]; |
| - } token_info_buffer; |
| - |
| - HANDLE token = NULL; |
| - if (OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &token)) { |
| - DWORD out_size; |
| - if (GetTokenInformation(token, TokenUser, &token_info_buffer.token_user, |
| - sizeof(token_info_buffer), &out_size)) { |
| - wchar_t* user_sid_value = NULL; |
| - if (token_info_buffer.token_user.User.Sid && |
| - ConvertSidToStringSid(token_info_buffer.token_user.User.Sid, |
| - &user_sid_value)) { |
| - *user_sid = user_sid_value; |
| - LocalFree(user_sid_value); |
| - user_sid_value = NULL; |
| - success = true; |
| - } |
| - } |
| - CloseHandle(token); |
| - } |
| - } |
| - |
| - return success; |
| -} |
| +namespace { |
| bool IsRunningSystemInstall() { |
| wchar_t exe_path[MAX_PATH * 2] = {0}; |
| @@ -70,12 +44,18 @@ bool IsRunningSystemInstall() { |
| return is_system; |
| } |
| +} // namespace |
| + |
| google_breakpad::CustomClientInfo* GetCustomInfo() { |
|
grt (UTC plus 2)
2012/11/21 19:27:50
move this into the unnamed namespace
robertshield
2012/11/21 21:09:15
Done.
|
| + scoped_ptr<FileVersionInfo> version_info( |
| + FileVersionInfo::CreateFileVersionInfoForCurrentModule()); |
| + |
| static google_breakpad::CustomInfoEntry ver_entry( |
| - L"ver", TEXT(CHROME_VERSION_STRING)); |
| - static google_breakpad::CustomInfoEntry prod_entry(L"prod", L"ChromeFrame"); |
| + L"ver", version_info.file_version().c_str()); |
| + static google_breakpad::CustomInfoEntry prod_entry(L"prod", L"Chrome"); |
| static google_breakpad::CustomInfoEntry plat_entry(L"plat", L"Win32"); |
| - static google_breakpad::CustomInfoEntry type_entry(L"ptype", L"chrome_frame"); |
| + static google_breakpad::CustomInfoEntry type_entry(L"ptype", |
| + L"delegate_execute"); |
| static google_breakpad::CustomInfoEntry entries[] = { |
| ver_entry, prod_entry, plat_entry, type_entry }; |
| static google_breakpad::CustomClientInfo custom_info = { |
| @@ -88,7 +68,7 @@ google_breakpad::ExceptionHandler* InitializeCrashReporting( |
| wchar_t temp_path[MAX_PATH + 1] = {0}; |
| DWORD path_len = ::GetTempPath(MAX_PATH, temp_path); |
| - std::wstring pipe_name; |
| + string16 pipe_name; |
| if (mode == HEADLESS) { |
| // This flag is used for testing, connect to the test crash service. |
| pipe_name = kChromePipeName; |
| @@ -99,8 +79,8 @@ google_breakpad::ExceptionHandler* InitializeCrashReporting( |
| if (IsRunningSystemInstall()) { |
| pipe_name += kSystemPrincipalSid; |
| } else { |
| - std::wstring user_sid; |
| - if (GetUserSidString(&user_sid)) { |
| + string16 user_sid; |
| + if (base::win::GetUserSidString(&user_sid)) { |
| pipe_name += user_sid; |
| } else { |
| // We don't think we're a system install, but we couldn't get the |