OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/policy/profile_policy_connector.h" | 5 #include "chrome/browser/policy/profile_policy_connector.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | |
10 #include "base/logging.h" | 11 #include "base/logging.h" |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "chrome/browser/browser_process.h" | 13 #include "chrome/browser/browser_process.h" |
13 #include "components/policy/core/browser/browser_policy_connector.h" | 14 #include "components/policy/core/browser/browser_policy_connector.h" |
14 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 15 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
15 #include "components/policy/core/common/cloud/cloud_policy_manager.h" | 16 #include "components/policy/core/common/cloud/cloud_policy_manager.h" |
16 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 17 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
17 #include "components/policy/core/common/configuration_policy_provider.h" | 18 #include "components/policy/core/common/configuration_policy_provider.h" |
18 #include "components/policy/core/common/policy_service_impl.h" | 19 #include "components/policy/core/common/policy_service_impl.h" |
19 #include "components/policy/core/common/schema_registry_tracking_policy_provider .h" | 20 #include "components/policy/core/common/schema_registry_tracking_policy_provider .h" |
21 #include "content/public/browser/plugin_service.h" | |
22 #include "content/public/common/content_switches.h" | |
20 #include "google_apis/gaia/gaia_auth_util.h" | 23 #include "google_apis/gaia/gaia_auth_util.h" |
24 #include "policy/policy_constants.h" | |
21 | 25 |
22 #if defined(OS_CHROMEOS) | 26 #if defined(OS_CHROMEOS) |
23 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" | 27 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" |
24 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" | 28 #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" |
25 #include "chrome/browser/chromeos/policy/device_local_account_policy_provider.h" | 29 #include "chrome/browser/chromeos/policy/device_local_account_policy_provider.h" |
26 #include "chrome/browser/chromeos/policy/login_profile_policy_provider.h" | 30 #include "chrome/browser/chromeos/policy/login_profile_policy_provider.h" |
27 #include "components/user_manager/user.h" | 31 #include "components/user_manager/user.h" |
28 #include "components/user_manager/user_manager.h" | 32 #include "components/user_manager/user_manager.h" |
29 #endif | 33 #endif |
30 | 34 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 policy_service_.reset(new PolicyServiceImpl(providers)); | 126 policy_service_.reset(new PolicyServiceImpl(providers)); |
123 | 127 |
124 #if defined(OS_CHROMEOS) | 128 #if defined(OS_CHROMEOS) |
125 if (is_primary_user_) { | 129 if (is_primary_user_) { |
126 if (user_cloud_policy_manager) | 130 if (user_cloud_policy_manager) |
127 connector->SetUserPolicyDelegate(user_cloud_policy_manager); | 131 connector->SetUserPolicyDelegate(user_cloud_policy_manager); |
128 else if (special_user_policy_provider_) | 132 else if (special_user_policy_provider_) |
129 connector->SetUserPolicyDelegate(special_user_policy_provider_.get()); | 133 connector->SetUserPolicyDelegate(special_user_policy_provider_.get()); |
130 } | 134 } |
131 #endif | 135 #endif |
136 | |
137 #if defined(OS_WIN) || defined(OS_MACOSX) | |
138 EnableNPAPIIfRequired(); | |
139 #endif | |
132 } | 140 } |
133 | 141 |
142 #if defined(OS_WIN) || defined(OS_MACOSX) | |
143 void ProfilePolicyConnector::EnableNPAPIIfRequired() { | |
Mattias Nissler (ping if slow)
2015/04/09 17:15:01
The canonical way to do this within the policy/pre
| |
144 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
145 | |
146 if (command_line->HasSwitch(switches::kEnableNpapi)) | |
147 return; | |
148 | |
149 PolicyNamespace chrome_ns = PolicyNamespace(POLICY_DOMAIN_CHROME, ""); | |
150 const PolicyMap& chrome_policy = policy_service_->GetPolicies(chrome_ns); | |
151 | |
152 // The list of Plugin related policies that re-enable NPAPI. Remove once NPAPI | |
153 // is dead. | |
154 const std::string plugin_policies[] = { key::kEnabledPlugins, | |
155 key::kPluginsAllowedForUrls, | |
156 key::kPluginsBlockedForUrls, | |
157 key::kDisabledPluginsExceptions, | |
158 key::kDisabledPlugins }; | |
159 for (auto policy : plugin_policies) { | |
160 if (chrome_policy.GetValue(policy)) { | |
161 content::PluginService::GetInstance()->EnableNpapiPlugins(); | |
162 break; | |
163 } | |
164 } | |
165 } | |
166 #endif | |
167 | |
134 void ProfilePolicyConnector::InitForTesting(scoped_ptr<PolicyService> service) { | 168 void ProfilePolicyConnector::InitForTesting(scoped_ptr<PolicyService> service) { |
135 policy_service_ = service.Pass(); | 169 policy_service_ = service.Pass(); |
136 } | 170 } |
137 | 171 |
138 void ProfilePolicyConnector::Shutdown() { | 172 void ProfilePolicyConnector::Shutdown() { |
139 #if defined(OS_CHROMEOS) | 173 #if defined(OS_CHROMEOS) |
140 BrowserPolicyConnectorChromeOS* connector = | 174 BrowserPolicyConnectorChromeOS* connector = |
141 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 175 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
142 if (is_primary_user_) | 176 if (is_primary_user_) |
143 connector->SetUserPolicyDelegate(NULL); | 177 connector->SetUserPolicyDelegate(NULL); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
176 BrowserPolicyConnectorChromeOS* connector = | 210 BrowserPolicyConnectorChromeOS* connector = |
177 g_browser_process->platform_part()->browser_policy_connector_chromeos(); | 211 g_browser_process->platform_part()->browser_policy_connector_chromeos(); |
178 if (HasChromePolicy(connector->GetDeviceCloudPolicyManager(), name)) | 212 if (HasChromePolicy(connector->GetDeviceCloudPolicyManager(), name)) |
179 return false; | 213 return false; |
180 #endif | 214 #endif |
181 | 215 |
182 return true; | 216 return true; |
183 } | 217 } |
184 | 218 |
185 } // namespace policy | 219 } // namespace policy |
OLD | NEW |