forked from sanyaade-mobiledev/chromium.src
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchrome_crash_reporter_client_mac.mm
60 lines (49 loc) · 1.87 KB
/
chrome_crash_reporter_client_mac.mm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/app/chrome_crash_reporter_client.h"
#include <CoreFoundation/CoreFoundation.h>
#include "base/mac/scoped_cftyperef.h"
#include "base/strings/sys_string_conversions.h"
#include "policy/policy_constants.h"
#if !defined(DISABLE_NACL)
#include "base/command_line.h"
#import "breakpad/src/client/mac/Framework/Breakpad.h"
#include "chrome/common/chrome_switches.h"
#include "components/nacl/common/nacl_switches.h"
#include "native_client/src/trusted/service_runtime/osx/crash_filter.h"
#endif
namespace chrome {
namespace {
#if !defined(DISABLE_NACL)
bool NaClBreakpadCrashFilter(int exception_type,
int exception_code,
mach_port_t crashing_thread,
void* context) {
return !NaClMachThreadIsInUntrusted(crashing_thread);
}
#endif
} // namespace
void ChromeCrashReporterClient::InstallAdditionalFilters(BreakpadRef breakpad) {
#if !defined(DISABLE_NACL)
if (CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
switches::kProcessType) == switches::kNaClLoaderProcess) {
BreakpadSetFilterCallback(breakpad, NaClBreakpadCrashFilter, NULL);
}
#endif
}
bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy(
bool* breakpad_enabled) {
base::ScopedCFTypeRef<CFStringRef> key(
base::SysUTF8ToCFStringRef(policy::key::kMetricsReportingEnabled));
Boolean key_valid;
Boolean metrics_reporting_enabled = CFPreferencesGetAppBooleanValue(key,
kCFPreferencesCurrentApplication, &key_valid);
if (key_valid &&
CFPreferencesAppValueIsForced(key, kCFPreferencesCurrentApplication)) {
*breakpad_enabled = metrics_reporting_enabled;
return true;
}
return false;
}
} // namespace chrome