Remove EWK_BRINGUPS for M120 #3
[platform/framework/web/chromium-efl.git] / chrome / app / chrome_crash_reporter_client_mac.mm
1 // Copyright 2013 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/app/chrome_crash_reporter_client.h"
6
7 #include <CoreFoundation/CoreFoundation.h>
8
9 #include "base/apple/scoped_cftyperef.h"
10 #include "base/path_service.h"
11 #include "base/rand_util.h"
12 #include "base/strings/sys_string_conversions.h"
13 #include "chrome/common/channel_info.h"
14 #include "chrome/common/chrome_paths.h"
15 #include "components/policy/policy_constants.h"
16 #include "components/version_info/version_info.h"
17
18 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy(
19     bool* breakpad_enabled) {
20   base::apple::ScopedCFTypeRef<CFStringRef> key =
21       base::SysUTF8ToCFStringRef(policy::key::kMetricsReportingEnabled);
22   Boolean key_valid;
23   Boolean metrics_reporting_enabled = CFPreferencesGetAppBooleanValue(key,
24       kCFPreferencesCurrentApplication, &key_valid);
25   if (key_valid &&
26       CFPreferencesAppValueIsForced(key, kCFPreferencesCurrentApplication)) {
27     *breakpad_enabled = metrics_reporting_enabled;
28     return true;
29   }
30   return false;
31 }
32
33 bool ChromeCrashReporterClient::ShouldMonitorCrashHandlerExpensively() {
34   // This mechanism dedicates a process to be crashpad_handler's own
35   // crashpad_handler. In Google Chrome, scale back on this in the more stable
36   // channels. Other builds are of more of a developmental nature, so always
37   // enable the additional crash reporting.
38   double probability;
39   switch (chrome::GetChannel()) {
40     case version_info::Channel::STABLE:
41       probability = 0.01;
42       break;
43
44     case version_info::Channel::BETA:
45       probability = 0.1;
46       break;
47
48     case version_info::Channel::DEV:
49       probability = 0.25;
50       break;
51
52     default:
53       return true;
54   }
55
56   return base::RandDouble() < probability;
57 }