summaryrefslogtreecommitdiffstats
path: root/chrome/browser/configuration_policy_provider_win.cc
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-02 13:51:11 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-02 13:51:11 +0000
commit1505fa2d80afe698db06150512b26c2d08d0e088 (patch)
treeec21823c3ab6ef62b4915df86a2ad719f207c3ae /chrome/browser/configuration_policy_provider_win.cc
parent0b68f1572eb3d1e75ee60c3d1e025aa6b7f06045 (diff)
downloadchromium_src-1505fa2d80afe698db06150512b26c2d08d0e088.zip
chromium_src-1505fa2d80afe698db06150512b26c2d08d0e088.tar.gz
chromium_src-1505fa2d80afe698db06150512b26c2d08d0e088.tar.bz2
Reduce duplication across Linux/Windows policy providers, and unify names used therein.
BUG=http://crbug.com/45344 TEST=no change Review URL: http://codereview.chromium.org/2387003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48716 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/configuration_policy_provider_win.cc')
-rwxr-xr-xchrome/browser/configuration_policy_provider_win.cc39
1 files changed, 9 insertions, 30 deletions
diff --git a/chrome/browser/configuration_policy_provider_win.cc b/chrome/browser/configuration_policy_provider_win.cc
index f81758f6..420ff36 100755
--- a/chrome/browser/configuration_policy_provider_win.cc
+++ b/chrome/browser/configuration_policy_provider_win.cc
@@ -9,16 +9,11 @@
#include "base/logging.h"
#include "base/registry.h"
#include "base/scoped_ptr.h"
+#include "base/string_piece.h"
#include "base/sys_string_conversions.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
-const wchar_t ConfigurationPolicyProviderWin::kHomepageRegistryValueName[] =
- L"Homepage";
-const wchar_t ConfigurationPolicyProviderWin::
- kHomepageIsNewTabPageRegistryValueName[] = L"HomepageIsNewTabPage";
-const wchar_t ConfigurationPolicyProviderWin::kCookiesModeRegistryValueName[] =
- L"CookiesMode";
-
#if defined(GOOGLE_CHROME_BUILD)
const wchar_t ConfigurationPolicyProviderWin::kPolicyRegistrySubKey[] =
L"SOFTWARE\\Policies\\Google\\Google Chrome";
@@ -101,48 +96,32 @@ bool ConfigurationPolicyProviderWin::GetRegistryPolicyInteger(
return false;
}
-const ConfigurationPolicyProviderWin::RegistryPolicyMapEntry
- ConfigurationPolicyProviderWin::registry_to_policy_map_[] = {
- { Value::TYPE_STRING,
- ConfigurationPolicyStore::kPolicyHomePage,
- kHomepageRegistryValueName },
- { Value::TYPE_BOOLEAN,
- ConfigurationPolicyStore::kPolicyHomepageIsNewTabPage,
- kHomepageIsNewTabPageRegistryValueName },
- { Value::TYPE_INTEGER,
- ConfigurationPolicyStore::kPolicyCookiesMode,
- kCookiesModeRegistryValueName },
-};
-
bool ConfigurationPolicyProviderWin::Provide(
ConfigurationPolicyStore* store) {
- const RegistryPolicyMapEntry* current;
- const RegistryPolicyMapEntry* end = registry_to_policy_map_ +
- arraysize(registry_to_policy_map_);
+ const PolicyValueMap* mapping = PolicyValueMapping();
- for (current = registry_to_policy_map_; current != end; ++current) {
+ for (PolicyValueMap::const_iterator current = mapping->begin();
+ current != mapping->end(); ++current) {
+ std::wstring name = UTF8ToWide(current->name);
std::wstring string_value;
uint32 int_value;
bool bool_value;
switch (current->value_type) {
case Value::TYPE_STRING:
- if (GetRegistryPolicyString(current->registry_value_name,
- &string_value)) {
+ if (GetRegistryPolicyString(name.c_str(), &string_value)) {
store->Apply(
current->policy_type,
Value::CreateStringValueFromUTF16(string_value));
}
break;
case Value::TYPE_BOOLEAN:
- if (GetRegistryPolicyBoolean(current->registry_value_name,
- &bool_value)) {
+ if (GetRegistryPolicyBoolean(name.c_str(), &bool_value)) {
store->Apply(current->policy_type,
Value::CreateBooleanValue(bool_value));
}
break;
case Value::TYPE_INTEGER:
- if (GetRegistryPolicyInteger(current->registry_value_name,
- &int_value)) {
+ if (GetRegistryPolicyInteger(name.c_str(), &int_value)) {
store->Apply(current->policy_type,
Value::CreateIntegerValue(int_value));
}