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 #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_PREFS_H_ | 5 #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_PREFS_H_ |
6 #define CHROME_BROWSER_PLUGINS_PLUGIN_PREFS_H_ | 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_PREFS_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/synchronization/lock.h" | 14 #include "base/synchronization/lock.h" |
15 #include "chrome/browser/plugins/plugin_finder.h" | 15 #include "chrome/browser/plugins/plugin_finder.h" |
| 16 #include "chrome/common/chrome_content_client.h" |
16 #include "components/keyed_service/core/refcounted_keyed_service.h" | 17 #include "components/keyed_service/core/refcounted_keyed_service.h" |
17 #include "components/prefs/pref_change_registrar.h" | 18 #include "components/prefs/pref_change_registrar.h" |
18 #include "components/prefs/pref_service.h" | 19 #include "components/prefs/pref_service.h" |
19 | 20 |
20 class Profile; | 21 class Profile; |
21 | 22 |
22 namespace base { | 23 namespace base { |
23 class ListValue; | 24 class ListValue; |
24 } | 25 } |
25 | 26 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 std::map<base::FilePath, bool> state_; | 101 std::map<base::FilePath, bool> state_; |
101 }; | 102 }; |
102 | 103 |
103 ~PluginPrefs() override; | 104 ~PluginPrefs() override; |
104 | 105 |
105 // Called to update one of the policy_xyz patterns below when a | 106 // Called to update one of the policy_xyz patterns below when a |
106 // preference changes. | 107 // preference changes. |
107 void UpdatePatternsAndNotify(std::set<base::string16>* patterns, | 108 void UpdatePatternsAndNotify(std::set<base::string16>* patterns, |
108 const std::string& pref_name); | 109 const std::string& pref_name); |
109 | 110 |
| 111 // Callback for changes to the AlwaysOpenPdfExternally policy. |
| 112 void UpdatePdfPolicy(const std::string& pref_name); |
| 113 |
110 // Allows unit tests to directly set enforced plugin patterns. | 114 // Allows unit tests to directly set enforced plugin patterns. |
111 void SetPolicyEnforcedPluginPatterns( | 115 void SetPolicyEnforcedPluginPatternsForTests( |
112 const std::set<base::string16>& disabled_patterns, | 116 const std::set<base::string16>& disabled_patterns, |
113 const std::set<base::string16>& disabled_exception_patterns, | 117 const std::set<base::string16>& disabled_exception_patterns, |
114 const std::set<base::string16>& enabled_patterns); | 118 const std::set<base::string16>& enabled_patterns); |
115 | 119 |
| 120 // Allows unit tests to directly set the AlwaysOpenPdfExternally pref. |
| 121 void SetAlwaysOpenPdfExternallyForTests(bool always_open_pdf_externally); |
| 122 |
116 // Callback for after the plugin groups have been loaded. | 123 // Callback for after the plugin groups have been loaded. |
117 void EnablePluginGroupInternal( | 124 void EnablePluginGroupInternal( |
118 bool enabled, | 125 bool enabled, |
119 const base::string16& group_name, | 126 const base::string16& group_name, |
120 const std::vector<content::WebPluginInfo>& plugins); | 127 const std::vector<content::WebPluginInfo>& plugins); |
121 void EnablePluginInternal( | 128 void EnablePluginInternal( |
122 bool enabled, | 129 bool enabled, |
123 const base::FilePath& path, | 130 const base::FilePath& path, |
124 PluginFinder* plugin_finder, | 131 PluginFinder* plugin_finder, |
125 const base::Callback<void(bool)>& callback, | 132 const base::Callback<void(bool)>& callback, |
(...skipping 14 matching lines...) Expand all Loading... |
140 | 147 |
141 // Guards access to the following data structures. | 148 // Guards access to the following data structures. |
142 mutable base::Lock lock_; | 149 mutable base::Lock lock_; |
143 | 150 |
144 PluginState plugin_state_; | 151 PluginState plugin_state_; |
145 std::map<base::string16, bool> plugin_group_state_; | 152 std::map<base::string16, bool> plugin_group_state_; |
146 | 153 |
147 std::set<base::string16> policy_disabled_plugin_patterns_; | 154 std::set<base::string16> policy_disabled_plugin_patterns_; |
148 std::set<base::string16> policy_disabled_plugin_exception_patterns_; | 155 std::set<base::string16> policy_disabled_plugin_exception_patterns_; |
149 std::set<base::string16> policy_enabled_plugin_patterns_; | 156 std::set<base::string16> policy_enabled_plugin_patterns_; |
| 157 bool always_open_pdf_externally_; |
150 | 158 |
151 // Weak pointer, owns us. Only used as a notification source. | 159 // Weak pointer, owns us. Only used as a notification source. |
152 Profile* profile_; | 160 Profile* profile_; |
153 | 161 |
154 // Weak pointer, owned by the profile. | 162 // Weak pointer, owned by the profile. |
155 PrefService* prefs_; | 163 PrefService* prefs_; |
156 | 164 |
157 PrefChangeRegistrar registrar_; | 165 PrefChangeRegistrar registrar_; |
158 | 166 |
159 DISALLOW_COPY_AND_ASSIGN(PluginPrefs); | 167 DISALLOW_COPY_AND_ASSIGN(PluginPrefs); |
160 }; | 168 }; |
161 | 169 |
162 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_PREFS_H_ | 170 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_PREFS_H_ |
OLD | NEW |