OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/app/breakpad_mac.h" | 5 #import "chrome/app/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/base_switches.h" | 10 #include "base/base_switches.h" |
11 #import "base/basictypes.h" | 11 #import "base/basictypes.h" |
12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/file_util.h" | 14 #include "base/file_util.h" |
15 #import "base/logging.h" | 15 #import "base/logging.h" |
16 #include "base/mac_util.h" | 16 #include "base/mac_util.h" |
| 17 #include "base/mac/scoped_cftyperef.h" |
17 #include "base/path_service.h" | 18 #include "base/path_service.h" |
18 #include "base/scoped_cftyperef.h" | |
19 #import "base/scoped_nsautorelease_pool.h" | 19 #import "base/scoped_nsautorelease_pool.h" |
20 #include "base/sys_string_conversions.h" | 20 #include "base/sys_string_conversions.h" |
21 #import "breakpad/src/client/mac/Framework/Breakpad.h" | 21 #import "breakpad/src/client/mac/Framework/Breakpad.h" |
22 #include "chrome/common/child_process_logging.h" | 22 #include "chrome/common/child_process_logging.h" |
23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
24 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/env_vars.h" | 25 #include "chrome/common/env_vars.h" |
26 #include "chrome/common/policy_constants.h" | 26 #include "chrome/common/policy_constants.h" |
27 #include "chrome/installer/util/google_update_settings.h" | 27 #include "chrome/installer/util/google_update_settings.h" |
28 | 28 |
(...skipping 27 matching lines...) Expand all Loading... |
56 // the browser process, so the browser passes the decision to them on the | 56 // the browser process, so the browser passes the decision to them on the |
57 // command line. | 57 // command line. |
58 NSBundle* main_bundle = mac_util::MainAppBundle(); | 58 NSBundle* main_bundle = mac_util::MainAppBundle(); |
59 bool is_browser = !mac_util::IsBackgroundOnlyProcess(); | 59 bool is_browser = !mac_util::IsBackgroundOnlyProcess(); |
60 bool enable_breakpad = false; | 60 bool enable_breakpad = false; |
61 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 61 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
62 | 62 |
63 if (is_browser) { | 63 if (is_browser) { |
64 // Since the configuration management infrastructure is possibly not | 64 // Since the configuration management infrastructure is possibly not |
65 // initialized when this code runs, read the policy preference directly. | 65 // initialized when this code runs, read the policy preference directly. |
66 scoped_cftyperef<CFStringRef> key( | 66 base::mac::ScopedCFTypeRef<CFStringRef> key( |
67 base::SysUTF8ToCFStringRef(policy::key::kMetricsReportingEnabled)); | 67 base::SysUTF8ToCFStringRef(policy::key::kMetricsReportingEnabled)); |
68 Boolean key_valid; | 68 Boolean key_valid; |
69 Boolean metrics_reporting_enabled = CFPreferencesGetAppBooleanValue(key, | 69 Boolean metrics_reporting_enabled = CFPreferencesGetAppBooleanValue(key, |
70 kCFPreferencesCurrentApplication, &key_valid); | 70 kCFPreferencesCurrentApplication, &key_valid); |
71 if (key_valid && | 71 if (key_valid && |
72 CFPreferencesAppValueIsForced(key, kCFPreferencesCurrentApplication)) { | 72 CFPreferencesAppValueIsForced(key, kCFPreferencesCurrentApplication)) { |
73 // Controlled by configuration manangement. | 73 // Controlled by configuration manangement. |
74 enable_breakpad = metrics_reporting_enabled; | 74 enable_breakpad = metrics_reporting_enabled; |
75 } else { | 75 } else { |
76 // Controlled by the user. The crash reporter may be enabled by | 76 // Controlled by the user. The crash reporter may be enabled by |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 BreakpadAddUploadParameter(gBreakpadRef, key, value); | 196 BreakpadAddUploadParameter(gBreakpadRef, key, value); |
197 } | 197 } |
198 | 198 |
199 void ClearCrashKeyValue(NSString* key) { | 199 void ClearCrashKeyValue(NSString* key) { |
200 if (gBreakpadRef == NULL) { | 200 if (gBreakpadRef == NULL) { |
201 return; | 201 return; |
202 } | 202 } |
203 | 203 |
204 BreakpadRemoveUploadParameter(gBreakpadRef, key); | 204 BreakpadRemoveUploadParameter(gBreakpadRef, key); |
205 } | 205 } |
OLD | NEW |