OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/plugins/plugin_policy_handler.h" | 5 #include "chrome/browser/plugins/plugin_policy_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/strings/pattern.h" | 10 #include "base/strings/pattern.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 if (!plugins) | 48 if (!plugins) |
49 return; | 49 return; |
50 | 50 |
51 const int size = plugins->GetSize(); | 51 const int size = plugins->GetSize(); |
52 for (int i = 0; i < size; ++i) { | 52 for (int i = 0; i < size; ++i) { |
53 std::string plugin; | 53 std::string plugin; |
54 if (!plugins->GetString(i, &plugin)) | 54 if (!plugins->GetString(i, &plugin)) |
55 continue; | 55 continue; |
56 if (base::MatchPattern(ChromeContentClient::kPDFPluginName, plugin) && | 56 if (base::MatchPattern(ChromeContentClient::kPDFPluginName, plugin) && |
57 !policies.GetValue(policy::key::kAlwaysOpenPdfExternally)) { | 57 !policies.GetValue(policy::key::kAlwaysOpenPdfExternally)) { |
58 prefs->SetValue( | 58 prefs->SetValue(prefs::kPluginsAlwaysOpenPdfExternally, |
59 prefs::kPluginsAlwaysOpenPdfExternally, | 59 base::MakeUnique<base::Value>(disable_pdf_plugin)); |
60 base::MakeUnique<base::FundamentalValue>(disable_pdf_plugin)); | |
61 } | 60 } |
62 if ((base::MatchPattern( | 61 if ((base::MatchPattern( |
63 PluginMetadata::kAdobeFlashPlayerGroupName, plugin) || | 62 PluginMetadata::kAdobeFlashPlayerGroupName, plugin) || |
64 base::MatchPattern(content::kFlashPluginName, plugin)) && | 63 base::MatchPattern(content::kFlashPluginName, plugin)) && |
65 !policies.GetValue(policy::key::kDefaultPluginsSetting)) { | 64 !policies.GetValue(policy::key::kDefaultPluginsSetting)) { |
66 prefs->SetValue( | 65 prefs->SetValue(prefs::kManagedDefaultPluginsSetting, |
67 prefs::kManagedDefaultPluginsSetting, | 66 base::MakeUnique<base::Value>(flash_content_setting)); |
68 base::MakeUnique<base::FundamentalValue>(flash_content_setting)); | |
69 } | 67 } |
70 } | 68 } |
71 } | 69 } |
72 | 70 |
73 bool PluginPolicyHandler::CheckPolicySettings(const policy::PolicyMap& policies, | 71 bool PluginPolicyHandler::CheckPolicySettings(const policy::PolicyMap& policies, |
74 policy::PolicyErrorMap* errors) { | 72 policy::PolicyErrorMap* errors) { |
75 const std::string checked_policies[] = { | 73 const std::string checked_policies[] = { |
76 policy::key::kEnabledPlugins, policy::key::kDisabledPlugins, | 74 policy::key::kEnabledPlugins, policy::key::kDisabledPlugins, |
77 policy::key::kDisabledPluginsExceptions}; | 75 policy::key::kDisabledPluginsExceptions}; |
78 bool ok = true; | 76 bool ok = true; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 prefs->RemoveValue(prefs::kPluginsAlwaysOpenPdfExternally); | 109 prefs->RemoveValue(prefs::kPluginsAlwaysOpenPdfExternally); |
112 } | 110 } |
113 if ((base::MatchPattern( | 111 if ((base::MatchPattern( |
114 PluginMetadata::kAdobeFlashPlayerGroupName, plugin) || | 112 PluginMetadata::kAdobeFlashPlayerGroupName, plugin) || |
115 base::MatchPattern(content::kFlashPluginName, plugin)) && | 113 base::MatchPattern(content::kFlashPluginName, plugin)) && |
116 !policies.GetValue(policy::key::kDefaultPluginsSetting)) { | 114 !policies.GetValue(policy::key::kDefaultPluginsSetting)) { |
117 prefs->RemoveValue(prefs::kManagedDefaultPluginsSetting); | 115 prefs->RemoveValue(prefs::kManagedDefaultPluginsSetting); |
118 } | 116 } |
119 } | 117 } |
120 } | 118 } |
OLD | NEW |