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" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 DWORD value = 0; | 51 DWORD value = 0; |
52 if (ReadUsageStatsValue(kOmahaClientStateMedium, &value) == ERROR_SUCCESS) { | 52 if (ReadUsageStatsValue(kOmahaClientStateMedium, &value) == ERROR_SUCCESS) { |
53 *allowed = value != 0; | 53 *allowed = value != 0; |
54 return true; | 54 return true; |
55 } | 55 } |
56 if (ReadUsageStatsValue(kOmahaClientState, &value) == ERROR_SUCCESS) { | 56 if (ReadUsageStatsValue(kOmahaClientState, &value) == ERROR_SUCCESS) { |
57 *allowed = value != 0; | 57 *allowed = value != 0; |
58 return true; | 58 return true; |
59 } | 59 } |
60 | 60 |
61 LOG_GETLASTERROR(ERROR) | 61 // We do not log the error code here because the logging hasn't been |
62 << "Failed to record the user's consent to crash dump reporting"; | 62 // initialized yet. |
63 return false; | 63 return false; |
64 } | 64 } |
65 | 65 |
66 bool IsUsageStatsAllowed() { | 66 bool IsUsageStatsAllowed() { |
67 bool allowed; | 67 bool allowed; |
68 bool set_by_policy; | 68 bool set_by_policy; |
69 return GetUsageStatsConsent(&allowed, &set_by_policy) && allowed; | 69 return GetUsageStatsConsent(&allowed, &set_by_policy) && allowed; |
70 } | 70 } |
71 | 71 |
72 bool SetUsageStatsConsent(bool allowed) { | 72 bool SetUsageStatsConsent(bool allowed) { |
(...skipping 10 matching lines...) Expand all Loading... |
83 return true; | 83 return true; |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 LOG_GETLASTERROR(ERROR) | 87 LOG_GETLASTERROR(ERROR) |
88 << "Failed to record the user's consent to crash dump reporting"; | 88 << "Failed to record the user's consent to crash dump reporting"; |
89 return false; | 89 return false; |
90 } | 90 } |
91 | 91 |
92 } // namespace remoting | 92 } // namespace remoting |
OLD | NEW |