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

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

Issue 6090006: Regkey functions return error code instead of bool (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698