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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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( |
59 prefs::kPluginsAlwaysOpenPdfExternally, | 59 prefs::kPluginsAlwaysOpenPdfExternally, |
60 base::MakeUnique<base::FundamentalValue>(disable_pdf_plugin)); | 60 base::MakeUnique<base::Value>(disable_pdf_plugin)); |
61 } | 61 } |
62 if ((base::MatchPattern( | 62 if ((base::MatchPattern( |
63 PluginMetadata::kAdobeFlashPlayerGroupName, plugin) || | 63 PluginMetadata::kAdobeFlashPlayerGroupName, plugin) || |
64 base::MatchPattern(content::kFlashPluginName, plugin)) && | 64 base::MatchPattern(content::kFlashPluginName, plugin)) && |
65 !policies.GetValue(policy::key::kDefaultPluginsSetting)) { | 65 !policies.GetValue(policy::key::kDefaultPluginsSetting)) { |
66 prefs->SetValue( | 66 prefs->SetValue( |
67 prefs::kManagedDefaultPluginsSetting, | 67 prefs::kManagedDefaultPluginsSetting, |
68 base::MakeUnique<base::FundamentalValue>(flash_content_setting)); | 68 base::MakeUnique<base::Value>(flash_content_setting)); |
69 } | 69 } |
70 } | 70 } |
71 } | 71 } |
72 | 72 |
73 bool PluginPolicyHandler::CheckPolicySettings(const policy::PolicyMap& policies, | 73 bool PluginPolicyHandler::CheckPolicySettings(const policy::PolicyMap& policies, |
74 policy::PolicyErrorMap* errors) { | 74 policy::PolicyErrorMap* errors) { |
75 const std::string checked_policies[] = { | 75 const std::string checked_policies[] = { |
76 policy::key::kEnabledPlugins, policy::key::kDisabledPlugins, | 76 policy::key::kEnabledPlugins, policy::key::kDisabledPlugins, |
77 policy::key::kDisabledPluginsExceptions}; | 77 policy::key::kDisabledPluginsExceptions}; |
78 bool ok = true; | 78 bool ok = true; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 prefs->RemoveValue(prefs::kPluginsAlwaysOpenPdfExternally); | 111 prefs->RemoveValue(prefs::kPluginsAlwaysOpenPdfExternally); |
112 } | 112 } |
113 if ((base::MatchPattern( | 113 if ((base::MatchPattern( |
114 PluginMetadata::kAdobeFlashPlayerGroupName, plugin) || | 114 PluginMetadata::kAdobeFlashPlayerGroupName, plugin) || |
115 base::MatchPattern(content::kFlashPluginName, plugin)) && | 115 base::MatchPattern(content::kFlashPluginName, plugin)) && |
116 !policies.GetValue(policy::key::kDefaultPluginsSetting)) { | 116 !policies.GetValue(policy::key::kDefaultPluginsSetting)) { |
117 prefs->RemoveValue(prefs::kManagedDefaultPluginsSetting); | 117 prefs->RemoveValue(prefs::kManagedDefaultPluginsSetting); |
118 } | 118 } |
119 } | 119 } |
120 } | 120 } |
OLD | NEW |