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; |
} |