Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: chrome_elf/breakpad.cc

Issue 1963373003: Revert of Remove dependencies on chrome\installer from the ChromeCrashReporterClient class on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome_elf/blacklist/test/blacklist_test_main_dll.cc ('k') | chrome_elf/chrome_elf_main.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // This module contains the necessary code to register the Breakpad exception 5 // This module contains the necessary code to register the Breakpad exception
6 // handler. This implementation is based on Chrome's crash reporting code. 6 // handler. This implementation is based on Chrome's crash reporting code.
7 7
8 #include "chrome_elf/breakpad.h" 8 #include "chrome_elf/breakpad.h"
9 9
10 #include <sddl.h> 10 #include <sddl.h>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/strings/string16.h"
14 #include "breakpad/src/client/windows/handler/exception_handler.h" 13 #include "breakpad/src/client/windows/handler/exception_handler.h"
15 #include "chrome/common/chrome_version.h" 14 #include "chrome/common/chrome_version.h"
16 #include "chrome/install_static/install_util.h" 15 #include "chrome/install_static/install_util.h"
17 16
18 google_breakpad::ExceptionHandler* g_elf_breakpad = NULL; 17 google_breakpad::ExceptionHandler* g_elf_breakpad = NULL;
19 18
20 namespace { 19 namespace {
21 20
22 const wchar_t kBreakpadProductName[] = L"Chrome"; 21 const wchar_t kBreakpadProductName[] = L"Chrome";
23 const wchar_t kBreakpadVersionEntry[] = L"ver"; 22 const wchar_t kBreakpadVersionEntry[] = L"ver";
24 const wchar_t kBreakpadProdEntry[] = L"prod"; 23 const wchar_t kBreakpadProdEntry[] = L"prod";
25 const wchar_t kBreakpadPlatformEntry[] = L"plat"; 24 const wchar_t kBreakpadPlatformEntry[] = L"plat";
26 const wchar_t kBreakpadPlatformWin32[] = L"Win32"; 25 const wchar_t kBreakpadPlatformWin32[] = L"Win32";
27 const wchar_t kBreakpadProcessEntry[] = L"ptype"; 26 const wchar_t kBreakpadProcessEntry[] = L"ptype";
28 const wchar_t kBreakpadChannelEntry[] = L"channel"; 27 const wchar_t kBreakpadChannelEntry[] = L"channel";
29 28
30 // The protocol for connecting to the out-of-process Breakpad crash 29 // The protocol for connecting to the out-of-process Breakpad crash
31 // reporter is different for x86-32 and x86-64: the message sizes 30 // reporter is different for x86-32 and x86-64: the message sizes
32 // are different because the message struct contains a pointer. As 31 // are different because the message struct contains a pointer. As
33 // a result, there are two different named pipes to connect to. The 32 // a result, there are two different named pipes to connect to. The
34 // 64-bit one is distinguished with an "-x64" suffix. 33 // 64-bit one is distinguished with an "-x64" suffix.
35 const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices\\"; 34 const wchar_t kChromePipeName[] = L"\\\\.\\pipe\\ChromeCrashServices\\";
36 const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\"; 35 const wchar_t kGoogleUpdatePipeName[] = L"\\\\.\\pipe\\GoogleCrashServices\\";
37 const wchar_t kSystemPrincipalSid[] = L"S-1-5-18"; 36 const wchar_t kSystemPrincipalSid[] = L"S-1-5-18";
38 37
39 const wchar_t kNoErrorDialogs[] = L"noerrdialogs"; 38 const wchar_t kNoErrorDialogs[] = L"noerrdialogs";
40 39
41 google_breakpad::CustomClientInfo* GetCustomInfo() { 40 google_breakpad::CustomClientInfo* GetCustomInfo() {
42 base::string16 process = 41 base::string16 process = IsNonBrowserProcess() ? L"renderer" : L"browser";
43 install_static::IsNonBrowserProcess() ? L"renderer" : L"browser";
44 42
45 wchar_t exe_path[MAX_PATH] = {}; 43 wchar_t exe_path[MAX_PATH] = {};
46 base::string16 channel; 44 base::string16 channel;
47 if (GetModuleFileName(NULL, exe_path, arraysize(exe_path)) && 45 if (GetModuleFileName(NULL, exe_path, arraysize(exe_path)) &&
48 install_static::IsSxSChrome(exe_path)) { 46 IsCanary(exe_path)) {
49 channel = L"canary"; 47 channel = L"canary";
50 } 48 }
51 49
52 static google_breakpad::CustomInfoEntry ver_entry( 50 static google_breakpad::CustomInfoEntry ver_entry(
53 kBreakpadVersionEntry, TEXT(CHROME_VERSION_STRING)); 51 kBreakpadVersionEntry, TEXT(CHROME_VERSION_STRING));
54 static google_breakpad::CustomInfoEntry prod_entry( 52 static google_breakpad::CustomInfoEntry prod_entry(
55 kBreakpadProdEntry, kBreakpadProductName); 53 kBreakpadProdEntry, kBreakpadProductName);
56 static google_breakpad::CustomInfoEntry plat_entry( 54 static google_breakpad::CustomInfoEntry plat_entry(
57 kBreakpadPlatformEntry, kBreakpadPlatformWin32); 55 kBreakpadPlatformEntry, kBreakpadPlatformWin32);
58 static google_breakpad::CustomInfoEntry proc_entry( 56 static google_breakpad::CustomInfoEntry proc_entry(
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 139
142 #if defined(GOOGLE_CHROME_BUILD) && defined(OFFICIAL_BUILD) 140 #if defined(GOOGLE_CHROME_BUILD) && defined(OFFICIAL_BUILD)
143 bool is_official_chrome_build = true; 141 bool is_official_chrome_build = true;
144 #else 142 #else
145 bool is_official_chrome_build = false; 143 bool is_official_chrome_build = false;
146 #endif 144 #endif
147 145
148 base::string16 pipe_name; 146 base::string16 pipe_name;
149 147
150 bool enabled_by_policy = false; 148 bool enabled_by_policy = false;
151 bool use_policy = 149 bool use_policy = ReportingIsEnforcedByPolicy(&enabled_by_policy);
152 install_static::ReportingIsEnforcedByPolicy(&enabled_by_policy);
153 150
154 if (!use_policy && IsHeadless()) { 151 if (!use_policy && IsHeadless()) {
155 pipe_name = kChromePipeName; 152 pipe_name = kChromePipeName;
156 } else if (use_policy ? enabled_by_policy 153 } else if (use_policy ?
157 : (is_official_chrome_build && 154 enabled_by_policy :
158 install_static::GetCollectStatsConsent())) { 155 (is_official_chrome_build && AreUsageStatsEnabled(exe_path))) {
159 // Build the pipe name. It can be one of: 156 // Build the pipe name. It can be one of:
160 // 32-bit system: \\.\pipe\GoogleCrashServices\S-1-5-18 157 // 32-bit system: \\.\pipe\GoogleCrashServices\S-1-5-18
161 // 32-bit user: \\.\pipe\GoogleCrashServices\<user SID> 158 // 32-bit user: \\.\pipe\GoogleCrashServices\<user SID>
162 // 64-bit system: \\.\pipe\GoogleCrashServices\S-1-5-18-x64 159 // 64-bit system: \\.\pipe\GoogleCrashServices\S-1-5-18-x64
163 // 64-bit user: \\.\pipe\GoogleCrashServices\<user SID>-x64 160 // 64-bit user: \\.\pipe\GoogleCrashServices\<user SID>-x64
164 base::string16 user_sid = install_static::IsSystemInstall(exe_path) 161 base::string16 user_sid = IsSystemInstall(exe_path) ? kSystemPrincipalSid :
165 ? kSystemPrincipalSid 162 GetUserSidString();
166 : GetUserSidString();
167 if (user_sid.empty()) 163 if (user_sid.empty())
168 return; 164 return;
169 165
170 pipe_name = kGoogleUpdatePipeName; 166 pipe_name = kGoogleUpdatePipeName;
171 pipe_name += user_sid; 167 pipe_name += user_sid;
172 168
173 #if defined(_WIN64) 169 #if defined(_WIN64)
174 pipe_name += L"-x64"; 170 pipe_name += L"-x64";
175 #endif 171 #endif
176 } else { 172 } else {
(...skipping 10 matching lines...) Expand all
187 google_breakpad::ExceptionHandler::HANDLER_ALL, 183 google_breakpad::ExceptionHandler::HANDLER_ALL,
188 dump_type, 184 dump_type,
189 pipe_name.c_str(), 185 pipe_name.c_str(),
190 GetCustomInfo()); 186 GetCustomInfo());
191 187
192 if (g_elf_breakpad->IsOutOfProcess()) { 188 if (g_elf_breakpad->IsOutOfProcess()) {
193 // Tells breakpad to handle breakpoint and single step exceptions. 189 // Tells breakpad to handle breakpoint and single step exceptions.
194 g_elf_breakpad->set_handle_debug_exceptions(true); 190 g_elf_breakpad->set_handle_debug_exceptions(true);
195 } 191 }
196 } 192 }
OLDNEW
« no previous file with comments | « chrome_elf/blacklist/test/blacklist_test_main_dll.cc ('k') | chrome_elf/chrome_elf_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698