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

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

Issue 8480003: Surface error messages from ONC parsing in about:policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only compile unit test for chromium os. Created 9 years, 1 month 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_handler_chromeos.cc
diff --git a/chrome/browser/policy/configuration_policy_handler_chromeos.cc b/chrome/browser/policy/configuration_policy_handler_chromeos.cc
new file mode 100644
index 0000000000000000000000000000000000000000..fce769b1292b1a0931552ab536be97d51fb7e3af
--- /dev/null
+++ b/chrome/browser/policy/configuration_policy_handler_chromeos.cc
@@ -0,0 +1,47 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/policy/configuration_policy_handler_chromeos.h"
+
+#include <string>
+
+#include "chrome/browser/chromeos/cros/onc_network_parser.h"
+#include "chrome/browser/policy/policy_error_map.h"
+#include "grit/generated_resources.h"
+
+namespace policy {
+
+NetworkConfigurationPolicyHandler::NetworkConfigurationPolicyHandler(
+ ConfigurationPolicyType type)
+ : TypeCheckingPolicyHandler(type, Value::TYPE_STRING) {}
+
+NetworkConfigurationPolicyHandler::~NetworkConfigurationPolicyHandler() {}
+
+bool NetworkConfigurationPolicyHandler::CheckPolicySettings(
+ const PolicyMap* policies,
+ PolicyErrorMap* errors) {
+ const Value* value;
+ if (!TypeCheckingPolicyHandler::CheckAndGetValue(policies, errors, &value))
+ return false;
+
+ if (value) {
+ std::string onc_blob;
+ value->GetAsString(&onc_blob);
+ chromeos::OncNetworkParser parser(onc_blob);
+ if (!parser.parse_error().empty()) {
+ errors->AddError(policy_type(),
+ IDS_POLICY_NETWORK_CONFIG_PARSE_ERROR,
+ parser.parse_error());
+ return false;
+ }
+ }
+
+ return true;
+}
+
+void NetworkConfigurationPolicyHandler::ApplyPolicySettings(
+ const PolicyMap* policies,
+ PrefValueMap* prefs) {}
+
+} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698