Index: cloud_print/common/win/cloud_print_utils.cc |
diff --git a/cloud_print/common/win/cloud_print_utils.cc b/cloud_print/common/win/cloud_print_utils.cc |
index 5816b64457dcbf2d1f05e50e86ee11b047f07fae..71c9b53e7859a80da5a97fbfa6b128fb4b0eb740 100644 |
--- a/cloud_print/common/win/cloud_print_utils.cc |
+++ b/cloud_print/common/win/cloud_print_utils.cc |
@@ -6,8 +6,18 @@ |
#include <windows.h> |
+#include "base/win/registry.h" |
+ |
namespace cloud_print { |
+namespace { |
+ |
+// Google Update related constants. |
+const wchar_t kClientStateKey[] = L"SOFTWARE\\Google\\Update\\ClientState\\"; |
+const wchar_t* kUsageKey = L"dr"; |
+ |
+} // namespace |
+ |
HRESULT GetLastHResult() { |
DWORD error_code = GetLastError(); |
return error_code ? HRESULT_FROM_WIN32(error_code) : E_FAIL; |
@@ -37,4 +47,15 @@ string16 GetErrorMessage(HRESULT hr) { |
return result; |
} |
+void SetGoogleUpdateUsage(const string16& product_id) { |
+ // Set appropriate key to 1 to let Omaha record usage. |
+ base::win::RegKey key; |
+ if (key.Create(HKEY_CURRENT_USER, |
+ (kClientStateKey + product_id).c_str(), |
+ KEY_SET_VALUE) != ERROR_SUCCESS || |
+ key.WriteValue(kUsageKey, L"1") != ERROR_SUCCESS) { |
+ LOG(ERROR) << "Unable to set usage key"; |
+ } |
+} |
+ |
} // namespace cloud_print |