Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/policy/configuration_policy_handler.h" | 5 #include "chrome/browser/policy/configuration_policy_handler.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 63 struct ProxyModeValidationEntry { | 63 struct ProxyModeValidationEntry { |
| 64 const char* mode_value; | 64 const char* mode_value; |
| 65 bool pac_url_allowed; | 65 bool pac_url_allowed; |
| 66 bool bypass_list_allowed; | 66 bool bypass_list_allowed; |
| 67 bool server_allowed; | 67 bool server_allowed; |
| 68 int error_message_id; | 68 int error_message_id; |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 // Maps a policy type to a preference path, and to the expected value type. | 71 // Maps a policy type to a preference path, and to the expected value type. |
| 72 struct DefaultSearchSimplePolicyHandlerEntry { | 72 struct DefaultSearchSimplePolicyHandlerEntry { |
| 73 const char* policy_name; | |
| 74 const char* preference_path; | |
|
Mattias Nissler (ping if slow)
2012/01/17 09:52:45
I see several random declaration order changes. An
Joao da Silva
2012/01/17 13:09:29
Personal preference :-)
| |
| 73 base::Value::Type value_type; | 75 base::Value::Type value_type; |
| 74 ConfigurationPolicyType policy_type; | |
| 75 const char* preference_path; | |
| 76 }; | 76 }; |
| 77 | 77 |
| 78 | 78 |
| 79 // Static data ----------------------------------------------------------------- | 79 // Static data ----------------------------------------------------------------- |
| 80 | 80 |
| 81 // List of policy types to preference names, for policies affecting the default | 81 // List of policy types to preference names, for policies affecting the default |
| 82 // search provider. | 82 // search provider. |
| 83 const DefaultSearchSimplePolicyHandlerEntry kDefaultSearchPolicyMap[] = { | 83 const DefaultSearchSimplePolicyHandlerEntry kDefaultSearchPolicyMap[] = { |
| 84 { Value::TYPE_BOOLEAN, kPolicyDefaultSearchProviderEnabled, | 84 { key::kDefaultSearchProviderEnabled, |
| 85 prefs::kDefaultSearchProviderEnabled }, | 85 prefs::kDefaultSearchProviderEnabled, |
| 86 { Value::TYPE_STRING, kPolicyDefaultSearchProviderName, | 86 Value::TYPE_BOOLEAN }, |
| 87 prefs::kDefaultSearchProviderName }, | 87 { key::kDefaultSearchProviderName, |
| 88 { Value::TYPE_STRING, kPolicyDefaultSearchProviderKeyword, | 88 prefs::kDefaultSearchProviderName, |
| 89 prefs::kDefaultSearchProviderKeyword }, | 89 Value::TYPE_STRING }, |
| 90 { Value::TYPE_STRING, kPolicyDefaultSearchProviderSearchURL, | 90 { key::kDefaultSearchProviderKeyword, |
| 91 prefs::kDefaultSearchProviderSearchURL }, | 91 prefs::kDefaultSearchProviderKeyword, |
| 92 { Value::TYPE_STRING, kPolicyDefaultSearchProviderSuggestURL, | 92 Value::TYPE_STRING }, |
| 93 prefs::kDefaultSearchProviderSuggestURL }, | 93 { key::kDefaultSearchProviderSearchURL, |
| 94 { Value::TYPE_STRING, kPolicyDefaultSearchProviderInstantURL, | 94 prefs::kDefaultSearchProviderSearchURL, |
| 95 prefs::kDefaultSearchProviderInstantURL }, | 95 Value::TYPE_STRING }, |
| 96 { Value::TYPE_STRING, kPolicyDefaultSearchProviderIconURL, | 96 { key::kDefaultSearchProviderSuggestURL, |
| 97 prefs::kDefaultSearchProviderIconURL }, | 97 prefs::kDefaultSearchProviderSuggestURL, |
| 98 { Value::TYPE_LIST, kPolicyDefaultSearchProviderEncodings, | 98 Value::TYPE_STRING }, |
| 99 prefs::kDefaultSearchProviderEncodings }, | 99 { key::kDefaultSearchProviderInstantURL, |
| 100 prefs::kDefaultSearchProviderInstantURL, | |
| 101 Value::TYPE_STRING }, | |
| 102 { key::kDefaultSearchProviderIconURL, | |
| 103 prefs::kDefaultSearchProviderIconURL, | |
| 104 Value::TYPE_STRING }, | |
| 105 { key::kDefaultSearchProviderEncodings, | |
| 106 prefs::kDefaultSearchProviderEncodings, | |
| 107 Value::TYPE_LIST }, | |
| 100 }; | 108 }; |
| 101 | 109 |
| 102 // List of entries determining which proxy policies can be specified, depending | 110 // List of entries determining which proxy policies can be specified, depending |
| 103 // on the ProxyMode. | 111 // on the ProxyMode. |
| 104 const ProxyModeValidationEntry kProxyModeValidationMap[] = { | 112 const ProxyModeValidationEntry kProxyModeValidationMap[] = { |
| 105 { ProxyPrefs::kDirectProxyModeName, | 113 { ProxyPrefs::kDirectProxyModeName, |
| 106 false, false, false, IDS_POLICY_PROXY_MODE_DISABLED_ERROR }, | 114 false, false, false, IDS_POLICY_PROXY_MODE_DISABLED_ERROR }, |
| 107 { ProxyPrefs::kAutoDetectProxyModeName, | 115 { ProxyPrefs::kAutoDetectProxyModeName, |
| 108 false, false, false, IDS_POLICY_PROXY_MODE_AUTO_DETECT_ERROR }, | 116 false, false, false, IDS_POLICY_PROXY_MODE_AUTO_DETECT_ERROR }, |
| 109 { ProxyPrefs::kPacScriptProxyModeName, | 117 { ProxyPrefs::kPacScriptProxyModeName, |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 | 151 |
| 144 ConfigurationPolicyHandler::~ConfigurationPolicyHandler() { | 152 ConfigurationPolicyHandler::~ConfigurationPolicyHandler() { |
| 145 } | 153 } |
| 146 | 154 |
| 147 void ConfigurationPolicyHandler::PrepareForDisplaying( | 155 void ConfigurationPolicyHandler::PrepareForDisplaying( |
| 148 PolicyMap* policies) const { | 156 PolicyMap* policies) const { |
| 149 // jstemplate can't render DictionaryValues/objects. Convert those values to | 157 // jstemplate can't render DictionaryValues/objects. Convert those values to |
| 150 // a string representation. | 158 // a string representation. |
| 151 for (PolicyMap::const_iterator it = policies->begin(); | 159 for (PolicyMap::const_iterator it = policies->begin(); |
| 152 it != policies->end(); ++it) { | 160 it != policies->end(); ++it) { |
| 161 const PolicyMap::Entry& entry = it->second; | |
| 153 DictionaryValue* value; | 162 DictionaryValue* value; |
| 154 if (it->second->GetAsDictionary(&value)) { | 163 if (entry.value->GetAsDictionary(&value)) { |
| 155 std::string json_string; | 164 std::string json_string; |
| 156 base::JSONWriter::WriteWithOptions( | 165 base::JSONWriter::WriteWithOptions( |
| 157 value, true, base::JSONWriter::OPTIONS_DO_NOT_ESCAPE, &json_string); | 166 value, true, base::JSONWriter::OPTIONS_DO_NOT_ESCAPE, &json_string); |
| 158 policies->Set(it->first, Value::CreateStringValue(json_string)); | 167 StringValue* string_value = Value::CreateStringValue(json_string); |
| 168 policies->Set(it->first, entry.level, entry.scope, string_value); | |
| 159 } | 169 } |
| 160 } | 170 } |
| 161 } | 171 } |
| 162 | 172 |
| 163 | 173 |
| 164 // TypeCheckingPolicyHandler implementation ------------------------------------ | 174 // TypeCheckingPolicyHandler implementation ------------------------------------ |
| 165 | 175 |
| 166 TypeCheckingPolicyHandler::TypeCheckingPolicyHandler( | 176 TypeCheckingPolicyHandler::TypeCheckingPolicyHandler( |
| 167 ConfigurationPolicyType policy_type, | 177 const char* policy_name, |
| 168 Value::Type value_type) | 178 Value::Type value_type) |
| 169 : policy_type_(policy_type), | 179 : policy_name_(policy_name), |
| 170 value_type_(value_type) { | 180 value_type_(value_type) { |
| 171 } | 181 } |
| 172 | 182 |
| 173 TypeCheckingPolicyHandler::~TypeCheckingPolicyHandler() { | 183 TypeCheckingPolicyHandler::~TypeCheckingPolicyHandler() { |
| 174 } | 184 } |
| 175 | 185 |
| 176 ConfigurationPolicyType TypeCheckingPolicyHandler::policy_type() const { | 186 const char* TypeCheckingPolicyHandler::policy_name() const { |
| 177 return policy_type_; | 187 return policy_name_; |
| 178 } | 188 } |
| 179 | 189 |
| 180 bool TypeCheckingPolicyHandler::CheckPolicySettings(const PolicyMap& policies, | 190 bool TypeCheckingPolicyHandler::CheckPolicySettings(const PolicyMap& policies, |
| 181 PolicyErrorMap* errors) { | 191 PolicyErrorMap* errors) { |
| 182 const Value* value = NULL; | 192 const Value* value = NULL; |
| 183 return CheckAndGetValue(policies, errors, &value); | 193 return CheckAndGetValue(policies, errors, &value); |
| 184 } | 194 } |
| 185 | 195 |
| 186 bool TypeCheckingPolicyHandler::CheckAndGetValue(const PolicyMap& policies, | 196 bool TypeCheckingPolicyHandler::CheckAndGetValue(const PolicyMap& policies, |
| 187 PolicyErrorMap* errors, | 197 PolicyErrorMap* errors, |
| 188 const Value** value) { | 198 const Value** value) { |
| 189 *value = policies.Get(policy_type_); | 199 *value = policies.GetValue(policy_name_); |
| 190 if (*value && !(*value)->IsType(value_type_)) { | 200 if (*value && !(*value)->IsType(value_type_)) { |
| 191 errors->AddError(policy_type_, | 201 errors->AddError(policy_name_, |
| 192 IDS_POLICY_TYPE_ERROR, | 202 IDS_POLICY_TYPE_ERROR, |
| 193 ValueTypeToString(value_type_)); | 203 ValueTypeToString(value_type_)); |
| 194 return false; | 204 return false; |
| 195 } | 205 } |
| 196 return true; | 206 return true; |
| 197 } | 207 } |
| 198 | 208 |
| 199 // SimplePolicyHandler implementation ------------------------------------------ | 209 // SimplePolicyHandler implementation ------------------------------------------ |
| 200 | 210 |
| 201 SimplePolicyHandler::SimplePolicyHandler( | 211 SimplePolicyHandler::SimplePolicyHandler( |
| 202 ConfigurationPolicyType policy_type, | 212 const char* policy_name, |
| 203 Value::Type value_type, | 213 const char* pref_path, |
| 204 const char* pref_path) | 214 Value::Type value_type) |
| 205 : TypeCheckingPolicyHandler(policy_type, value_type), | 215 : TypeCheckingPolicyHandler(policy_name, value_type), |
| 206 pref_path_(pref_path) { | 216 pref_path_(pref_path) { |
| 207 } | 217 } |
| 208 | 218 |
| 209 SimplePolicyHandler::~SimplePolicyHandler() { | 219 SimplePolicyHandler::~SimplePolicyHandler() { |
| 210 } | 220 } |
| 211 | 221 |
| 212 void SimplePolicyHandler::ApplyPolicySettings(const PolicyMap& policies, | 222 void SimplePolicyHandler::ApplyPolicySettings(const PolicyMap& policies, |
| 213 PrefValueMap* prefs) { | 223 PrefValueMap* prefs) { |
| 214 const Value* value = policies.Get(policy_type()); | 224 const Value* value = policies.GetValue(policy_name()); |
| 215 if (value) | 225 if (value) |
| 216 prefs->SetValue(pref_path_, value->DeepCopy()); | 226 prefs->SetValue(pref_path_, value->DeepCopy()); |
| 217 } | 227 } |
| 218 | 228 |
| 219 | 229 |
| 220 // SyncPolicyHandler implementation -------------------------------------------- | 230 // SyncPolicyHandler implementation -------------------------------------------- |
| 221 | 231 |
| 222 SyncPolicyHandler::SyncPolicyHandler() | 232 SyncPolicyHandler::SyncPolicyHandler() |
| 223 : TypeCheckingPolicyHandler(kPolicySyncDisabled, | 233 : TypeCheckingPolicyHandler(key::kSyncDisabled, |
| 224 Value::TYPE_BOOLEAN) { | 234 Value::TYPE_BOOLEAN) { |
| 225 } | 235 } |
| 226 | 236 |
| 227 SyncPolicyHandler::~SyncPolicyHandler() { | 237 SyncPolicyHandler::~SyncPolicyHandler() { |
| 228 } | 238 } |
| 229 | 239 |
| 230 void SyncPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, | 240 void SyncPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, |
| 231 PrefValueMap* prefs) { | 241 PrefValueMap* prefs) { |
| 232 const Value* value = policies.Get(policy_type()); | 242 const Value* value = policies.GetValue(policy_name()); |
| 233 bool disable_sync; | 243 bool disable_sync; |
| 234 if (value && value->GetAsBoolean(&disable_sync) && disable_sync) | 244 if (value && value->GetAsBoolean(&disable_sync) && disable_sync) |
| 235 prefs->SetValue(prefs::kSyncManaged, value->DeepCopy()); | 245 prefs->SetValue(prefs::kSyncManaged, value->DeepCopy()); |
| 236 } | 246 } |
| 237 | 247 |
| 238 | 248 |
| 239 // AutofillPolicyHandler implementation ---------------------------------------- | 249 // AutofillPolicyHandler implementation ---------------------------------------- |
| 240 | 250 |
| 241 AutofillPolicyHandler::AutofillPolicyHandler() | 251 AutofillPolicyHandler::AutofillPolicyHandler() |
| 242 : TypeCheckingPolicyHandler(kPolicyAutoFillEnabled, | 252 : TypeCheckingPolicyHandler(key::kAutoFillEnabled, |
| 243 Value::TYPE_BOOLEAN) { | 253 Value::TYPE_BOOLEAN) { |
| 244 } | 254 } |
| 245 | 255 |
| 246 AutofillPolicyHandler::~AutofillPolicyHandler() { | 256 AutofillPolicyHandler::~AutofillPolicyHandler() { |
| 247 } | 257 } |
| 248 | 258 |
| 249 void AutofillPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, | 259 void AutofillPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, |
| 250 PrefValueMap* prefs) { | 260 PrefValueMap* prefs) { |
| 251 const Value* value = policies.Get(policy_type()); | 261 const Value* value = policies.GetValue(policy_name()); |
| 252 bool auto_fill_enabled; | 262 bool auto_fill_enabled; |
| 253 if (value && value->GetAsBoolean(&auto_fill_enabled) && !auto_fill_enabled) { | 263 if (value && value->GetAsBoolean(&auto_fill_enabled) && !auto_fill_enabled) { |
| 254 prefs->SetValue(prefs::kAutofillEnabled, | 264 prefs->SetValue(prefs::kAutofillEnabled, |
| 255 Value::CreateBooleanValue(false)); | 265 Value::CreateBooleanValue(false)); |
| 256 } | 266 } |
| 257 } | 267 } |
| 258 | 268 |
| 259 | 269 |
| 260 // DownloadDirPolicyHandler implementation ------------------------------------- | 270 // DownloadDirPolicyHandler implementation ------------------------------------- |
| 261 | 271 |
| 262 DownloadDirPolicyHandler::DownloadDirPolicyHandler() | 272 DownloadDirPolicyHandler::DownloadDirPolicyHandler() |
| 263 : TypeCheckingPolicyHandler(kPolicyDownloadDirectory, | 273 : TypeCheckingPolicyHandler(key::kDownloadDirectory, |
| 264 Value::TYPE_STRING) { | 274 Value::TYPE_STRING) { |
| 265 } | 275 } |
| 266 | 276 |
| 267 DownloadDirPolicyHandler::~DownloadDirPolicyHandler() { | 277 DownloadDirPolicyHandler::~DownloadDirPolicyHandler() { |
| 268 } | 278 } |
| 269 | 279 |
| 270 void DownloadDirPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, | 280 void DownloadDirPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, |
| 271 PrefValueMap* prefs) { | 281 PrefValueMap* prefs) { |
| 272 const Value* value = policies.Get(policy_type()); | 282 const Value* value = policies.GetValue(policy_name()); |
| 273 FilePath::StringType string_value; | 283 FilePath::StringType string_value; |
| 274 if (!value || !value->GetAsString(&string_value)) | 284 if (!value || !value->GetAsString(&string_value)) |
| 275 return; | 285 return; |
| 276 | 286 |
| 277 FilePath::StringType expanded_value = | 287 FilePath::StringType expanded_value = |
| 278 policy::path_parser::ExpandPathVariables(string_value); | 288 policy::path_parser::ExpandPathVariables(string_value); |
| 279 // Make sure the path isn't empty, since that will point to an undefined | 289 // Make sure the path isn't empty, since that will point to an undefined |
| 280 // location; the default location is used instead in that case. | 290 // location; the default location is used instead in that case. |
| 281 // This is checked after path expansion because a non-empty policy value can | 291 // This is checked after path expansion because a non-empty policy value can |
| 282 // lead to an empty path value after expansion (e.g. "\"\""). | 292 // lead to an empty path value after expansion (e.g. "\"\""). |
| 283 if (expanded_value.empty()) | 293 if (expanded_value.empty()) |
| 284 expanded_value = download_util::GetDefaultDownloadDirectory().value(); | 294 expanded_value = download_util::GetDefaultDownloadDirectory().value(); |
| 285 prefs->SetValue(prefs::kDownloadDefaultDirectory, | 295 prefs->SetValue(prefs::kDownloadDefaultDirectory, |
| 286 Value::CreateStringValue(expanded_value)); | 296 Value::CreateStringValue(expanded_value)); |
| 287 prefs->SetValue(prefs::kPromptForDownload, | 297 prefs->SetValue(prefs::kPromptForDownload, |
| 288 Value::CreateBooleanValue(false)); | 298 Value::CreateBooleanValue(false)); |
| 289 } | 299 } |
| 290 | 300 |
| 291 | 301 |
| 292 // DiskCacheDirPolicyHandler implementation ------------------------------------ | 302 // DiskCacheDirPolicyHandler implementation ------------------------------------ |
| 293 | 303 |
| 294 DiskCacheDirPolicyHandler::DiskCacheDirPolicyHandler() | 304 DiskCacheDirPolicyHandler::DiskCacheDirPolicyHandler() |
| 295 : TypeCheckingPolicyHandler(kPolicyDiskCacheDir, | 305 : TypeCheckingPolicyHandler(key::kDiskCacheDir, |
| 296 Value::TYPE_STRING) { | 306 Value::TYPE_STRING) { |
| 297 } | 307 } |
| 298 | 308 |
| 299 DiskCacheDirPolicyHandler::~DiskCacheDirPolicyHandler() { | 309 DiskCacheDirPolicyHandler::~DiskCacheDirPolicyHandler() { |
| 300 } | 310 } |
| 301 | 311 |
| 302 void DiskCacheDirPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, | 312 void DiskCacheDirPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, |
| 303 PrefValueMap* prefs) { | 313 PrefValueMap* prefs) { |
| 304 const Value* value = policies.Get(policy_type()); | 314 const Value* value = policies.GetValue(policy_name()); |
| 305 FilePath::StringType string_value; | 315 FilePath::StringType string_value; |
| 306 if (value && value->GetAsString(&string_value)) { | 316 if (value && value->GetAsString(&string_value)) { |
| 307 FilePath::StringType expanded_value = | 317 FilePath::StringType expanded_value = |
| 308 policy::path_parser::ExpandPathVariables(string_value); | 318 policy::path_parser::ExpandPathVariables(string_value); |
| 309 prefs->SetValue(prefs::kDiskCacheDir, | 319 prefs->SetValue(prefs::kDiskCacheDir, |
| 310 Value::CreateStringValue(expanded_value)); | 320 Value::CreateStringValue(expanded_value)); |
| 311 } | 321 } |
| 312 } | 322 } |
| 313 | 323 |
| 314 | 324 |
| 315 // FileSelectionDialogsHandler implementation ---------------------------------- | 325 // FileSelectionDialogsHandler implementation ---------------------------------- |
| 316 | 326 |
| 317 FileSelectionDialogsHandler::FileSelectionDialogsHandler() | 327 FileSelectionDialogsHandler::FileSelectionDialogsHandler() |
| 318 : TypeCheckingPolicyHandler(kPolicyAllowFileSelectionDialogs, | 328 : TypeCheckingPolicyHandler(key::kAllowFileSelectionDialogs, |
| 319 Value::TYPE_BOOLEAN) { | 329 Value::TYPE_BOOLEAN) { |
| 320 } | 330 } |
| 321 | 331 |
| 322 FileSelectionDialogsHandler::~FileSelectionDialogsHandler() { | 332 FileSelectionDialogsHandler::~FileSelectionDialogsHandler() { |
| 323 } | 333 } |
| 324 | 334 |
| 325 void FileSelectionDialogsHandler::ApplyPolicySettings(const PolicyMap& policies, | 335 void FileSelectionDialogsHandler::ApplyPolicySettings(const PolicyMap& policies, |
| 326 PrefValueMap* prefs) { | 336 PrefValueMap* prefs) { |
| 327 bool allow_dialogs; | 337 bool allow_dialogs; |
| 328 const Value* value = policies.Get(policy_type()); | 338 const Value* value = policies.GetValue(policy_name()); |
| 329 if (value && value->GetAsBoolean(&allow_dialogs)) { | 339 if (value && value->GetAsBoolean(&allow_dialogs)) { |
| 330 prefs->SetValue(prefs::kAllowFileSelectionDialogs, | 340 prefs->SetValue(prefs::kAllowFileSelectionDialogs, |
| 331 Value::CreateBooleanValue(allow_dialogs)); | 341 Value::CreateBooleanValue(allow_dialogs)); |
| 332 // Disallow selecting the download location if file dialogs are disabled. | 342 // Disallow selecting the download location if file dialogs are disabled. |
| 333 if (!allow_dialogs) { | 343 if (!allow_dialogs) { |
| 334 prefs->SetValue(prefs::kPromptForDownload, | 344 prefs->SetValue(prefs::kPromptForDownload, |
| 335 Value::CreateBooleanValue(false)); | 345 Value::CreateBooleanValue(false)); |
| 336 } | 346 } |
| 337 } | 347 } |
| 338 } | 348 } |
| 339 | 349 |
| 340 | 350 |
| 341 // IncognitoModePolicyHandler implementation ----------------------------------- | 351 // IncognitoModePolicyHandler implementation ----------------------------------- |
| 342 | 352 |
| 343 IncognitoModePolicyHandler::IncognitoModePolicyHandler() { | 353 IncognitoModePolicyHandler::IncognitoModePolicyHandler() { |
| 344 } | 354 } |
| 345 | 355 |
| 346 IncognitoModePolicyHandler::~IncognitoModePolicyHandler() { | 356 IncognitoModePolicyHandler::~IncognitoModePolicyHandler() { |
| 347 } | 357 } |
| 348 | 358 |
| 349 bool IncognitoModePolicyHandler::CheckPolicySettings(const PolicyMap& policies, | 359 bool IncognitoModePolicyHandler::CheckPolicySettings(const PolicyMap& policies, |
| 350 PolicyErrorMap* errors) { | 360 PolicyErrorMap* errors) { |
| 351 int int_value = IncognitoModePrefs::ENABLED; | 361 int int_value = IncognitoModePrefs::ENABLED; |
| 352 const Value* availability = policies.Get(kPolicyIncognitoModeAvailability); | 362 const Value* availability = |
| 363 policies.GetValue(key::kIncognitoModeAvailability); | |
| 353 | 364 |
| 354 if (availability) { | 365 if (availability) { |
| 355 if (availability->GetAsInteger(&int_value)) { | 366 if (availability->GetAsInteger(&int_value)) { |
| 356 IncognitoModePrefs::Availability availability_enum_value; | 367 IncognitoModePrefs::Availability availability_enum_value; |
| 357 if (!IncognitoModePrefs::IntToAvailability(int_value, | 368 if (!IncognitoModePrefs::IntToAvailability(int_value, |
| 358 &availability_enum_value)) { | 369 &availability_enum_value)) { |
| 359 errors->AddError(kPolicyIncognitoModeAvailability, | 370 errors->AddError(key::kIncognitoModeAvailability, |
| 360 IDS_POLICY_OUT_OF_RANGE_ERROR, | 371 IDS_POLICY_OUT_OF_RANGE_ERROR, |
| 361 base::IntToString(int_value)); | 372 base::IntToString(int_value)); |
| 362 return false; | 373 return false; |
| 363 } | 374 } |
| 364 } else { | 375 } else { |
| 365 errors->AddError(kPolicyIncognitoModeAvailability, | 376 errors->AddError(key::kIncognitoModeAvailability, |
| 366 IDS_POLICY_TYPE_ERROR, | 377 IDS_POLICY_TYPE_ERROR, |
| 367 ValueTypeToString(Value::TYPE_INTEGER)); | 378 ValueTypeToString(Value::TYPE_INTEGER)); |
| 368 return false; | 379 return false; |
| 369 } | 380 } |
| 370 } else { | 381 } else { |
| 371 const Value* deprecated_enabled = policies.Get(kPolicyIncognitoEnabled); | 382 const Value* deprecated_enabled = policies.GetValue(key::kIncognitoEnabled); |
| 372 if (deprecated_enabled && | 383 if (deprecated_enabled && |
| 373 !deprecated_enabled->IsType(Value::TYPE_BOOLEAN)) { | 384 !deprecated_enabled->IsType(Value::TYPE_BOOLEAN)) { |
| 374 errors->AddError(kPolicyIncognitoEnabled, | 385 errors->AddError(key::kIncognitoEnabled, |
| 375 IDS_POLICY_TYPE_ERROR, | 386 IDS_POLICY_TYPE_ERROR, |
| 376 ValueTypeToString(Value::TYPE_BOOLEAN)); | 387 ValueTypeToString(Value::TYPE_BOOLEAN)); |
| 377 return false; | 388 return false; |
| 378 } | 389 } |
| 379 } | 390 } |
| 380 return true; | 391 return true; |
| 381 } | 392 } |
| 382 | 393 |
| 383 void IncognitoModePolicyHandler::ApplyPolicySettings(const PolicyMap& policies, | 394 void IncognitoModePolicyHandler::ApplyPolicySettings(const PolicyMap& policies, |
| 384 PrefValueMap* prefs) { | 395 PrefValueMap* prefs) { |
| 385 const Value* availability = policies.Get(kPolicyIncognitoModeAvailability); | 396 const Value* availability = |
| 386 const Value* deprecated_enabled = policies.Get(kPolicyIncognitoEnabled); | 397 policies.GetValue(key::kIncognitoModeAvailability); |
| 398 const Value* deprecated_enabled = policies.GetValue(key::kIncognitoEnabled); | |
| 387 if (availability) { | 399 if (availability) { |
| 388 int int_value = IncognitoModePrefs::ENABLED; | 400 int int_value = IncognitoModePrefs::ENABLED; |
| 389 IncognitoModePrefs::Availability availability_enum_value; | 401 IncognitoModePrefs::Availability availability_enum_value; |
| 390 if (availability->GetAsInteger(&int_value) && | 402 if (availability->GetAsInteger(&int_value) && |
| 391 IncognitoModePrefs::IntToAvailability(int_value, | 403 IncognitoModePrefs::IntToAvailability(int_value, |
| 392 &availability_enum_value)) { | 404 &availability_enum_value)) { |
| 393 prefs->SetValue(prefs::kIncognitoModeAvailability, | 405 prefs->SetValue(prefs::kIncognitoModeAvailability, |
| 394 Value::CreateIntegerValue(availability_enum_value)); | 406 Value::CreateIntegerValue(availability_enum_value)); |
| 395 } else { | 407 } else { |
| 396 NOTREACHED(); | 408 NOTREACHED(); |
| 397 } | 409 } |
| 398 } else if (deprecated_enabled) { | 410 } else if (deprecated_enabled) { |
| 399 // If kPolicyIncognitoModeAvailability is not specified, check the obsolete | 411 // If kIncognitoModeAvailability is not specified, check the obsolete |
| 400 // kPolicyIncognitoEnabled. | 412 // kIncognitoEnabled. |
| 401 bool enabled = true; | 413 bool enabled = true; |
| 402 if (deprecated_enabled->GetAsBoolean(&enabled)) { | 414 if (deprecated_enabled->GetAsBoolean(&enabled)) { |
| 403 prefs->SetInteger(prefs::kIncognitoModeAvailability, | 415 prefs->SetInteger(prefs::kIncognitoModeAvailability, |
| 404 enabled ? IncognitoModePrefs::ENABLED : | 416 enabled ? IncognitoModePrefs::ENABLED : |
| 405 IncognitoModePrefs::DISABLED); | 417 IncognitoModePrefs::DISABLED); |
| 406 } else { | 418 } else { |
| 407 NOTREACHED(); | 419 NOTREACHED(); |
| 408 } | 420 } |
| 409 } | 421 } |
| 410 } | 422 } |
| 411 | 423 |
| 412 | 424 |
| 413 // DefaultSearchEncodingsPolicyHandler implementation -------------------------- | 425 // DefaultSearchEncodingsPolicyHandler implementation -------------------------- |
| 414 | 426 |
| 415 DefaultSearchEncodingsPolicyHandler::DefaultSearchEncodingsPolicyHandler() | 427 DefaultSearchEncodingsPolicyHandler::DefaultSearchEncodingsPolicyHandler() |
| 416 : TypeCheckingPolicyHandler(kPolicyDefaultSearchProviderEncodings, | 428 : TypeCheckingPolicyHandler(key::kDefaultSearchProviderEncodings, |
| 417 Value::TYPE_LIST) { | 429 Value::TYPE_LIST) { |
| 418 } | 430 } |
| 419 | 431 |
| 420 DefaultSearchEncodingsPolicyHandler::~DefaultSearchEncodingsPolicyHandler() { | 432 DefaultSearchEncodingsPolicyHandler::~DefaultSearchEncodingsPolicyHandler() { |
| 421 } | 433 } |
| 422 | 434 |
| 423 void DefaultSearchEncodingsPolicyHandler::ApplyPolicySettings( | 435 void DefaultSearchEncodingsPolicyHandler::ApplyPolicySettings( |
| 424 const PolicyMap& policies, PrefValueMap* prefs) { | 436 const PolicyMap& policies, PrefValueMap* prefs) { |
| 425 // The DefaultSearchProviderEncodings policy has type list, but the related | 437 // The DefaultSearchProviderEncodings policy has type list, but the related |
| 426 // preference has type string. Convert one into the other here, using | 438 // preference has type string. Convert one into the other here, using |
| 427 // ';' as a separator. | 439 // ';' as a separator. |
| 428 const Value* value = policies.Get(policy_type()); | 440 const Value* value = policies.GetValue(policy_name()); |
| 429 const ListValue* list; | 441 const ListValue* list; |
| 430 if (!value || !value->GetAsList(&list)) | 442 if (!value || !value->GetAsList(&list)) |
| 431 return; | 443 return; |
| 432 | 444 |
| 433 ListValue::const_iterator iter(list->begin()); | 445 ListValue::const_iterator iter(list->begin()); |
| 434 ListValue::const_iterator end(list->end()); | 446 ListValue::const_iterator end(list->end()); |
| 435 std::vector<std::string> string_parts; | 447 std::vector<std::string> string_parts; |
| 436 for (; iter != end; ++iter) { | 448 for (; iter != end; ++iter) { |
| 437 std::string s; | 449 std::string s; |
| 438 if ((*iter)->GetAsString(&s)) { | 450 if ((*iter)->GetAsString(&s)) { |
| 439 string_parts.push_back(s); | 451 string_parts.push_back(s); |
| 440 } | 452 } |
| 441 } | 453 } |
| 442 std::string encodings = JoinString(string_parts, ';'); | 454 std::string encodings = JoinString(string_parts, ';'); |
| 443 prefs->SetValue(prefs::kDefaultSearchProviderEncodings, | 455 prefs->SetValue(prefs::kDefaultSearchProviderEncodings, |
| 444 Value::CreateStringValue(encodings)); | 456 Value::CreateStringValue(encodings)); |
| 445 } | 457 } |
| 446 | 458 |
| 447 | 459 |
| 448 // DefaultSearchPolicyHandler implementation ----------------------------------- | 460 // DefaultSearchPolicyHandler implementation ----------------------------------- |
| 449 | 461 |
| 450 DefaultSearchPolicyHandler::DefaultSearchPolicyHandler() { | 462 DefaultSearchPolicyHandler::DefaultSearchPolicyHandler() { |
| 451 for (size_t i = 0; i < arraysize(kDefaultSearchPolicyMap); ++i) { | 463 for (size_t i = 0; i < arraysize(kDefaultSearchPolicyMap); ++i) { |
| 452 ConfigurationPolicyType policy_type = | 464 const char* policy_name = kDefaultSearchPolicyMap[i].policy_name; |
| 453 kDefaultSearchPolicyMap[i].policy_type; | 465 if (policy_name == key::kDefaultSearchProviderEncodings) { |
| 454 if (policy_type == kPolicyDefaultSearchProviderEncodings) { | |
| 455 handlers_.push_back(new DefaultSearchEncodingsPolicyHandler()); | 466 handlers_.push_back(new DefaultSearchEncodingsPolicyHandler()); |
| 456 } else { | 467 } else { |
| 457 handlers_.push_back( | 468 handlers_.push_back( |
| 458 new SimplePolicyHandler(policy_type, | 469 new SimplePolicyHandler(policy_name, |
| 459 kDefaultSearchPolicyMap[i].value_type, | 470 kDefaultSearchPolicyMap[i].preference_path, |
| 460 kDefaultSearchPolicyMap[i].preference_path)); | 471 kDefaultSearchPolicyMap[i].value_type)); |
| 461 } | 472 } |
| 462 } | 473 } |
| 463 } | 474 } |
| 464 | 475 |
| 465 DefaultSearchPolicyHandler::~DefaultSearchPolicyHandler() { | 476 DefaultSearchPolicyHandler::~DefaultSearchPolicyHandler() { |
| 466 STLDeleteElements(&handlers_); | 477 STLDeleteElements(&handlers_); |
| 467 } | 478 } |
| 468 | 479 |
| 469 bool DefaultSearchPolicyHandler::CheckPolicySettings(const PolicyMap& policies, | 480 bool DefaultSearchPolicyHandler::CheckPolicySettings(const PolicyMap& policies, |
| 470 PolicyErrorMap* errors) { | 481 PolicyErrorMap* errors) { |
| 471 if (!CheckIndividualPolicies(policies, errors)) | 482 if (!CheckIndividualPolicies(policies, errors)) |
| 472 return false; | 483 return false; |
| 473 | 484 |
| 474 if (DefaultSearchProviderIsDisabled(policies)) { | 485 if (DefaultSearchProviderIsDisabled(policies)) { |
| 475 // Add an error for all specified default search policies except | 486 // Add an error for all specified default search policies except |
| 476 // DefaultSearchProviderEnabled. | 487 // DefaultSearchProviderEnabled. |
| 477 for (size_t i = 0; i < arraysize(kDefaultSearchPolicyMap); ++i) { | 488 for (size_t i = 0; i < arraysize(kDefaultSearchPolicyMap); ++i) { |
| 478 ConfigurationPolicyType policy_type = | 489 const char* policy_name = kDefaultSearchPolicyMap[i].policy_name; |
| 479 kDefaultSearchPolicyMap[i].policy_type; | 490 if (policy_name != key::kDefaultSearchProviderEnabled && |
| 480 if (policy_type != kPolicyDefaultSearchProviderEnabled && | 491 HasDefaultSearchPolicy(policies, policy_name)) { |
| 481 HasDefaultSearchPolicy(policies, policy_type)) { | 492 errors->AddError(policy_name, IDS_POLICY_DEFAULT_SEARCH_DISABLED); |
| 482 errors->AddError(policy_type, IDS_POLICY_DEFAULT_SEARCH_DISABLED); | |
| 483 } | 493 } |
| 484 } | 494 } |
| 485 return true; | 495 return true; |
| 486 } | 496 } |
| 487 | 497 |
| 488 const Value* search_url = | 498 const Value* search_url = |
| 489 policies.Get(kPolicyDefaultSearchProviderSearchURL); | 499 policies.GetValue(key::kDefaultSearchProviderSearchURL); |
| 490 if (!search_url && AnyDefaultSearchPoliciesSpecified(policies)) { | 500 if (!search_url && AnyDefaultSearchPoliciesSpecified(policies)) { |
| 491 errors->AddError(kPolicyDefaultSearchProviderSearchURL, | 501 errors->AddError(key::kDefaultSearchProviderSearchURL, |
| 492 IDS_POLICY_NOT_SPECIFIED_ERROR); | 502 IDS_POLICY_NOT_SPECIFIED_ERROR); |
| 493 return false; | 503 return false; |
| 494 } | 504 } |
| 495 | 505 |
| 496 if (search_url && !DefaultSearchURLIsValid(policies)) { | 506 if (search_url && !DefaultSearchURLIsValid(policies)) { |
| 497 errors->AddError(kPolicyDefaultSearchProviderSearchURL, | 507 errors->AddError(key::kDefaultSearchProviderSearchURL, |
| 498 IDS_POLICY_INVALID_SEARCH_URL_ERROR); | 508 IDS_POLICY_INVALID_SEARCH_URL_ERROR); |
| 499 return false; | 509 return false; |
| 500 } | 510 } |
| 501 return true; | 511 return true; |
| 502 } | 512 } |
| 503 | 513 |
| 504 void DefaultSearchPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, | 514 void DefaultSearchPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, |
| 505 PrefValueMap* prefs) { | 515 PrefValueMap* prefs) { |
| 506 if (DefaultSearchProviderIsDisabled(policies)) { | 516 if (DefaultSearchProviderIsDisabled(policies)) { |
| 507 // If default search is disabled, the other fields are ignored. | 517 // If default search is disabled, the other fields are ignored. |
| 508 prefs->SetString(prefs::kDefaultSearchProviderName, std::string()); | 518 prefs->SetString(prefs::kDefaultSearchProviderName, std::string()); |
| 509 prefs->SetString(prefs::kDefaultSearchProviderSearchURL, std::string()); | 519 prefs->SetString(prefs::kDefaultSearchProviderSearchURL, std::string()); |
| 510 prefs->SetString(prefs::kDefaultSearchProviderSuggestURL, std::string()); | 520 prefs->SetString(prefs::kDefaultSearchProviderSuggestURL, std::string()); |
| 511 prefs->SetString(prefs::kDefaultSearchProviderIconURL, std::string()); | 521 prefs->SetString(prefs::kDefaultSearchProviderIconURL, std::string()); |
| 512 prefs->SetString(prefs::kDefaultSearchProviderEncodings, std::string()); | 522 prefs->SetString(prefs::kDefaultSearchProviderEncodings, std::string()); |
| 513 prefs->SetString(prefs::kDefaultSearchProviderKeyword, std::string()); | 523 prefs->SetString(prefs::kDefaultSearchProviderKeyword, std::string()); |
| 514 prefs->SetString(prefs::kDefaultSearchProviderInstantURL, std::string()); | 524 prefs->SetString(prefs::kDefaultSearchProviderInstantURL, std::string()); |
| 515 return; | 525 return; |
| 516 } | 526 } |
| 517 | 527 |
| 518 const Value* search_url = | 528 const Value* search_url = |
| 519 policies.Get(kPolicyDefaultSearchProviderSearchURL); | 529 policies.GetValue(key::kDefaultSearchProviderSearchURL); |
| 520 // The search URL is required. | 530 // The search URL is required. |
| 521 if (!search_url) | 531 if (!search_url) |
| 522 return; | 532 return; |
| 523 | 533 |
| 524 // The other entries are optional. Just make sure that they are all | 534 // The other entries are optional. Just make sure that they are all |
| 525 // specified via policy, so that the regular prefs aren't used. | 535 // specified via policy, so that the regular prefs aren't used. |
| 526 if (DefaultSearchURLIsValid(policies)) { | 536 if (DefaultSearchURLIsValid(policies)) { |
| 527 std::vector<ConfigurationPolicyHandler*>::const_iterator handler; | 537 std::vector<ConfigurationPolicyHandler*>::const_iterator handler; |
| 528 for (handler = handlers_.begin() ; handler != handlers_.end(); ++handler) | 538 for (handler = handlers_.begin() ; handler != handlers_.end(); ++handler) |
| 529 (*handler)->ApplyPolicySettings(policies, prefs); | 539 (*handler)->ApplyPolicySettings(policies, prefs); |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 558 std::vector<ConfigurationPolicyHandler*>::const_iterator handler; | 568 std::vector<ConfigurationPolicyHandler*>::const_iterator handler; |
| 559 for (handler = handlers_.begin() ; handler != handlers_.end(); ++handler) { | 569 for (handler = handlers_.begin() ; handler != handlers_.end(); ++handler) { |
| 560 if (!(*handler)->CheckPolicySettings(policies, errors)) | 570 if (!(*handler)->CheckPolicySettings(policies, errors)) |
| 561 return false; | 571 return false; |
| 562 } | 572 } |
| 563 return true; | 573 return true; |
| 564 } | 574 } |
| 565 | 575 |
| 566 bool DefaultSearchPolicyHandler::HasDefaultSearchPolicy( | 576 bool DefaultSearchPolicyHandler::HasDefaultSearchPolicy( |
| 567 const PolicyMap& policies, | 577 const PolicyMap& policies, |
| 568 ConfigurationPolicyType policy_type) { | 578 const char* policy_name) { |
| 569 return policies.Get(policy_type) != NULL; | 579 return policies.Get(policy_name) != NULL; |
| 570 } | 580 } |
| 571 | 581 |
| 572 bool DefaultSearchPolicyHandler::AnyDefaultSearchPoliciesSpecified( | 582 bool DefaultSearchPolicyHandler::AnyDefaultSearchPoliciesSpecified( |
| 573 const PolicyMap& policies) { | 583 const PolicyMap& policies) { |
| 574 for (size_t i = 0; i < arraysize(kDefaultSearchPolicyMap); ++i) { | 584 for (size_t i = 0; i < arraysize(kDefaultSearchPolicyMap); ++i) { |
| 575 if (policies.Get(kDefaultSearchPolicyMap[i].policy_type)) | 585 if (policies.Get(kDefaultSearchPolicyMap[i].policy_name)) |
| 576 return true; | 586 return true; |
| 577 } | 587 } |
| 578 return false; | 588 return false; |
| 579 } | 589 } |
| 580 | 590 |
| 581 bool DefaultSearchPolicyHandler::DefaultSearchProviderIsDisabled( | 591 bool DefaultSearchPolicyHandler::DefaultSearchProviderIsDisabled( |
| 582 const PolicyMap& policies) { | 592 const PolicyMap& policies) { |
| 583 const Value* provider_enabled = | 593 const Value* provider_enabled = |
| 584 policies.Get(kPolicyDefaultSearchProviderEnabled); | 594 policies.GetValue(key::kDefaultSearchProviderEnabled); |
| 585 bool enabled = true; | 595 bool enabled = true; |
| 586 return provider_enabled && | 596 return provider_enabled && |
| 587 provider_enabled->GetAsBoolean(&enabled) && | 597 provider_enabled->GetAsBoolean(&enabled) && |
| 588 !enabled; | 598 !enabled; |
| 589 } | 599 } |
| 590 | 600 |
| 591 bool DefaultSearchPolicyHandler::DefaultSearchURLIsValid( | 601 bool DefaultSearchPolicyHandler::DefaultSearchURLIsValid( |
| 592 const PolicyMap& policies) { | 602 const PolicyMap& policies) { |
| 593 const Value* search_url = | 603 const Value* search_url = |
| 594 policies.Get(kPolicyDefaultSearchProviderSearchURL); | 604 policies.GetValue(key::kDefaultSearchProviderSearchURL); |
| 595 if (!search_url) | 605 if (!search_url) |
| 596 return false; | 606 return false; |
| 597 | 607 |
| 598 std::string search_url_string; | 608 std::string search_url_string; |
| 599 if (search_url->GetAsString(&search_url_string)) { | 609 if (search_url->GetAsString(&search_url_string)) { |
| 600 SearchTermsDataForValidation search_terms_data; | 610 SearchTermsDataForValidation search_terms_data; |
| 601 const TemplateURLRef search_url_ref(search_url_string, 0, 0); | 611 const TemplateURLRef search_url_ref(search_url_string, 0, 0); |
| 602 // It must support replacement (which implies it is valid). | 612 // It must support replacement (which implies it is valid). |
| 603 return search_url_ref.SupportsReplacementUsingTermsData(search_terms_data); | 613 return search_url_ref.SupportsReplacementUsingTermsData(search_terms_data); |
| 604 } | 614 } |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 622 // proxy policies will be deprecated. http://crbug.com/108996 | 632 // proxy policies will be deprecated. http://crbug.com/108996 |
| 623 | 633 |
| 624 ProxyPolicyHandler::ProxyPolicyHandler() { | 634 ProxyPolicyHandler::ProxyPolicyHandler() { |
| 625 } | 635 } |
| 626 | 636 |
| 627 ProxyPolicyHandler::~ProxyPolicyHandler() { | 637 ProxyPolicyHandler::~ProxyPolicyHandler() { |
| 628 } | 638 } |
| 629 | 639 |
| 630 bool ProxyPolicyHandler::CheckPolicySettings(const PolicyMap& policies, | 640 bool ProxyPolicyHandler::CheckPolicySettings(const PolicyMap& policies, |
| 631 PolicyErrorMap* errors) { | 641 PolicyErrorMap* errors) { |
| 632 const Value* mode = GetProxyPolicyValue(policies, kPolicyProxyMode); | 642 const Value* mode = GetProxyPolicyValue(policies, key::kProxyMode); |
| 633 const Value* server = GetProxyPolicyValue(policies, kPolicyProxyServer); | 643 const Value* server = GetProxyPolicyValue(policies, key::kProxyServer); |
| 634 const Value* server_mode = | 644 const Value* server_mode = |
| 635 GetProxyPolicyValue(policies, kPolicyProxyServerMode); | 645 GetProxyPolicyValue(policies, key::kProxyServerMode); |
| 636 const Value* pac_url = GetProxyPolicyValue(policies, kPolicyProxyPacUrl); | 646 const Value* pac_url = GetProxyPolicyValue(policies, key::kProxyPacUrl); |
| 637 const Value* bypass_list = | 647 const Value* bypass_list = |
| 638 GetProxyPolicyValue(policies, kPolicyProxyBypassList); | 648 GetProxyPolicyValue(policies, key::kProxyBypassList); |
| 639 | 649 |
| 640 if ((server || pac_url || bypass_list) && !(mode || server_mode)) { | 650 if ((server || pac_url || bypass_list) && !(mode || server_mode)) { |
| 641 errors->AddError(kPolicyProxySettings, | 651 errors->AddError(key::kProxySettings, |
| 642 GetPolicyName(kPolicyProxyMode), | 652 key::kProxyMode, |
| 643 IDS_POLICY_NOT_SPECIFIED_ERROR); | 653 IDS_POLICY_NOT_SPECIFIED_ERROR); |
| 644 return false; | 654 return false; |
| 645 } | 655 } |
| 646 | 656 |
| 647 std::string mode_value; | 657 std::string mode_value; |
| 648 if (!CheckProxyModeAndServerMode(policies, errors, &mode_value)) | 658 if (!CheckProxyModeAndServerMode(policies, errors, &mode_value)) |
| 649 return false; | 659 return false; |
| 650 | 660 |
| 651 // If neither ProxyMode nor ProxyServerMode are specified, mode_value will be | 661 // If neither ProxyMode nor ProxyServerMode are specified, mode_value will be |
| 652 // empty and the proxy shouldn't be configured at all. | 662 // empty and the proxy shouldn't be configured at all. |
| 653 if (mode_value.empty()) | 663 if (mode_value.empty()) |
| 654 return true; | 664 return true; |
| 655 | 665 |
| 656 bool is_valid_mode = false; | 666 bool is_valid_mode = false; |
| 657 for (size_t i = 0; i != arraysize(kProxyModeValidationMap); ++i) { | 667 for (size_t i = 0; i != arraysize(kProxyModeValidationMap); ++i) { |
| 658 const ProxyModeValidationEntry& entry = kProxyModeValidationMap[i]; | 668 const ProxyModeValidationEntry& entry = kProxyModeValidationMap[i]; |
| 659 if (entry.mode_value != mode_value) | 669 if (entry.mode_value != mode_value) |
| 660 continue; | 670 continue; |
| 661 | 671 |
| 662 is_valid_mode = true; | 672 is_valid_mode = true; |
| 663 | 673 |
| 664 if (!entry.pac_url_allowed && pac_url) { | 674 if (!entry.pac_url_allowed && pac_url) { |
| 665 errors->AddError(kPolicyProxySettings, | 675 errors->AddError(key::kProxySettings, |
| 666 GetPolicyName(kPolicyProxyPacUrl), | 676 key::kProxyPacUrl, |
| 667 entry.error_message_id); | 677 entry.error_message_id); |
| 668 } | 678 } |
| 669 if (!entry.bypass_list_allowed && bypass_list) { | 679 if (!entry.bypass_list_allowed && bypass_list) { |
| 670 errors->AddError(kPolicyProxySettings, | 680 errors->AddError(key::kProxySettings, |
| 671 GetPolicyName(kPolicyProxyBypassList), | 681 key::kProxyBypassList, |
| 672 entry.error_message_id); | 682 entry.error_message_id); |
| 673 } | 683 } |
| 674 if (!entry.server_allowed && server) { | 684 if (!entry.server_allowed && server) { |
| 675 errors->AddError(kPolicyProxySettings, | 685 errors->AddError(key::kProxySettings, |
| 676 GetPolicyName(kPolicyProxyServer), | 686 key::kProxyServer, |
| 677 entry.error_message_id); | 687 entry.error_message_id); |
| 678 } | 688 } |
| 679 | 689 |
| 680 if ((!entry.pac_url_allowed && pac_url) || | 690 if ((!entry.pac_url_allowed && pac_url) || |
| 681 (!entry.bypass_list_allowed && bypass_list) || | 691 (!entry.bypass_list_allowed && bypass_list) || |
| 682 (!entry.server_allowed && server)) { | 692 (!entry.server_allowed && server)) { |
| 683 return false; | 693 return false; |
| 684 } | 694 } |
| 685 } | 695 } |
| 686 | 696 |
| 687 if (!is_valid_mode) { | 697 if (!is_valid_mode) { |
| 688 errors->AddError(kPolicyProxySettings, | 698 errors->AddError(key::kProxySettings, |
| 689 GetPolicyName( | 699 mode ? key::kProxyMode : key::kProxyServerMode, |
| 690 mode ? kPolicyProxyMode : kPolicyProxyServerMode), | |
| 691 IDS_POLICY_OUT_OF_RANGE_ERROR, | 700 IDS_POLICY_OUT_OF_RANGE_ERROR, |
| 692 mode_value); | 701 mode_value); |
| 693 return false; | 702 return false; |
| 694 } | 703 } |
| 695 return true; | 704 return true; |
| 696 } | 705 } |
| 697 | 706 |
| 698 void ProxyPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, | 707 void ProxyPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, |
| 699 PrefValueMap* prefs) { | 708 PrefValueMap* prefs) { |
| 700 const Value* mode = GetProxyPolicyValue(policies, kPolicyProxyMode); | 709 const Value* mode = GetProxyPolicyValue(policies, key::kProxyMode); |
| 701 const Value* server = GetProxyPolicyValue(policies, kPolicyProxyServer); | 710 const Value* server = GetProxyPolicyValue(policies, key::kProxyServer); |
| 702 const Value* server_mode = | 711 const Value* server_mode = |
| 703 GetProxyPolicyValue(policies, kPolicyProxyServerMode); | 712 GetProxyPolicyValue(policies, key::kProxyServerMode); |
| 704 const Value* pac_url = GetProxyPolicyValue(policies, kPolicyProxyPacUrl); | 713 const Value* pac_url = GetProxyPolicyValue(policies, key::kProxyPacUrl); |
| 705 const Value* bypass_list = | 714 const Value* bypass_list = |
| 706 GetProxyPolicyValue(policies, kPolicyProxyBypassList); | 715 GetProxyPolicyValue(policies, key::kProxyBypassList); |
| 707 | 716 |
| 708 ProxyPrefs::ProxyMode proxy_mode; | 717 ProxyPrefs::ProxyMode proxy_mode; |
| 709 if (mode) { | 718 if (mode) { |
| 710 std::string string_mode; | 719 std::string string_mode; |
| 711 CHECK(mode->GetAsString(&string_mode)); | 720 CHECK(mode->GetAsString(&string_mode)); |
| 712 CHECK(ProxyPrefs::StringToProxyMode(string_mode, &proxy_mode)); | 721 CHECK(ProxyPrefs::StringToProxyMode(string_mode, &proxy_mode)); |
| 713 } else if (server_mode) { | 722 } else if (server_mode) { |
| 714 int int_mode = 0; | 723 int int_mode = 0; |
| 715 CHECK(server_mode->GetAsInteger(&int_mode)); | 724 CHECK(server_mode->GetAsInteger(&int_mode)); |
| 716 | 725 |
| 717 switch (int_mode) { | 726 switch (int_mode) { |
| 718 case kPolicyNoProxyServerMode: | 727 case kNoProxyServerMode: |
| 719 proxy_mode = ProxyPrefs::MODE_DIRECT; | 728 proxy_mode = ProxyPrefs::MODE_DIRECT; |
| 720 break; | 729 break; |
| 721 case kPolicyAutoDetectProxyServerMode: | 730 case kAutoDetectProxyServerMode: |
| 722 proxy_mode = ProxyPrefs::MODE_AUTO_DETECT; | 731 proxy_mode = ProxyPrefs::MODE_AUTO_DETECT; |
| 723 break; | 732 break; |
| 724 case kPolicyManuallyConfiguredProxyServerMode: | 733 case kManuallyConfiguredProxyServerMode: |
| 725 proxy_mode = ProxyPrefs::MODE_FIXED_SERVERS; | 734 proxy_mode = ProxyPrefs::MODE_FIXED_SERVERS; |
| 726 if (pac_url) | 735 if (pac_url) |
| 727 proxy_mode = ProxyPrefs::MODE_PAC_SCRIPT; | 736 proxy_mode = ProxyPrefs::MODE_PAC_SCRIPT; |
| 728 break; | 737 break; |
| 729 case kPolicyUseSystemProxyServerMode: | 738 case kUseSystemProxyServerMode: |
| 730 proxy_mode = ProxyPrefs::MODE_SYSTEM; | 739 proxy_mode = ProxyPrefs::MODE_SYSTEM; |
| 731 break; | 740 break; |
| 732 default: | 741 default: |
| 733 proxy_mode = ProxyPrefs::MODE_DIRECT; | 742 proxy_mode = ProxyPrefs::MODE_DIRECT; |
| 734 NOTREACHED(); | 743 NOTREACHED(); |
| 735 } | 744 } |
| 736 } else { | 745 } else { |
| 737 return; | 746 return; |
| 738 } | 747 } |
| 739 | 748 |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 769 case ProxyPrefs::MODE_SYSTEM: | 778 case ProxyPrefs::MODE_SYSTEM: |
| 770 prefs->SetValue(prefs::kProxy, | 779 prefs->SetValue(prefs::kProxy, |
| 771 ProxyConfigDictionary::CreateSystem()); | 780 ProxyConfigDictionary::CreateSystem()); |
| 772 break; | 781 break; |
| 773 case ProxyPrefs::kModeCount: | 782 case ProxyPrefs::kModeCount: |
| 774 NOTREACHED(); | 783 NOTREACHED(); |
| 775 } | 784 } |
| 776 } | 785 } |
| 777 | 786 |
| 778 const Value* ProxyPolicyHandler::GetProxyPolicyValue( | 787 const Value* ProxyPolicyHandler::GetProxyPolicyValue( |
| 779 const PolicyMap& policies, ConfigurationPolicyType policy) { | 788 const PolicyMap& policies, const char* policy_name) { |
| 780 // See note on the ProxyPolicyHandler implementation above. | 789 // See note on the ProxyPolicyHandler implementation above. |
| 781 const Value* value = policies.Get(kPolicyProxySettings); | 790 const Value* value = policies.GetValue(key::kProxySettings); |
| 782 const DictionaryValue* settings; | 791 const DictionaryValue* settings; |
| 783 if (!value || !value->GetAsDictionary(&settings)) | 792 if (!value || !value->GetAsDictionary(&settings)) |
| 784 return NULL; | 793 return NULL; |
| 785 | 794 |
| 786 Value* policy_value = NULL; | 795 Value* policy_value = NULL; |
| 787 std::string tmp; | 796 std::string tmp; |
| 788 if (!settings->Get(GetPolicyName(policy), &policy_value) || | 797 if (!settings->Get(policy_name, &policy_value) || |
| 789 policy_value->IsType(Value::TYPE_NULL) || | 798 policy_value->IsType(Value::TYPE_NULL) || |
| 790 (policy_value->IsType(Value::TYPE_STRING) && | 799 (policy_value->IsType(Value::TYPE_STRING) && |
| 791 policy_value->GetAsString(&tmp) && | 800 policy_value->GetAsString(&tmp) && |
| 792 tmp.empty())) { | 801 tmp.empty())) { |
| 793 return NULL; | 802 return NULL; |
| 794 } | 803 } |
| 795 return policy_value; | 804 return policy_value; |
| 796 } | 805 } |
| 797 | 806 |
| 798 bool ProxyPolicyHandler::CheckProxyModeAndServerMode(const PolicyMap& policies, | 807 bool ProxyPolicyHandler::CheckProxyModeAndServerMode(const PolicyMap& policies, |
| 799 PolicyErrorMap* errors, | 808 PolicyErrorMap* errors, |
| 800 std::string* mode_value) { | 809 std::string* mode_value) { |
| 801 const Value* mode = GetProxyPolicyValue(policies, kPolicyProxyMode); | 810 const Value* mode = GetProxyPolicyValue(policies, key::kProxyMode); |
| 802 const Value* server = GetProxyPolicyValue(policies, kPolicyProxyServer); | 811 const Value* server = GetProxyPolicyValue(policies, key::kProxyServer); |
| 803 const Value* server_mode = | 812 const Value* server_mode = |
| 804 GetProxyPolicyValue(policies, kPolicyProxyServerMode); | 813 GetProxyPolicyValue(policies, key::kProxyServerMode); |
| 805 const Value* pac_url = GetProxyPolicyValue(policies, kPolicyProxyPacUrl); | 814 const Value* pac_url = GetProxyPolicyValue(policies, key::kProxyPacUrl); |
| 806 | 815 |
| 807 // If there's a server mode, convert it into a mode. | 816 // If there's a server mode, convert it into a mode. |
| 808 // When both are specified, the mode takes precedence. | 817 // When both are specified, the mode takes precedence. |
| 809 if (mode) { | 818 if (mode) { |
| 810 if (server_mode) { | 819 if (server_mode) { |
| 811 errors->AddError(kPolicyProxySettings, | 820 errors->AddError(key::kProxySettings, |
| 812 GetPolicyName(kPolicyProxyServerMode), | 821 key::kProxyServerMode, |
| 813 IDS_POLICY_OVERRIDDEN, | 822 IDS_POLICY_OVERRIDDEN, |
| 814 GetPolicyName(kPolicyProxyMode)); | 823 key::kProxyMode); |
| 815 } | 824 } |
| 816 if (!mode->GetAsString(mode_value)) { | 825 if (!mode->GetAsString(mode_value)) { |
| 817 errors->AddError(kPolicyProxySettings, | 826 errors->AddError(key::kProxySettings, |
| 818 GetPolicyName(kPolicyProxyMode), | 827 key::kProxyMode, |
| 819 IDS_POLICY_TYPE_ERROR, | 828 IDS_POLICY_TYPE_ERROR, |
| 820 ValueTypeToString(Value::TYPE_BOOLEAN)); | 829 ValueTypeToString(Value::TYPE_BOOLEAN)); |
| 821 return false; | 830 return false; |
| 822 } | 831 } |
| 823 | 832 |
| 824 ProxyPrefs::ProxyMode mode; | 833 ProxyPrefs::ProxyMode mode; |
| 825 if (!ProxyPrefs::StringToProxyMode(*mode_value, &mode)) { | 834 if (!ProxyPrefs::StringToProxyMode(*mode_value, &mode)) { |
| 826 errors->AddError(kPolicyProxySettings, | 835 errors->AddError(key::kProxySettings, |
| 827 GetPolicyName(kPolicyProxyMode), | 836 key::kProxyMode, |
| 828 IDS_POLICY_INVALID_PROXY_MODE_ERROR); | 837 IDS_POLICY_INVALID_PROXY_MODE_ERROR); |
| 829 return false; | 838 return false; |
| 830 } | 839 } |
| 831 | 840 |
| 832 if (mode == ProxyPrefs::MODE_PAC_SCRIPT && !pac_url) { | 841 if (mode == ProxyPrefs::MODE_PAC_SCRIPT && !pac_url) { |
| 833 errors->AddError(kPolicyProxySettings, | 842 errors->AddError(key::kProxySettings, |
| 834 GetPolicyName(kPolicyProxyPacUrl), | 843 key::kProxyPacUrl, |
| 835 IDS_POLICY_NOT_SPECIFIED_ERROR); | 844 IDS_POLICY_NOT_SPECIFIED_ERROR); |
| 836 return false; | 845 return false; |
| 837 } else if (mode == ProxyPrefs::MODE_FIXED_SERVERS && !server) { | 846 } else if (mode == ProxyPrefs::MODE_FIXED_SERVERS && !server) { |
| 838 errors->AddError(kPolicyProxySettings, | 847 errors->AddError(key::kProxySettings, |
| 839 GetPolicyName(kPolicyProxyServer), | 848 key::kProxyServer, |
| 840 IDS_POLICY_NOT_SPECIFIED_ERROR); | 849 IDS_POLICY_NOT_SPECIFIED_ERROR); |
| 841 return false; | 850 return false; |
| 842 } | 851 } |
| 843 } else if (server_mode) { | 852 } else if (server_mode) { |
| 844 int server_mode_value; | 853 int server_mode_value; |
| 845 if (!server_mode->GetAsInteger(&server_mode_value)) { | 854 if (!server_mode->GetAsInteger(&server_mode_value)) { |
| 846 errors->AddError(kPolicyProxySettings, | 855 errors->AddError(key::kProxySettings, |
| 847 GetPolicyName(kPolicyProxyServerMode), | 856 key::kProxyServerMode, |
| 848 IDS_POLICY_TYPE_ERROR, | 857 IDS_POLICY_TYPE_ERROR, |
| 849 ValueTypeToString(Value::TYPE_INTEGER)); | 858 ValueTypeToString(Value::TYPE_INTEGER)); |
| 850 return false; | 859 return false; |
| 851 } | 860 } |
| 852 | 861 |
| 853 switch (server_mode_value) { | 862 switch (server_mode_value) { |
| 854 case kPolicyNoProxyServerMode: | 863 case kNoProxyServerMode: |
| 855 *mode_value = ProxyPrefs::kDirectProxyModeName; | 864 *mode_value = ProxyPrefs::kDirectProxyModeName; |
| 856 break; | 865 break; |
| 857 case kPolicyAutoDetectProxyServerMode: | 866 case kAutoDetectProxyServerMode: |
| 858 *mode_value = ProxyPrefs::kAutoDetectProxyModeName; | 867 *mode_value = ProxyPrefs::kAutoDetectProxyModeName; |
| 859 break; | 868 break; |
| 860 case kPolicyManuallyConfiguredProxyServerMode: | 869 case kManuallyConfiguredProxyServerMode: |
| 861 if (server && pac_url) { | 870 if (server && pac_url) { |
| 862 int message_id = IDS_POLICY_PROXY_BOTH_SPECIFIED_ERROR; | 871 int message_id = IDS_POLICY_PROXY_BOTH_SPECIFIED_ERROR; |
| 863 errors->AddError(kPolicyProxySettings, | 872 errors->AddError(key::kProxySettings, |
| 864 GetPolicyName(kPolicyProxyServer), | 873 key::kProxyServer, |
| 865 message_id); | 874 message_id); |
| 866 errors->AddError(kPolicyProxySettings, | 875 errors->AddError(key::kProxySettings, |
| 867 GetPolicyName(kPolicyProxyPacUrl), | 876 key::kProxyPacUrl, |
| 868 message_id); | 877 message_id); |
| 869 return false; | 878 return false; |
| 870 } | 879 } |
| 871 if (!server && !pac_url) { | 880 if (!server && !pac_url) { |
| 872 int message_id = IDS_POLICY_PROXY_NEITHER_SPECIFIED_ERROR; | 881 int message_id = IDS_POLICY_PROXY_NEITHER_SPECIFIED_ERROR; |
| 873 errors->AddError(kPolicyProxySettings, | 882 errors->AddError(key::kProxySettings, |
| 874 GetPolicyName(kPolicyProxyServer), | 883 key::kProxyServer, |
| 875 message_id); | 884 message_id); |
| 876 errors->AddError(kPolicyProxySettings, | 885 errors->AddError(key::kProxySettings, |
| 877 GetPolicyName(kPolicyProxyPacUrl), | 886 key::kProxyPacUrl, |
| 878 message_id); | 887 message_id); |
| 879 return false; | 888 return false; |
| 880 } | 889 } |
| 881 if (pac_url) | 890 if (pac_url) |
| 882 *mode_value = ProxyPrefs::kPacScriptProxyModeName; | 891 *mode_value = ProxyPrefs::kPacScriptProxyModeName; |
| 883 else | 892 else |
| 884 *mode_value = ProxyPrefs::kFixedServersProxyModeName; | 893 *mode_value = ProxyPrefs::kFixedServersProxyModeName; |
| 885 break; | 894 break; |
| 886 case kPolicyUseSystemProxyServerMode: | 895 case kUseSystemProxyServerMode: |
| 887 *mode_value = ProxyPrefs::kSystemProxyModeName; | 896 *mode_value = ProxyPrefs::kSystemProxyModeName; |
| 888 break; | 897 break; |
| 889 default: | 898 default: |
| 890 errors->AddError(kPolicyProxySettings, | 899 errors->AddError(key::kProxySettings, |
| 891 GetPolicyName(kPolicyProxyServerMode), | 900 key::kProxyServerMode, |
| 892 IDS_POLICY_OUT_OF_RANGE_ERROR, | 901 IDS_POLICY_OUT_OF_RANGE_ERROR, |
| 893 base::IntToString(server_mode_value)); | 902 base::IntToString(server_mode_value)); |
| 894 return false; | 903 return false; |
| 895 } | 904 } |
| 896 } | 905 } |
| 897 return true; | 906 return true; |
| 898 } | 907 } |
| 899 | 908 |
| 900 | 909 |
| 901 // JavascriptPolicyHandler implementation -------------------------------------- | 910 // JavascriptPolicyHandler implementation -------------------------------------- |
| 902 | 911 |
| 903 JavascriptPolicyHandler::JavascriptPolicyHandler() { | 912 JavascriptPolicyHandler::JavascriptPolicyHandler() { |
| 904 } | 913 } |
| 905 | 914 |
| 906 JavascriptPolicyHandler::~JavascriptPolicyHandler() { | 915 JavascriptPolicyHandler::~JavascriptPolicyHandler() { |
| 907 } | 916 } |
| 908 | 917 |
| 909 bool JavascriptPolicyHandler::CheckPolicySettings(const PolicyMap& policies, | 918 bool JavascriptPolicyHandler::CheckPolicySettings(const PolicyMap& policies, |
| 910 PolicyErrorMap* errors) { | 919 PolicyErrorMap* errors) { |
| 911 const Value* javascript_enabled = policies.Get(kPolicyJavascriptEnabled); | 920 const Value* javascript_enabled = policies.GetValue(key::kJavascriptEnabled); |
| 912 const Value* default_setting = policies.Get(kPolicyDefaultJavaScriptSetting); | 921 const Value* default_setting = |
| 922 policies.GetValue(key::kDefaultJavaScriptSetting); | |
| 913 | 923 |
| 914 if (javascript_enabled && !javascript_enabled->IsType(Value::TYPE_BOOLEAN)) { | 924 if (javascript_enabled && !javascript_enabled->IsType(Value::TYPE_BOOLEAN)) { |
| 915 errors->AddError(kPolicyJavascriptEnabled, | 925 errors->AddError(key::kJavascriptEnabled, |
| 916 IDS_POLICY_TYPE_ERROR, | 926 IDS_POLICY_TYPE_ERROR, |
| 917 ValueTypeToString(Value::TYPE_BOOLEAN)); | 927 ValueTypeToString(Value::TYPE_BOOLEAN)); |
| 918 } | 928 } |
| 919 | 929 |
| 920 if (default_setting && !default_setting->IsType(Value::TYPE_INTEGER)) { | 930 if (default_setting && !default_setting->IsType(Value::TYPE_INTEGER)) { |
| 921 errors->AddError(kPolicyDefaultJavaScriptSetting, | 931 errors->AddError(key::kDefaultJavaScriptSetting, |
| 922 IDS_POLICY_TYPE_ERROR, | 932 IDS_POLICY_TYPE_ERROR, |
| 923 ValueTypeToString(Value::TYPE_INTEGER)); | 933 ValueTypeToString(Value::TYPE_INTEGER)); |
| 924 } | 934 } |
| 925 | 935 |
| 926 if (javascript_enabled && default_setting) { | 936 if (javascript_enabled && default_setting) { |
| 927 errors->AddError(kPolicyJavascriptEnabled, | 937 errors->AddError(key::kJavascriptEnabled, |
| 928 IDS_POLICY_OVERRIDDEN, | 938 IDS_POLICY_OVERRIDDEN, |
| 929 GetPolicyName(kPolicyDefaultJavaScriptSetting)); | 939 key::kDefaultJavaScriptSetting); |
| 930 } | 940 } |
| 931 | 941 |
| 932 return true; | 942 return true; |
| 933 } | 943 } |
| 934 | 944 |
| 935 void JavascriptPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, | 945 void JavascriptPolicyHandler::ApplyPolicySettings(const PolicyMap& policies, |
| 936 PrefValueMap* prefs) { | 946 PrefValueMap* prefs) { |
| 937 int setting = CONTENT_SETTING_DEFAULT; | 947 int setting = CONTENT_SETTING_DEFAULT; |
| 938 const Value* default_setting = policies.Get(kPolicyDefaultJavaScriptSetting); | 948 const Value* default_setting = |
| 949 policies.GetValue(key::kDefaultJavaScriptSetting); | |
| 939 | 950 |
| 940 if (default_setting) { | 951 if (default_setting) { |
| 941 default_setting->GetAsInteger(&setting); | 952 default_setting->GetAsInteger(&setting); |
| 942 } else { | 953 } else { |
| 943 const Value* javascript_enabled = policies.Get(kPolicyJavascriptEnabled); | 954 const Value* javascript_enabled = |
| 955 policies.GetValue(key::kJavascriptEnabled); | |
| 944 bool enabled = true; | 956 bool enabled = true; |
| 945 if (javascript_enabled && | 957 if (javascript_enabled && |
| 946 javascript_enabled->GetAsBoolean(&enabled) && | 958 javascript_enabled->GetAsBoolean(&enabled) && |
| 947 !enabled) { | 959 !enabled) { |
| 948 setting = CONTENT_SETTING_BLOCK; | 960 setting = CONTENT_SETTING_BLOCK; |
| 949 } | 961 } |
| 950 } | 962 } |
| 951 | 963 |
| 952 if (setting != CONTENT_SETTING_DEFAULT) { | 964 if (setting != CONTENT_SETTING_DEFAULT) { |
| 953 prefs->SetValue(prefs::kManagedDefaultJavaScriptSetting, | 965 prefs->SetValue(prefs::kManagedDefaultJavaScriptSetting, |
| 954 Value::CreateIntegerValue(setting)); | 966 Value::CreateIntegerValue(setting)); |
| 955 } | 967 } |
| 956 } | 968 } |
| 957 | 969 |
| 958 } // namespace policy | 970 } // namespace policy |
| OLD | NEW |