| 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> | 
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 125       const std::set<string16>& disabled_exception_patterns, | 125       const std::set<string16>& disabled_exception_patterns, | 
| 126       const std::set<string16>& enabled_patterns); | 126       const std::set<string16>& enabled_patterns); | 
| 127 | 127 | 
| 128   // Returns the plugin list to use, either the singleton or the override. | 128   // Returns the plugin list to use, either the singleton or the override. | 
| 129   webkit::npapi::PluginList* GetPluginList() const; | 129   webkit::npapi::PluginList* GetPluginList() const; | 
| 130 | 130 | 
| 131   // Callback for after the plugin groups have been loaded. | 131   // Callback for after the plugin groups have been loaded. | 
| 132   void EnablePluginGroupInternal( | 132   void EnablePluginGroupInternal( | 
| 133       bool enabled, | 133       bool enabled, | 
| 134       const string16& group_name, | 134       const string16& group_name, | 
| 135       PluginFinder* plugin_finder, |  | 
| 136       const std::vector<webkit::WebPluginInfo>& plugins); | 135       const std::vector<webkit::WebPluginInfo>& plugins); | 
| 137   void EnablePluginInternal( | 136   void EnablePluginInternal( | 
| 138       bool enabled, | 137       bool enabled, | 
| 139       const FilePath& path, | 138       const FilePath& path, | 
| 140       PluginFinder* plugin_finder, | 139       PluginFinder* plugin_finder, | 
| 141       const base::Callback<void(bool)>& callback, | 140       const base::Callback<void(bool)>& callback, | 
| 142       const std::vector<webkit::WebPluginInfo>& plugins); | 141       const std::vector<webkit::WebPluginInfo>& plugins); | 
| 143 | 142 | 
| 144   // Called on the file thread to get the data necessary to update the saved | 143   // Called on the file thread to get the data necessary to update the saved | 
| 145   // preferences. | 144   // preferences. | 
| 146   void GetPreferencesDataOnFileThread(); | 145   void GetPreferencesDataOnFileThread(); | 
| 147 | 146 | 
| 148   // Called on the UI thread with the plugin data to save the preferences. | 147   // Called on the UI thread with the plugin data to save the preferences. | 
| 149   void OnUpdatePreferences(const std::vector<webkit::WebPluginInfo>& plugins, | 148   void OnUpdatePreferences(const std::vector<webkit::WebPluginInfo>& plugins); | 
| 150                            PluginFinder* finder); |  | 
| 151 | 149 | 
| 152   // Sends the notification that plugin data has changed. | 150   // Sends the notification that plugin data has changed. | 
| 153   void NotifyPluginStatusChanged(); | 151   void NotifyPluginStatusChanged(); | 
| 154 | 152 | 
| 155   static void ListValueToStringSet(const base::ListValue* src, | 153   static void ListValueToStringSet(const base::ListValue* src, | 
| 156                                    std::set<string16>* dest); | 154                                    std::set<string16>* dest); | 
| 157 | 155 | 
| 158   // Checks if |name| matches any of the patterns in |pattern_set|. | 156   // Checks if |name| matches any of the patterns in |pattern_set|. | 
| 159   static bool IsStringMatchedInSet(const string16& name, | 157   static bool IsStringMatchedInSet(const string16& name, | 
| 160                                    const std::set<string16>& pattern_set); | 158                                    const std::set<string16>& pattern_set); | 
| 161 | 159 | 
| 162   // Callback method called by 'EnablePlugin' method. |  | 
| 163   // It performs the logic to check if a plug-in can be enabled. |  | 
| 164   void EnablePluginIfPossibleCallback( |  | 
| 165       bool enabled, const FilePath& path, |  | 
| 166       const base::Callback<void(bool)>& canEnableCallback, |  | 
| 167       PluginFinder* finder); |  | 
| 168 |  | 
| 169   // Callback method that takes in the asynchronously created |  | 
| 170   // plug-in finder instance. It is called by 'EnablePluginGroup'. |  | 
| 171   void GetPluginFinderForEnablePluginGroup(bool enabled, |  | 
| 172                                            const string16& group_name, |  | 
| 173                                            PluginFinder* finder); |  | 
| 174 |  | 
| 175   // Callback method that takes in the asynchronously created plug-in finder |  | 
| 176   // instance. It is called by 'GetPreferencesDataOnFileThread'. |  | 
| 177   void GetPluginFinderForGetPreferencesDataOnFileThread(PluginFinder* finder); |  | 
| 178 |  | 
| 179   // Guards access to the following data structures. | 160   // Guards access to the following data structures. | 
| 180   mutable base::Lock lock_; | 161   mutable base::Lock lock_; | 
| 181 | 162 | 
| 182   PluginState plugin_state_; | 163   PluginState plugin_state_; | 
| 183   std::map<string16, bool> plugin_group_state_; | 164   std::map<string16, bool> plugin_group_state_; | 
| 184 | 165 | 
| 185   std::set<string16> policy_disabled_plugin_patterns_; | 166   std::set<string16> policy_disabled_plugin_patterns_; | 
| 186   std::set<string16> policy_disabled_plugin_exception_patterns_; | 167   std::set<string16> policy_disabled_plugin_exception_patterns_; | 
| 187   std::set<string16> policy_enabled_plugin_patterns_; | 168   std::set<string16> policy_enabled_plugin_patterns_; | 
| 188 | 169 | 
| 189   // Weak pointer, owns us. Only used as a notification source. | 170   // Weak pointer, owns us. Only used as a notification source. | 
| 190   Profile* profile_; | 171   Profile* profile_; | 
| 191 | 172 | 
| 192   // Weak pointer, owned by the profile. | 173   // Weak pointer, owned by the profile. | 
| 193   PrefService* prefs_; | 174   PrefService* prefs_; | 
| 194 | 175 | 
| 195   // PluginList to use for testing. If this is NULL, defaults to the global | 176   // PluginList to use for testing. If this is NULL, defaults to the global | 
| 196   // singleton. | 177   // singleton. | 
| 197   webkit::npapi::PluginList* plugin_list_; | 178   webkit::npapi::PluginList* plugin_list_; | 
| 198 | 179 | 
| 199   PrefChangeRegistrar registrar_; | 180   PrefChangeRegistrar registrar_; | 
| 200 | 181 | 
| 201   DISALLOW_COPY_AND_ASSIGN(PluginPrefs); | 182   DISALLOW_COPY_AND_ASSIGN(PluginPrefs); | 
| 202 }; | 183 }; | 
| 203 | 184 | 
| 204 #endif  // CHROME_BROWSER_PLUGINS_PLUGIN_PREFS_H_ | 185 #endif  // CHROME_BROWSER_PLUGINS_PLUGIN_PREFS_H_ | 
| OLD | NEW | 
|---|