OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/breakpad/breakpad_mac.h" | 5 #import "components/breakpad/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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 // the browser process, so the browser passes the decision to them on the | 159 // the browser process, so the browser passes the decision to them on the |
160 // command line. | 160 // command line. |
161 NSBundle* main_bundle = base::mac::FrameworkBundle(); | 161 NSBundle* main_bundle = base::mac::FrameworkBundle(); |
162 bool is_browser = !base::mac::IsBackgroundOnlyProcess(); | 162 bool is_browser = !base::mac::IsBackgroundOnlyProcess(); |
163 bool enable_breakpad = false; | 163 bool enable_breakpad = false; |
164 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 164 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
165 | 165 |
166 if (is_browser) { | 166 if (is_browser) { |
167 // Since the configuration management infrastructure is possibly not | 167 // Since the configuration management infrastructure is possibly not |
168 // initialized when this code runs, read the policy preference directly. | 168 // initialized when this code runs, read the policy preference directly. |
169 if (GetBreakpadClient()->ReportingIsEnforcedByPolicy()) { | 169 if (!GetBreakpadClient()->ReportingIsEnforcedByPolicy(&enable_breakpad)) { |
170 // Controlled by configuration manangement. | |
171 enable_breakpad = true; | |
172 } else { | |
173 // Controlled by the user. The crash reporter may be enabled by | 170 // Controlled by the user. The crash reporter may be enabled by |
174 // preference or through an environment variable, but the kDisableBreakpad | 171 // preference or through an environment variable, but the kDisableBreakpad |
175 // switch overrides both. | 172 // switch overrides both. |
176 enable_breakpad = GetBreakpadClient()->GetCollectStatsConsent() || | 173 enable_breakpad = GetBreakpadClient()->GetCollectStatsConsent() || |
177 GetBreakpadClient()->IsRunningUnattended(); | 174 GetBreakpadClient()->IsRunningUnattended(); |
178 enable_breakpad &= !command_line->HasSwitch(switches::kDisableBreakpad); | 175 enable_breakpad &= !command_line->HasSwitch(switches::kDisableBreakpad); |
179 } | 176 } |
180 } else { | 177 } else { |
181 // This is a helper process, check the command line switch. | 178 // This is a helper process, check the command line switch. |
182 enable_breakpad = command_line->HasSwitch(switches::kEnableCrashReporter); | 179 enable_breakpad = command_line->HasSwitch(switches::kEnableCrashReporter); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 process_type = base::SysUTF8ToNSString(process_type_switch); | 270 process_type = base::SysUTF8ToNSString(process_type_switch); |
274 } | 271 } |
275 | 272 |
276 GetBreakpadClient()->InstallAdditionalFilters(gBreakpadRef); | 273 GetBreakpadClient()->InstallAdditionalFilters(gBreakpadRef); |
277 | 274 |
278 // Store process type in crash dump. | 275 // Store process type in crash dump. |
279 SetCrashKeyValue(@"ptype", process_type); | 276 SetCrashKeyValue(@"ptype", process_type); |
280 } | 277 } |
281 | 278 |
282 } // namespace breakpad | 279 } // namespace breakpad |
OLD | NEW |