forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable NPAPI if policy has plugin policies.
BUG=472648 TEST=manual - verify that NPAPI plugins appear in chrome://plugins when either a machine or user plugin policy is set. Review URL: https://codereview.chromium.org/1071713004 Cr-Commit-Position: refs/heads/master@{#324754}
- Loading branch information
1 parent
cd7a39a
commit 26d09db
Showing
17 changed files
with
140 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
chrome/browser/plugins/enable_npapi_plugins_policy_handler.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2015 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/enable_npapi_plugins_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 { | ||
|
||
EnableNpapiPluginsPolicyHandler::EnableNpapiPluginsPolicyHandler() { | ||
} | ||
|
||
EnableNpapiPluginsPolicyHandler::~EnableNpapiPluginsPolicyHandler() { | ||
} | ||
|
||
void EnableNpapiPluginsPolicyHandler::ApplyPolicySettings( | ||
const PolicyMap& policies, | ||
PrefValueMap* prefs) { | ||
const std::string plugin_policies[] = {key::kEnabledPlugins, | ||
key::kPluginsAllowedForUrls, | ||
key::kPluginsBlockedForUrls, | ||
key::kDisabledPluginsExceptions, | ||
key::kDisabledPlugins}; | ||
|
||
for (auto policy : plugin_policies) { | ||
if (policies.GetValue(policy)) { | ||
prefs->SetBoolean(prefs::kEnableNpapi, true); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
bool EnableNpapiPluginsPolicyHandler::CheckPolicySettings( | ||
const PolicyMap& policies, | ||
PolicyErrorMap* prefs) { | ||
return true; | ||
} | ||
|
||
} // namespace policy |
37 changes: 37 additions & 0 deletions
37
chrome/browser/plugins/enable_npapi_plugins_policy_handler.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Copyright 2015 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. | ||
|
||
#ifndef CHROME_BROWSER_PLUGINS_ENABLE_NPAPI_PLUGINS_POLICY_HANDLER_H_ | ||
#define CHROME_BROWSER_PLUGINS_ENABLE_NPAPI_PLUGINS_POLICY_HANDLER_H_ | ||
|
||
#include "base/macros.h" | ||
#include "components/policy/core/browser/configuration_policy_handler.h" | ||
|
||
class PrefValueMap; | ||
|
||
namespace policy { | ||
|
||
class PolicyErrorMap; | ||
class PolicyMap; | ||
|
||
// ConfigurationPolicyHandler for the plugin policies that re-enable NPAPI. | ||
class EnableNpapiPluginsPolicyHandler : public ConfigurationPolicyHandler { | ||
public: | ||
EnableNpapiPluginsPolicyHandler(); | ||
|
||
~EnableNpapiPluginsPolicyHandler() override; | ||
|
||
// ConfigurationPolicyHandler methods: | ||
void ApplyPolicySettings(const PolicyMap& policies, | ||
PrefValueMap* prefs) override; | ||
// ConfigurationPolicyHandler methods: | ||
bool CheckPolicySettings(const PolicyMap& policies, | ||
PolicyErrorMap* prefs) override; | ||
|
||
DISALLOW_COPY_AND_ASSIGN(EnableNpapiPluginsPolicyHandler); | ||
}; | ||
|
||
} // namespace policy | ||
|
||
#endif // CHROME_BROWSER_PLUGINS_ENABLE_NPAPI_PLUGINS_POLICY_HANDLER_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters