| 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_STATUS_PREF_SETTER_H_ | 5 #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_STATUS_PREF_SETTER_H_ |
| 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_STATUS_PREF_SETTER_H_ | 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_STATUS_PREF_SETTER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/prefs/public/pref_observer.h" | |
| 13 #include "chrome/browser/api/prefs/pref_member.h" | 12 #include "chrome/browser/api/prefs/pref_member.h" |
| 14 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
| 15 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
| 16 | 15 |
| 17 class PluginPrefs; | 16 class PluginPrefs; |
| 18 class PrefService; | 17 class PrefService; |
| 19 class Profile; | 18 class Profile; |
| 20 | 19 |
| 21 namespace webkit { | 20 namespace webkit { |
| 22 struct WebPluginInfo; | 21 struct WebPluginInfo; |
| 23 } | 22 } |
| 24 | 23 |
| 25 // Helper class modeled after BooleanPrefMember to (asynchronously) update | 24 // Helper class modeled after BooleanPrefMember to (asynchronously) update |
| 26 // preferences related to plugin enable status. | 25 // preferences related to plugin enable status. |
| 27 // It should only be used from the UI thread. The client has to make sure that | 26 // It should only be used from the UI thread. The client has to make sure that |
| 28 // the passed profile outlives this object. | 27 // the passed profile outlives this object. |
| 29 class PluginStatusPrefSetter : public content::NotificationObserver { | 28 class PluginStatusPrefSetter : public content::NotificationObserver { |
| 30 public: | 29 public: |
| 31 PluginStatusPrefSetter(); | 30 PluginStatusPrefSetter(); |
| 32 virtual ~PluginStatusPrefSetter(); | 31 virtual ~PluginStatusPrefSetter(); |
| 33 | 32 |
| 34 // Binds the preferences in the profile's PrefService, notifying |observer| if | 33 // Binds the preferences in the profile's PrefService, notifying |observer| if |
| 35 // any value changes. | 34 // any value changes. |
| 36 // This asynchronously calls the PluginService to get the list of installed | 35 // This asynchronously calls the PluginService to get the list of installed |
| 37 // plug-ins. | 36 // plug-ins. |
| 38 void Init(Profile* profile, PrefObserver* observer); | 37 void Init(Profile* profile, |
| 38 const BooleanPrefMember::NamedChangeCallback& observer); |
| 39 | 39 |
| 40 bool IsClearPluginLSODataEnabled() const { | 40 bool IsClearPluginLSODataEnabled() const { |
| 41 return clear_plugin_lso_data_enabled_.GetValue(); | 41 return clear_plugin_lso_data_enabled_.GetValue(); |
| 42 } | 42 } |
| 43 | 43 |
| 44 bool IsPepperFlashSettingsEnabled() const { | 44 bool IsPepperFlashSettingsEnabled() const { |
| 45 return pepper_flash_settings_enabled_.GetValue(); | 45 return pepper_flash_settings_enabled_.GetValue(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 // content::NotificationObserver methods: | 48 // content::NotificationObserver methods: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 62 | 62 |
| 63 // Whether clearing LSO data is supported. | 63 // Whether clearing LSO data is supported. |
| 64 BooleanPrefMember clear_plugin_lso_data_enabled_; | 64 BooleanPrefMember clear_plugin_lso_data_enabled_; |
| 65 // Whether we should show Pepper Flash-specific settings. | 65 // Whether we should show Pepper Flash-specific settings. |
| 66 BooleanPrefMember pepper_flash_settings_enabled_; | 66 BooleanPrefMember pepper_flash_settings_enabled_; |
| 67 | 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(PluginStatusPrefSetter); | 68 DISALLOW_COPY_AND_ASSIGN(PluginStatusPrefSetter); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_STATUS_PREF_SETTER_H_ | 71 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_STATUS_PREF_SETTER_H_ |
| OLD | NEW |