OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #import "components/crash/app/breakpad_mac.h" | 5 #import "components/crash/app/breakpad_mac.h" |
6 | 6 |
7 #include <CoreFoundation/CoreFoundation.h> | 7 #include <CoreFoundation/CoreFoundation.h> |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // Check whether crash reporting should be enabled. If enterprise | 160 // Check whether crash reporting should be enabled. If enterprise |
161 // configuration management controls crash reporting, it takes precedence. | 161 // configuration management controls crash reporting, it takes precedence. |
162 // Otherwise, check whether the user has consented to stats and crash | 162 // Otherwise, check whether the user has consented to stats and crash |
163 // reporting. The browser process can make this determination directly. | 163 // reporting. The browser process can make this determination directly. |
164 // Helper processes may not have access to the disk or to the same data as | 164 // Helper processes may not have access to the disk or to the same data as |
165 // the browser process, so the browser passes the decision to them on the | 165 // the browser process, so the browser passes the decision to them on the |
166 // command line. | 166 // command line. |
167 NSBundle* main_bundle = base::mac::FrameworkBundle(); | 167 NSBundle* main_bundle = base::mac::FrameworkBundle(); |
168 bool is_browser = !base::mac::IsBackgroundOnlyProcess(); | 168 bool is_browser = !base::mac::IsBackgroundOnlyProcess(); |
169 bool enable_breakpad = false; | 169 bool enable_breakpad = false; |
170 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 170 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
171 | 171 |
172 if (is_browser) { | 172 if (is_browser) { |
173 // Since the configuration management infrastructure is possibly not | 173 // Since the configuration management infrastructure is possibly not |
174 // initialized when this code runs, read the policy preference directly. | 174 // initialized when this code runs, read the policy preference directly. |
175 if (!GetCrashReporterClient()->ReportingIsEnforcedByPolicy( | 175 if (!GetCrashReporterClient()->ReportingIsEnforcedByPolicy( |
176 &enable_breakpad)) { | 176 &enable_breakpad)) { |
177 // Controlled by the user. The crash reporter may be enabled by | 177 // Controlled by the user. The crash reporter may be enabled by |
178 // preference or through an environment variable, but the kDisableBreakpad | 178 // preference or through an environment variable, but the kDisableBreakpad |
179 // switch overrides both. | 179 // switch overrides both. |
180 enable_breakpad = GetCrashReporterClient()->GetCollectStatsConsent() || | 180 enable_breakpad = GetCrashReporterClient()->GetCollectStatsConsent() || |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 | 285 |
286 // Store process type in crash dump. | 286 // Store process type in crash dump. |
287 SetCrashKeyValue(@"ptype", process_type); | 287 SetCrashKeyValue(@"ptype", process_type); |
288 | 288 |
289 NSString* pid_value = | 289 NSString* pid_value = |
290 [NSString stringWithFormat:@"%d", static_cast<unsigned int>(getpid())]; | 290 [NSString stringWithFormat:@"%d", static_cast<unsigned int>(getpid())]; |
291 SetCrashKeyValue(@"pid", pid_value); | 291 SetCrashKeyValue(@"pid", pid_value); |
292 } | 292 } |
293 | 293 |
294 } // namespace breakpad | 294 } // namespace breakpad |
OLD | NEW |