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

Unified Diff: chrome/browser/plugins/plugin_policy_handler.cc

Issue 1071713004: Enable NPAPI if policy has plugin policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add missing files Created 5 years, 8 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/plugins/plugin_policy_handler.cc
diff --git a/chrome/browser/plugins/plugin_policy_handler.cc b/chrome/browser/plugins/plugin_policy_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..060782151fd9aa4cf846918301c4cd701813f084
--- /dev/null
+++ b/chrome/browser/plugins/plugin_policy_handler.cc
@@ -0,0 +1,38 @@
+// Copyright 2013 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/plugins/plugin_policy_handler.h"
+
+#include "base/logging.h"
+#include "base/prefs/pref_value_map.h"
+#include "base/values.h"
+#include "chrome/common/pref_names.h"
+#include "components/policy/core/browser/policy_error_map.h"
+#include "components/policy/core/common/policy_map.h"
+#include "policy/policy_constants.h"
+
+namespace policy {
+
+PluginPolicyHandler::PluginPolicyHandler(
+ const char* policy_name,
+ const char* pref_path,
+ base::Value::Type value_type)
+ : TypeCheckingPolicyHandler(policy_name, value_type),
+ pref_path_(pref_path) {
+}
+
+PluginPolicyHandler::~PluginPolicyHandler() {}
+
+void PluginPolicyHandler::ApplyPolicySettings(const PolicyMap& policies,
+ PrefValueMap* prefs) {
+ if (!pref_path_)
+ return;
+ const base::Value* value = policies.GetValue(policy_name());
+ if (value) {
+ prefs->SetBoolean(prefs::kEnableNpapi, true);
Mattias Nissler (ping if slow) 2015/04/10 08:47:15 You have multiple instances of this policy handler
Will Harris 2015/04/10 18:51:23 Done.
+ prefs->SetValue(pref_path_, value->DeepCopy());
+ }
+}
+
+} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698