| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_browser_policy_connector.h" | 5 #include "chrome/browser/policy/chrome_browser_policy_connector.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 scoped_ptr<DeviceManagementService::Configuration> configuration( | 81 scoped_ptr<DeviceManagementService::Configuration> configuration( |
| 82 new DeviceManagementServiceConfiguration( | 82 new DeviceManagementServiceConfiguration( |
| 83 BrowserPolicyConnector::GetDeviceManagementUrl())); | 83 BrowserPolicyConnector::GetDeviceManagementUrl())); |
| 84 scoped_ptr<DeviceManagementService> device_management_service( | 84 scoped_ptr<DeviceManagementService> device_management_service( |
| 85 new DeviceManagementService(configuration.Pass())); | 85 new DeviceManagementService(configuration.Pass())); |
| 86 device_management_service->ScheduleInitialization( | 86 device_management_service->ScheduleInitialization( |
| 87 kServiceInitializationStartupDelay); | 87 kServiceInitializationStartupDelay); |
| 88 | 88 |
| 89 BrowserPolicyConnector::Init( | 89 BrowserPolicyConnector::Init( |
| 90 local_state, request_context, device_management_service.Pass()); | 90 local_state, request_context, device_management_service.Pass()); |
| 91 | |
| 92 AppendExtraFlagsPerPolicy(); | |
| 93 } | 91 } |
| 94 | 92 |
| 95 ConfigurationPolicyProvider* | 93 ConfigurationPolicyProvider* |
| 96 ChromeBrowserPolicyConnector::CreatePlatformProvider() { | 94 ChromeBrowserPolicyConnector::CreatePlatformProvider() { |
| 97 #if defined(OS_WIN) | 95 #if defined(OS_WIN) |
| 98 scoped_ptr<AsyncPolicyLoader> loader(PolicyLoaderWin::Create( | 96 scoped_ptr<AsyncPolicyLoader> loader(PolicyLoaderWin::Create( |
| 99 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), | 97 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE), |
| 100 kRegistryChromePolicyKey)); | 98 kRegistryChromePolicyKey)); |
| 101 return new AsyncPolicyProvider(GetSchemaRegistry(), loader.Pass()); | 99 return new AsyncPolicyProvider(GetSchemaRegistry(), loader.Pass()); |
| 102 #elif defined(OS_MACOSX) | 100 #elif defined(OS_MACOSX) |
| (...skipping 13 matching lines...) Expand all Loading... |
| 116 } else { | 114 } else { |
| 117 return NULL; | 115 return NULL; |
| 118 } | 116 } |
| 119 #elif defined(OS_ANDROID) | 117 #elif defined(OS_ANDROID) |
| 120 return new PolicyProviderAndroid(); | 118 return new PolicyProviderAndroid(); |
| 121 #else | 119 #else |
| 122 return NULL; | 120 return NULL; |
| 123 #endif | 121 #endif |
| 124 } | 122 } |
| 125 | 123 |
| 126 void ChromeBrowserPolicyConnector::AppendExtraFlagsPerPolicy() { | |
| 127 PolicyService* policy_service = GetPolicyService(); | |
| 128 PolicyNamespace chrome_ns = PolicyNamespace(POLICY_DOMAIN_CHROME, ""); | |
| 129 const PolicyMap& chrome_policy = policy_service->GetPolicies(chrome_ns); | |
| 130 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
| 131 | |
| 132 if (command_line->HasSwitch(switches::kEnableNpapi)) | |
| 133 return; | |
| 134 | |
| 135 // The list of Plugin related policies that re-enable NPAPI. Remove once NPAPI | |
| 136 // is dead. | |
| 137 const std::string plugin_policies[] = { key::kEnabledPlugins, | |
| 138 key::kPluginsAllowedForUrls, | |
| 139 key::kPluginsBlockedForUrls, | |
| 140 key::kDisabledPluginsExceptions, | |
| 141 key::kDisabledPlugins }; | |
| 142 for (auto policy : plugin_policies) { | |
| 143 if (chrome_policy.GetValue(policy)) { | |
| 144 command_line->AppendSwitch(switches::kEnableNpapi); | |
| 145 break; | |
| 146 } | |
| 147 } | |
| 148 } | |
| 149 | |
| 150 } // namespace policy | 124 } // namespace policy |
| OLD | NEW |