OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_PLUGIN_DATA_REMOVER_HELPER_H_ |
| 6 #define CHROME_BROWSER_PLUGIN_DATA_REMOVER_HELPER_H_ |
| 7 #pragma once |
| 8 |
| 9 #include "base/ref_counted.h" |
| 10 #include "chrome/browser/prefs/pref_member.h" |
| 11 #include "chrome/common/notification_observer.h" |
| 12 #include "chrome/common/notification_registrar.h" |
| 13 |
| 14 class Profile; |
| 15 |
| 16 // Helper class modeled after BooleanPrefMember to (asynchronously) update |
| 17 // the preference specifying whether clearing plug-in data is supported |
| 18 // by an installed plug-in. |
| 19 // It should only be used from the UI thread. The client has to make sure that |
| 20 // the passed PrefService outlives this object. |
| 21 class PluginDataRemoverHelper : public NotificationObserver { |
| 22 public: |
| 23 PluginDataRemoverHelper(); |
| 24 ~PluginDataRemoverHelper(); |
| 25 |
| 26 // Binds this object to the |pref_name| preference in |prefs|, notifying |
| 27 // |observer| if the value changes. |
| 28 // This fires off a request to the NPAPI::PluginList (via PluginDataRemover) |
| 29 // on the FILE thread to get the list of installed plug-ins. |
| 30 void Init(const char* pref_name, |
| 31 PrefService* prefs, |
| 32 NotificationObserver* observer); |
| 33 |
| 34 bool GetValue() const { return pref_.GetValue(); } |
| 35 |
| 36 // NotificationObserver methods: |
| 37 virtual void Observe(NotificationType type, |
| 38 const NotificationSource& source, |
| 39 const NotificationDetails& details); |
| 40 |
| 41 private: |
| 42 class Internal; |
| 43 |
| 44 BooleanPrefMember pref_; |
| 45 NotificationRegistrar registrar_; |
| 46 scoped_refptr<Internal> internal_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(PluginDataRemoverHelper); |
| 49 }; |
| 50 |
| 51 #endif // CHROME_BROWSER_PLUGIN_DATA_REMOVER_HELPER_H_ |
OLD | NEW |