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

Unified Diff: cloud_print/common/win/cloud_print_utils.cc

Issue 14107007: Moved Google Update and install related code to cloud_print/common (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | « cloud_print/common/win/cloud_print_utils.h ('k') | cloud_print/common/win/install_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « cloud_print/common/win/cloud_print_utils.h ('k') | cloud_print/common/win/install_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698