| 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 #include "chrome/app/chrome_crash_reporter_client.h" |   5 #include "chrome/app/chrome_crash_reporter_client.h" | 
|   6  |   6  | 
|   7 #include <CoreFoundation/CoreFoundation.h> |   7 #include <CoreFoundation/CoreFoundation.h> | 
|   8  |   8  | 
|   9 #include "base/mac/scoped_cftyperef.h" |   9 #include "base/mac/scoped_cftyperef.h" | 
|  10 #include "base/strings/sys_string_conversions.h" |  10 #include "base/strings/sys_string_conversions.h" | 
|  11 #include "policy/policy_constants.h" |  11 #include "policy/policy_constants.h" | 
|  12  |  12  | 
|  13 #if !defined(DISABLE_NACL) |  13 #if !defined(DISABLE_NACL) | 
|  14 #include "base/command_line.h" |  14 #include "base/command_line.h" | 
|  15 #import "breakpad/src/client/mac/Framework/Breakpad.h" |  | 
|  16 #include "chrome/common/chrome_switches.h" |  15 #include "chrome/common/chrome_switches.h" | 
|  17 #include "components/nacl/common/nacl_switches.h" |  16 #include "components/nacl/common/nacl_switches.h" | 
|  18 #include "native_client/src/trusted/service_runtime/osx/crash_filter.h" |  17 #include "native_client/src/trusted/service_runtime/osx/crash_filter.h" | 
|  19 #endif |  18 #endif | 
|  20  |  19  | 
|  21 namespace chrome { |  20 namespace chrome { | 
|  22  |  21  | 
|  23 namespace { |  | 
|  24  |  | 
|  25 #if !defined(DISABLE_NACL) |  | 
|  26 bool NaClBreakpadCrashFilter(int exception_type, |  | 
|  27                              int exception_code, |  | 
|  28                              mach_port_t crashing_thread, |  | 
|  29                              void* context) { |  | 
|  30   return !NaClMachThreadIsInUntrusted(crashing_thread); |  | 
|  31 } |  | 
|  32 #endif |  | 
|  33  |  | 
|  34 }  // namespace |  | 
|  35  |  | 
|  36 void ChromeCrashReporterClient::InstallAdditionalFilters(BreakpadRef breakpad) { |  | 
|  37 #if !defined(DISABLE_NACL) |  | 
|  38   if (base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |  | 
|  39           switches::kProcessType) == switches::kNaClLoaderProcess) { |  | 
|  40     BreakpadSetFilterCallback(breakpad, NaClBreakpadCrashFilter, NULL); |  | 
|  41   } |  | 
|  42 #endif |  | 
|  43 } |  | 
|  44  |  | 
|  45 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( |  22 bool ChromeCrashReporterClient::ReportingIsEnforcedByPolicy( | 
|  46     bool* breakpad_enabled) { |  23     bool* breakpad_enabled) { | 
|  47   base::ScopedCFTypeRef<CFStringRef> key( |  24   base::ScopedCFTypeRef<CFStringRef> key( | 
|  48       base::SysUTF8ToCFStringRef(policy::key::kMetricsReportingEnabled)); |  25       base::SysUTF8ToCFStringRef(policy::key::kMetricsReportingEnabled)); | 
|  49   Boolean key_valid; |  26   Boolean key_valid; | 
|  50   Boolean metrics_reporting_enabled = CFPreferencesGetAppBooleanValue(key, |  27   Boolean metrics_reporting_enabled = CFPreferencesGetAppBooleanValue(key, | 
|  51       kCFPreferencesCurrentApplication, &key_valid); |  28       kCFPreferencesCurrentApplication, &key_valid); | 
|  52   if (key_valid && |  29   if (key_valid && | 
|  53       CFPreferencesAppValueIsForced(key, kCFPreferencesCurrentApplication)) { |  30       CFPreferencesAppValueIsForced(key, kCFPreferencesCurrentApplication)) { | 
|  54     *breakpad_enabled = metrics_reporting_enabled; |  31     *breakpad_enabled = metrics_reporting_enabled; | 
|  55     return true; |  32     return true; | 
|  56   } |  33   } | 
|  57   return false; |  34   return false; | 
|  58 } |  35 } | 
|  59  |  36  | 
|  60 }  // namespace chrome |  37 }  // namespace chrome | 
| OLD | NEW |