| 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 #include "chrome/app/breakpad_win.h" | 5 #include "chrome/app/breakpad_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <shellapi.h> | 8 #include <shellapi.h> |
| 9 #include <tchar.h> | 9 #include <tchar.h> |
| 10 | 10 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 flags, exit_now); | 430 flags, exit_now); |
| 431 } | 431 } |
| 432 | 432 |
| 433 // Determine whether configuration management allows loading the crash reporter. | 433 // Determine whether configuration management allows loading the crash reporter. |
| 434 // Since the configuration management infrastructure is not initialized at this | 434 // Since the configuration management infrastructure is not initialized at this |
| 435 // point, we read the corresponding registry key directly. The return status | 435 // point, we read the corresponding registry key directly. The return status |
| 436 // indicates whether policy data was successfully read. If it is true, |result| | 436 // indicates whether policy data was successfully read. If it is true, |result| |
| 437 // contains the value set by policy. | 437 // contains the value set by policy. |
| 438 static bool MetricsReportingControlledByPolicy(bool* result) { | 438 static bool MetricsReportingControlledByPolicy(bool* result) { |
| 439 std::wstring key_name = UTF8ToWide(policy::key::kMetricsReportingEnabled); | 439 std::wstring key_name = UTF8ToWide(policy::key::kMetricsReportingEnabled); |
| 440 DWORD value; | 440 DWORD value = 0; |
| 441 // TODO(joshia): why hkcu_policy_key opens HKEY_LOCAL_MACHINE? |
| 441 base::win::RegKey hkcu_policy_key(HKEY_LOCAL_MACHINE, | 442 base::win::RegKey hkcu_policy_key(HKEY_LOCAL_MACHINE, |
| 442 policy::kRegistrySubKey, KEY_READ); | 443 policy::kRegistrySubKey, KEY_READ); |
| 443 if (hkcu_policy_key.ReadValueDW(key_name.c_str(), &value)) { | 444 if (hkcu_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) { |
| 444 *result = value != 0; | 445 *result = value != 0; |
| 445 return true; | 446 return true; |
| 446 } | 447 } |
| 447 | 448 |
| 448 base::win::RegKey hklm_policy_key(HKEY_CURRENT_USER, | 449 base::win::RegKey hklm_policy_key(HKEY_CURRENT_USER, |
| 449 policy::kRegistrySubKey, KEY_READ); | 450 policy::kRegistrySubKey, KEY_READ); |
| 450 if (hklm_policy_key.ReadValueDW(key_name.c_str(), &value)) { | 451 if (hklm_policy_key.ReadValueDW(key_name.c_str(), &value) == ERROR_SUCCESS) { |
| 451 *result = value != 0; | 452 *result = value != 0; |
| 452 return true; | 453 return true; |
| 453 } | 454 } |
| 454 | 455 |
| 455 return false; | 456 return false; |
| 456 } | 457 } |
| 457 | 458 |
| 458 static DWORD __stdcall InitCrashReporterThread(void* param) { | 459 static DWORD __stdcall InitCrashReporterThread(void* param) { |
| 459 scoped_ptr<CrashReporterInfo> info( | 460 scoped_ptr<CrashReporterInfo> info( |
| 460 reinterpret_cast<CrashReporterInfo*>(param)); | 461 reinterpret_cast<CrashReporterInfo*>(param)); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 if (QueueUserWorkItem( | 589 if (QueueUserWorkItem( |
| 589 &InitCrashReporterThread, | 590 &InitCrashReporterThread, |
| 590 info, | 591 info, |
| 591 WT_EXECUTELONGFUNCTION) == 0) { | 592 WT_EXECUTELONGFUNCTION) == 0) { |
| 592 // We failed to queue to the worker pool, initialize in this thread. | 593 // We failed to queue to the worker pool, initialize in this thread. |
| 593 InitCrashReporterThread(info); | 594 InitCrashReporterThread(info); |
| 594 } | 595 } |
| 595 } | 596 } |
| 596 } | 597 } |
| 597 } | 598 } |
| OLD | NEW |