Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Side by Side Diff: chrome/app/chrome_breakpad_client.cc

Issue 27031002: Move checking of configured policy on win to breakpad client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/app/chrome_breakpad_client.h ('k') | chrome/app/chrome_breakpad_client_mac.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_breakpad_client.h" 5 #include "chrome/app/chrome_breakpad_client.h"
6 6
7 #include "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 10 matching lines...) Expand all
21 #include "chrome/common/crash_keys.h" 21 #include "chrome/common/crash_keys.h"
22 #include "chrome/common/env_vars.h" 22 #include "chrome/common/env_vars.h"
23 23
24 #if defined(OS_WIN) 24 #if defined(OS_WIN)
25 #include <windows.h> 25 #include <windows.h>
26 26
27 #include "base/file_version_info.h" 27 #include "base/file_version_info.h"
28 #include "base/win/registry.h" 28 #include "base/win/registry.h"
29 #include "chrome/installer/util/google_chrome_sxs_distribution.h" 29 #include "chrome/installer/util/google_chrome_sxs_distribution.h"
30 #include "chrome/installer/util/install_util.h" 30 #include "chrome/installer/util/install_util.h"
31 #include "policy/policy_constants.h"
31 #endif 32 #endif
32 33
33 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) 34 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS)
34 #include "chrome/browser/crash_upload_list.h" 35 #include "chrome/browser/crash_upload_list.h"
35 #include "chrome/common/chrome_version_info_posix.h" 36 #include "chrome/common/chrome_version_info_posix.h"
36 #endif 37 #endif
37 38
38 #if defined(OS_POSIX) 39 #if defined(OS_POSIX)
39 #include "chrome/common/dump_without_crashing.h" 40 #include "chrome/common/dump_without_crashing.h"
40 #endif 41 #endif
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 g_browser_crash_dump_prefix, 251 g_browser_crash_dump_prefix,
251 base::subtle::NoBarrier_AtomicIncrement(&g_browser_crash_dump_count, 1)); 252 base::subtle::NoBarrier_AtomicIncrement(&g_browser_crash_dump_count, 1));
252 253
253 if (length > 0) { 254 if (length > 0) {
254 DWORD value_dword = is_real_crash ? 1 : 0; 255 DWORD value_dword = is_real_crash ? 1 : 0;
255 ::RegSetValueExA(g_browser_crash_dump_regkey, value_name, 0, REG_DWORD, 256 ::RegSetValueExA(g_browser_crash_dump_regkey, value_name, 0, REG_DWORD,
256 reinterpret_cast<BYTE*>(&value_dword), 257 reinterpret_cast<BYTE*>(&value_dword),
257 sizeof(value_dword)); 258 sizeof(value_dword));
258 } 259 }
259 } 260 }
261
262 bool ChromeBreakpadClient::ReportingIsEnforcedByPolicy(bool* breakpad_enabled) {
263 // Determine whether configuration management allows loading the crash reporter.
264 // Since the configuration management infrastructure is not initialized at this
265 // point, we read the corresponding registry key directly. The return status
266 // indicates whether policy data was successfully read. If it is true,
267 // |breakpad_enabled| contains the value set by policy.
268 string16 key_name = UTF8ToUTF16(policy::key::kMetricsReportingEnabled);
269 DWORD value = 0;
270 base::win::RegKey hklm_policy_key(HKEY_LOCAL_MACHINE,
271 policy::kRegistryChromePolicyKey, KEY_READ);
272 if (hklm_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) {
273 *breakpad_enabled = value != 0;
274 return true;
275 }
276
277 base::win::RegKey hkcu_policy_key(HKEY_CURRENT_USER,
278 policy::kRegistryChromePolicyKey, KEY_READ);
279 if (hkcu_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) {
280 *breakpad_enabled = value != 0;
281 return true;
282 }
283
284 return false;
285 }
260 #endif 286 #endif
261 287
262 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS) 288 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_IOS)
263 void ChromeBreakpadClient::GetProductNameAndVersion(std::string* product_name, 289 void ChromeBreakpadClient::GetProductNameAndVersion(std::string* product_name,
264 std::string* version) { 290 std::string* version) {
265 DCHECK(product_name); 291 DCHECK(product_name);
266 DCHECK(version); 292 DCHECK(version);
267 #if defined(OS_ANDROID) 293 #if defined(OS_ANDROID)
268 *product_name = "Chrome_Android"; 294 *product_name = "Chrome_Android";
269 #elif defined(OS_CHROMEOS) 295 #elif defined(OS_CHROMEOS)
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 348 }
323 #endif 349 #endif
324 350
325 #if defined(OS_ANDROID) 351 #if defined(OS_ANDROID)
326 int ChromeBreakpadClient::GetAndroidMinidumpDescriptor() { 352 int ChromeBreakpadClient::GetAndroidMinidumpDescriptor() {
327 return kAndroidMinidumpDescriptor; 353 return kAndroidMinidumpDescriptor;
328 } 354 }
329 #endif 355 #endif
330 356
331 } // namespace chrome 357 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/app/chrome_breakpad_client.h ('k') | chrome/app/chrome_breakpad_client_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698