Updating XTBs based on .GRDs from branch master
[chromium-blink-merge.git] / chrome / app / chrome_crash_reporter_client_mac.mm
blobb4e741942968c964fa6c354146b83a47bf11dd2c
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
3 // found in the LICENSE file.
5 #include "chrome/app/chrome_crash_reporter_client.h"
7 #include <CoreFoundation/CoreFoundation.h>
9 #include "base/mac/scoped_cftyperef.h"
10 #include "base/strings/sys_string_conversions.h"
11 #include "policy/policy_constants.h"
13 #if !defined(DISABLE_NACL)
14 #include "base/command_line.h"
15 #include "chrome/common/chrome_switches.h"
16 #include "components/nacl/common/nacl_switches.h"
17 #include "native_client/src/trusted/service_runtime/osx/crash_filter.h"
18 #endif
20 namespace chrome {
22 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy(
23     bool* breakpad_enabled) {
24   base::ScopedCFTypeRef<CFStringRef> key(
25       base::SysUTF8ToCFStringRef(policy::key::kMetricsReportingEnabled));
26   Boolean key_valid;
27   Boolean metrics_reporting_enabled = CFPreferencesGetAppBooleanValue(key,
28       kCFPreferencesCurrentApplication, &key_valid);
29   if (key_valid &&
30       CFPreferencesAppValueIsForced(key, kCFPreferencesCurrentApplication)) {
31     *breakpad_enabled = metrics_reporting_enabled;
32     return true;
33   }
34   return false;
37 }  // namespace chrome