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

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

Issue 1071713004: Enable NPAPI if policy has plugin policies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win and mac only 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
« no previous file with comments | « chrome/browser/policy/profile_policy_connector.h ('k') | content/browser/plugin_service_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/profile_policy_connector.cc
diff --git a/chrome/browser/policy/profile_policy_connector.cc b/chrome/browser/policy/profile_policy_connector.cc
index 12b5b44e65566fd688605f7ba6298f9cdcd9f62b..1d35cbeaf03855c9e2e169b3e229f109b6a3c27a 100644
--- a/chrome/browser/policy/profile_policy_connector.cc
+++ b/chrome/browser/policy/profile_policy_connector.cc
@@ -7,6 +7,7 @@
#include <vector>
#include "base/bind.h"
+#include "base/command_line.h"
#include "base/logging.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
@@ -17,7 +18,10 @@
#include "components/policy/core/common/configuration_policy_provider.h"
#include "components/policy/core/common/policy_service_impl.h"
#include "components/policy/core/common/schema_registry_tracking_policy_provider.h"
+#include "content/public/browser/plugin_service.h"
+#include "content/public/common/content_switches.h"
#include "google_apis/gaia/gaia_auth_util.h"
+#include "policy/policy_constants.h"
#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
@@ -129,8 +133,38 @@ void ProfilePolicyConnector::Init(
connector->SetUserPolicyDelegate(special_user_policy_provider_.get());
}
#endif
+
+#if defined(OS_WIN) || defined(OS_MACOSX)
+ EnableNPAPIIfRequired();
+#endif
}
+#if defined(OS_WIN) || defined(OS_MACOSX)
+void ProfilePolicyConnector::EnableNPAPIIfRequired() {
Mattias Nissler (ping if slow) 2015/04/09 17:15:01 The canonical way to do this within the policy/pre
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+
+ if (command_line->HasSwitch(switches::kEnableNpapi))
+ return;
+
+ PolicyNamespace chrome_ns = PolicyNamespace(POLICY_DOMAIN_CHROME, "");
+ const PolicyMap& chrome_policy = policy_service_->GetPolicies(chrome_ns);
+
+ // The list of Plugin related policies that re-enable NPAPI. Remove once NPAPI
+ // is dead.
+ const std::string plugin_policies[] = { key::kEnabledPlugins,
+ key::kPluginsAllowedForUrls,
+ key::kPluginsBlockedForUrls,
+ key::kDisabledPluginsExceptions,
+ key::kDisabledPlugins };
+ for (auto policy : plugin_policies) {
+ if (chrome_policy.GetValue(policy)) {
+ content::PluginService::GetInstance()->EnableNpapiPlugins();
+ break;
+ }
+ }
+}
+#endif
+
void ProfilePolicyConnector::InitForTesting(scoped_ptr<PolicyService> service) {
policy_service_ = service.Pass();
}
« no previous file with comments | « chrome/browser/policy/profile_policy_connector.h ('k') | content/browser/plugin_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698