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

Unified Diff: remoting/host/policy_hack/policy_watcher_win.cc

Issue 10832071: [Chromoting] Let the Windows host policy watcher read string-valued policies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/policy_hack/policy_watcher_win.cc
diff --git a/remoting/host/policy_hack/policy_watcher_win.cc b/remoting/host/policy_hack/policy_watcher_win.cc
index 9f3b5e4eeb3c583519576840a86ec4394799e297..c429e484dbd9cac96590afb1f72078edc194d3ac 100644
--- a/remoting/host/policy_hack/policy_watcher_win.cc
+++ b/remoting/host/policy_hack/policy_watcher_win.cc
@@ -112,6 +112,25 @@ class PolicyWatcherWin :
}
}
+ bool GetRegistryPolicyString(const string16& value_name,
alexeypa (please no reviews) 2012/07/30 21:27:06 Mixture of string16 and std::string looks strange.
simonmorris 2012/07/30 22:08:17 Done.
+ std::string* result) const {
+ std::wstring value;
+ RegKey policy_key(HKEY_LOCAL_MACHINE, kRegistrySubKey, KEY_READ);
+ if (policy_key.ReadValue(value_name.c_str(), &value) == ERROR_SUCCESS) {
alexeypa (please no reviews) 2012/07/30 21:27:06 It should be UTF16ToWide(value_name).c_str(). I th
simonmorris 2012/07/30 22:08:17 Done.
+ *result = WideToUTF8(value);
+ return true;
+ }
+
+ if (policy_key.Open(HKEY_CURRENT_USER, kRegistrySubKey, KEY_READ) ==
+ ERROR_SUCCESS) {
+ if (policy_key.ReadValue(value_name.c_str(), &value) == ERROR_SUCCESS) {
+ *result = WideToUTF8(value);
+ return true;
+ }
+ }
+ return false;
+ }
+
bool GetRegistryPolicyInteger(const string16& value_name,
uint32* result) const {
DWORD value = 0;
@@ -151,8 +170,14 @@ class PolicyWatcherWin :
policy->SetBoolean(policy_name, bool_value);
}
}
- // TODO(simonmorris): Read policies whose names are in kStringPolicyNames.
-
+ for (int i = 0; i < kStringPolicyNamesNum; ++i) {
+ const char* policy_name = kStringPolicyNames[i];
+ std::string string_value;
+ const string16 name(ASCIIToUTF16(policy_name));
+ if (GetRegistryPolicyString(name, &string_value)) {
alexeypa (please no reviews) 2012/07/30 21:27:06 nit: Why don't pass ASCIIToUTF16(policy_name) dire
simonmorris 2012/07/30 22:08:17 Done.
+ policy->SetString(policy_name, string_value);
+ }
+ }
return policy;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698