| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "remoting/host/usage_stats_consent.h" | 5 #include "remoting/host/usage_stats_consent.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/stringprintf.h" | 11 #include "base/stringprintf.h" |
| 12 #include "base/win/registry.h" | 12 #include "base/win/registry.h" |
| 13 #include "remoting/host/win/omaha.h" | 13 #include "remoting/host/constants.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 // The following strings are used to construct the registry key names where | 17 // The following strings are used to construct the registry key names where |
| 18 // we record whether the user has consented to crash dump collection. | 18 // we record whether the user has consented to crash dump collection. |
| 19 // the user's consent to collect crash dumps is recorded. | 19 // the user's consent to collect crash dumps is recorded. |
| 20 const wchar_t kOmahaClientStateKeyFormat[] = | 20 const wchar_t kOmahaClientStateKeyFormat[] = |
| 21 L"Software\\Google\\Update\\%ls\\%ls"; | 21 L"Software\\Google\\Update\\%ls\\%ls"; |
| 22 const wchar_t kOmahaClientState[] = L"ClientState"; | 22 const wchar_t kOmahaClientState[] = L"ClientState"; |
| 23 const wchar_t kOmahaClientStateMedium[] = L"ClientStateMedium"; | 23 const wchar_t kOmahaClientStateMedium[] = L"ClientStateMedium"; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 return key.ReadValueDW(kOmahaUsagestatsValue, usagestats_out); | 37 return key.ReadValueDW(kOmahaUsagestatsValue, usagestats_out); |
| 38 } | 38 } |
| 39 | 39 |
| 40 } // namespace | 40 } // namespace |
| 41 | 41 |
| 42 namespace remoting { | 42 namespace remoting { |
| 43 | 43 |
| 44 bool GetUsageStatsConsent(bool* allowed, bool* set_by_policy) { | 44 bool GetUsageStatsConsent(bool* allowed, bool* set_by_policy) { |
| 45 // TODO(alexeypa): report whether the consent is set by policy once | 45 // TODO(alexeypa): report whether the consent is set by pollicy once |
| 46 // supported. | 46 // supported. |
| 47 *set_by_policy = false; | 47 *set_by_policy = false; |
| 48 | 48 |
| 49 // The user's consent to collect crash dumps is recored as the "usagestats" | 49 // The user's consent to collect crash dumps is recored as the "usagestats" |
| 50 // value in the ClientState or ClientStateMedium key. Probe | 50 // value in the ClientState or ClientStateMedium key. Probe |
| 51 // the ClientStateMedium key first. | 51 // the ClientStateMedium key first. |
| 52 DWORD value = 0; | 52 DWORD value = 0; |
| 53 if (ReadUsageStatsValue(kOmahaClientStateMedium, &value) == ERROR_SUCCESS) { | 53 if (ReadUsageStatsValue(kOmahaClientStateMedium, &value) == ERROR_SUCCESS) { |
| 54 *allowed = value != 0; | 54 *allowed = value != 0; |
| 55 return true; | 55 return true; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 85 return true; | 85 return true; |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 | 88 |
| 89 LOG_GETLASTERROR(ERROR) | 89 LOG_GETLASTERROR(ERROR) |
| 90 << "Failed to record the user's consent to crash dump reporting"; | 90 << "Failed to record the user's consent to crash dump reporting"; |
| 91 return false; | 91 return false; |
| 92 } | 92 } |
| 93 | 93 |
| 94 } // namespace remoting | 94 } // namespace remoting |
| OLD | NEW |