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

Unified Diff: remoting/host/breakpad_win.cc

Issue 10495003: Make Chromoting Host report crashes to Breakpad (Windows only). The user must enable crash dumps co… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing DEPS and rebased. Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/breakpad.h ('k') | remoting/host/constants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/breakpad_win.cc
diff --git a/remoting/host/breakpad_win.cc b/remoting/host/breakpad_win.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a2623ebb2614eec801d391bc62019a54a9bf7ab8
--- /dev/null
+++ b/remoting/host/breakpad_win.cc
@@ -0,0 +1,60 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "remoting/host/breakpad.h"
+
+#include <windows.h>
+
+#include "base/string16.h"
+#include "base/stringprintf.h"
+#include "base/win/registry.h"
+#include "remoting/host/constants.h"
+
+namespace {
+
+// The following strings are used to construct the registry key names where
+// the user's consent to collect crash dumps is recorded.
+const wchar_t kOmahaClientStateKeyFormat[] = L"Google\\Update\\%ls\\%ls";
+const wchar_t kOmahaClientState[] = L"ClientState";
+const wchar_t kOmahaClientStateMedium[] = L"ClientStateMedium";
+const wchar_t kOmahaUsagestatsValue[] = L"usagestats";
+
+} // namespace
+
+namespace remoting {
+
+bool IsCrashReportingEnabled() {
+ // The user's consent to collect crash dumps is recored as the "usagestats"
+ // value in the ClientState or ClientStateMedium key. Probe
+ // the ClientStateMedium key first.
+ string16 client_state = StringPrintf(kOmahaClientStateKeyFormat,
+ kOmahaClientStateMedium,
+ remoting::kHostOmahaAppid);
+ base::win::RegKey key;
+ LONG result = key.Open(HKEY_LOCAL_MACHINE, client_state.c_str(), KEY_READ);
+ if (result == ERROR_SUCCESS) {
+ DWORD value = 0;
+ result = key.ReadValueDW(kOmahaUsagestatsValue, &value);
+ if (result == ERROR_SUCCESS) {
+ return value != 0;
+ }
+ }
+
+ client_state = StringPrintf(kOmahaClientStateKeyFormat,
+ kOmahaClientState,
+ remoting::kHostOmahaAppid);
+ result = key.Open(HKEY_LOCAL_MACHINE, client_state.c_str(), KEY_READ);
+ if (result == ERROR_SUCCESS) {
+ DWORD value = 0;
+ result = key.ReadValueDW(kOmahaUsagestatsValue, &value);
+ if (result == ERROR_SUCCESS) {
+ return value != 0;
+ }
+ }
+
+ // Do not collect anything unless the user has explicitly allowed it.
+ return false;
+}
+
+} // namespace remoting
« no previous file with comments | « remoting/host/breakpad.h ('k') | remoting/host/constants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698