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

Unified Diff: chrome/browser/policy/configuration_policy_reader.cc

Issue 8413037: Display policy parsing errors in about:policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed extra byte, rebased Created 9 years, 2 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
Index: chrome/browser/policy/configuration_policy_reader.cc
diff --git a/chrome/browser/policy/configuration_policy_reader.cc b/chrome/browser/policy/configuration_policy_reader.cc
index 1854969dfdb65ff73bd16362ed3c16ea0b38db6c..20dea0f95b3addbab88700a0fab6d6d14339b67e 100644
--- a/chrome/browser/policy/configuration_policy_reader.cc
+++ b/chrome/browser/policy/configuration_policy_reader.cc
@@ -13,7 +13,9 @@
#include "base/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/policy/browser_policy_connector.h"
+#include "chrome/browser/policy/configuration_policy_handler.h"
#include "chrome/browser/policy/configuration_policy_pref_store.h"
+#include "chrome/browser/policy/policy_error_map.h"
#include "chrome/browser/policy/policy_map.h"
#include "policy/policy_constants.h"
@@ -70,23 +72,34 @@ DictionaryValue* ConfigurationPolicyStatusKeeper::GetPolicyStatus(
void ConfigurationPolicyStatusKeeper::GetPoliciesFromProvider(
ConfigurationPolicyProvider* provider) {
- scoped_ptr<PolicyMap> policies(new PolicyMap());
- if (!provider->Provide(policies.get()))
- LOG(WARNING) << "Failed to get policy from provider.";
+ PolicyMap policies;
+ if (!provider->Provide(&policies))
+ DLOG(WARNING) << "Failed to get policy from provider.";
- PolicyMap::const_iterator policy = policies->begin();
- for ( ; policy != policies->end(); ++policy) {
- string16 name = ASCIIToUTF16(GetPolicyName(policy->first));
+ const ConfigurationPolicyHandler::HandlerList* handlers =
+ g_browser_process->browser_policy_connector()->
+ GetConfigurationPolicyHandlerList();
+
+ PolicyErrorMap errors;
+ ConfigurationPolicyHandler::HandlerList::const_iterator handler;
+ for (handler = handlers->begin(); handler != handlers->end(); ++handler)
+ (*handler)->CheckPolicySettings(&policies, &errors);
- // TODO(simo) actually determine whether the policy is a user or a device
- // one and whether the policy could be enforced or not once this information
- // is available.
+ PolicyMap::const_iterator policy = policies.begin();
+ for ( ; policy != policies.end(); ++policy) {
+ string16 name = ASCIIToUTF16(GetPolicyName(policy->first));
+ string16 error_message = errors.GetErrors(policy->first);
+ PolicyStatusInfo::PolicyStatus status =
+ error_message.empty() ? PolicyStatusInfo::ENFORCED
+ : PolicyStatusInfo::FAILED;
+ // TODO(joaodasilva): determine whether this is a user or device policy.
+ // http://crbug.com/102114
PolicyStatusInfo* info = new PolicyStatusInfo(name,
PolicyStatusInfo::USER,
policy_level_,
policy->second->DeepCopy(),
- PolicyStatusInfo::ENFORCED,
- string16());
+ status,
+ error_message);
policy_map_[policy->first] = info;
}
}
@@ -214,7 +227,7 @@ void PolicyStatus::RemoveObserver(Observer* observer) const {
ListValue* PolicyStatus::GetPolicyStatusList(bool* any_policies_set) const {
ListValue* result = new ListValue();
- std::vector<DictionaryValue*> unsent_policies;
+ std::vector<DictionaryValue*> unset_policies;
*any_policies_set = false;
const PolicyDefinitionList* supported_policies =
@@ -228,15 +241,15 @@ ListValue* PolicyStatus::GetPolicyStatusList(bool* any_policies_set) const {
Value::CreateNullValue(),
PolicyStatusInfo::STATUS_UNDEFINED,
string16());
- unsent_policies.push_back(info.GetDictionaryValue());
+ unset_policies.push_back(info.GetDictionaryValue());
} else {
*any_policies_set = true;
}
}
// Add policies that weren't actually sent from providers to list.
- std::vector<DictionaryValue*>::const_iterator info = unsent_policies.begin();
- for ( ; info != unsent_policies.end(); ++info)
+ std::vector<DictionaryValue*>::const_iterator info = unset_policies.begin();
+ for ( ; info != unset_policies.end(); ++info)
result->Append(*info);
return result;
« no previous file with comments | « chrome/browser/policy/configuration_policy_handler.cc ('k') | chrome/browser/policy/configuration_policy_reader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698