Chromium Code Reviews| Index: chrome/browser/policy/configuration_policy_handler.cc |
| diff --git a/chrome/browser/policy/configuration_policy_handler.cc b/chrome/browser/policy/configuration_policy_handler.cc |
| index 5d4b25256035b9ffe75476799a2d9a45389a97bc..ca1441949a9e5daad8e54504e5193d3d8f33d3cc 100644 |
| --- a/chrome/browser/policy/configuration_policy_handler.cc |
| +++ b/chrome/browser/policy/configuration_policy_handler.cc |
| @@ -1240,26 +1240,24 @@ bool JavascriptPolicyHandler::CheckPolicySettings(const PolicyMap* policies, |
| const Value* javascript_enabled = policies->Get(kPolicyJavascriptEnabled); |
| const Value* default_setting = policies->Get(kPolicyDefaultJavaScriptSetting); |
| - if (javascript_enabled && !javascript_enabled->IsType(Value::TYPE_BOOLEAN)) { |
| + bool enabled = true; |
| + if (javascript_enabled && !javascript_enabled->GetAsBoolean(&enabled)) { |
| errors->AddError(kPolicyJavascriptEnabled, |
| IDS_POLICY_TYPE_ERROR, |
| ValueTypeToString(Value::TYPE_BOOLEAN)); |
| javascript_enabled = NULL; |
| } |
| - if (default_setting && !default_setting->IsType(Value::TYPE_INTEGER)) { |
| + int setting = CONTENT_SETTING_DEFAULT; |
| + if (default_setting && !default_setting->GetAsInteger(&setting)) { |
| errors->AddError(kPolicyDefaultJavaScriptSetting, |
| IDS_POLICY_TYPE_ERROR, |
| ValueTypeToString(Value::TYPE_INTEGER)); |
| default_setting = NULL; |
| } |
| - bool enabled; |
| - int setting; |
| if (javascript_enabled && |
| default_setting && |
| - javascript_enabled->GetAsBoolean(&enabled) && |
| - default_setting->GetAsInteger(&setting) && |
| !enabled && |
| setting != CONTENT_SETTING_BLOCK) { |
| errors->AddError(kPolicyDefaultJavaScriptSetting, |
| @@ -1279,18 +1277,17 @@ void JavascriptPolicyHandler::ApplyPolicySettings(const PolicyMap* policies, |
| default_setting->GetAsInteger(&setting); |
| bool enabled = true; |
| - if (javascript_enabled && javascript_enabled->GetAsBoolean(&enabled)) { |
| - prefs->SetValue(prefs::kWebKitJavascriptEnabled, |
| - javascript_enabled->DeepCopy()); |
| - // Force the javascript content setting to BLOCK when this policy disables |
| - // javascript globally. |
| - if (!enabled) |
| - setting = CONTENT_SETTING_BLOCK; |
| + if (javascript_enabled && |
| + javascript_enabled->GetAsBoolean(&enabled) && |
| + !enabled) { |
| + // This policy is deprecated, and currently overrides the content setting. |
|
Mattias Nissler (ping if slow)
2011/11/03 18:42:02
I would expect this to be the other way round. Is
Joao da Silva
2011/11/03 20:46:55
No particular reason for it. The other deprecated
|
| + setting = CONTENT_SETTING_BLOCK; |
| } |
| - if (setting != CONTENT_SETTING_DEFAULT) |
| + if (setting != CONTENT_SETTING_DEFAULT) { |
| prefs->SetValue(prefs::kManagedDefaultJavaScriptSetting, |
| Value::CreateIntegerValue(setting)); |
| + } |
| } |