Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: chrome/browser/plugin_data_remover_helper.h

Issue 10387161: Pepper Flash settings integration: add UI for "deauthorize content licenses". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes in response to Scott's suggestions Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 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_PLUGIN_DATA_REMOVER_HELPER_H_ 5 #ifndef CHROME_BROWSER_PLUGIN_DATA_REMOVER_HELPER_H_
6 #define CHROME_BROWSER_PLUGIN_DATA_REMOVER_HELPER_H_ 6 #define CHROME_BROWSER_PLUGIN_DATA_REMOVER_HELPER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <vector> 9 class PluginPrefs;
10 10
11 #include "base/memory/ref_counted.h" 11 class PluginDataRemoverHelper {
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/prefs/pref_member.h"
14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h"
16
17 class PluginPrefs;
18 class Profile;
19
20 namespace webkit {
21 struct WebPluginInfo;
22 }
23
24 // Helper class modeled after BooleanPrefMember to (asynchronously) update
25 // the preference specifying whether clearing plug-in data is supported
26 // by an installed plug-in.
27 // It should only be used from the UI thread. The client has to make sure that
28 // the passed profile outlives this object.
29 class PluginDataRemoverHelper : public content::NotificationObserver {
30 public: 12 public:
31 PluginDataRemoverHelper();
32 virtual ~PluginDataRemoverHelper();
33
34 // Binds this object to the |pref_name| preference in the profile's
35 // PrefService, notifying |observer| if the value changes.
36 // This asynchronously calls the PluginService to get the list of installed
37 // plug-ins.
38 void Init(const char* pref_name,
39 Profile* profile,
40 content::NotificationObserver* observer);
41
42 bool GetValue() const { return pref_.GetValue(); }
43
44 // Like PluginDataRemover::IsSupported, but checks that the returned plugin 13 // Like PluginDataRemover::IsSupported, but checks that the returned plugin
45 // is enabled by PluginPrefs 14 // is enabled by PluginPrefs.
46 static bool IsSupported(PluginPrefs* plugin_prefs); 15 static bool IsSupported(PluginPrefs* plugin_prefs);
47
48 // content::NotificationObserver methods:
49 virtual void Observe(int type,
50 const content::NotificationSource& source,
51 const content::NotificationDetails& details) OVERRIDE;
52
53 private:
54 void StartUpdate();
55 void GotPlugins(scoped_refptr<PluginPrefs> plugin_prefs,
56 const std::vector<webkit::WebPluginInfo>& plugins);
57
58 BooleanPrefMember pref_;
59 content::NotificationRegistrar registrar_;
60 // Weak pointer.
61 Profile* profile_;
62 base::WeakPtrFactory<PluginDataRemoverHelper> factory_;
63
64 DISALLOW_COPY_AND_ASSIGN(PluginDataRemoverHelper);
65 }; 16 };
66 17
67 #endif // CHROME_BROWSER_PLUGIN_DATA_REMOVER_HELPER_H_ 18 #endif // CHROME_BROWSER_PLUGIN_DATA_REMOVER_HELPER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698