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

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 Chris' 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 #include <string>
10 10
11 #include "base/memory/ref_counted.h" 11 #include "base/basictypes.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/compiler_specific.h"
13 #include "chrome/browser/prefs/pref_member.h" 13 #include "chrome/browser/plugin_status_pref_setter.h"
14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h"
16 14
17 class PluginPrefs; 15 class PluginPrefs;
18 class Profile;
19 16
20 namespace webkit { 17 // Helper class to (asynchronously) update the preference specifying whether
brettw 2012/05/20 21:15:40 I don't get the point of this class, and I don't s
yzshen1 2012/05/21 16:58:44 The 'async' part is moved into PluginStatusPrefSet
21 struct WebPluginInfo; 18 // clearing plug-in data is supported by an installed plug-in.
22 } 19 class PluginDataRemoverHelper : public PluginStatusPrefSetter::Client {
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: 20 public:
31 PluginDataRemoverHelper(); 21 explicit PluginDataRemoverHelper(const char* pref_name);
32 virtual ~PluginDataRemoverHelper(); 22 virtual ~PluginDataRemoverHelper();
33 23
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 24 // Like PluginDataRemover::IsSupported, but checks that the returned plugin
45 // is enabled by PluginPrefs 25 // is enabled by PluginPrefs.
46 static bool IsSupported(PluginPrefs* plugin_prefs); 26 static bool IsSupported(PluginPrefs* plugin_prefs);
47 27
48 // content::NotificationObserver methods: 28 // PluginStatusPrefSetter::Client implementation.
49 virtual void Observe(int type, 29 virtual const char* GetPrefName() const OVERRIDE;
50 const content::NotificationSource& source, 30 virtual bool CalculatePrefValue(PluginPrefs* plugin_prefs) OVERRIDE;
51 const content::NotificationDetails& details) OVERRIDE;
52 31
53 private: 32 private:
54 void StartUpdate(); 33 std::string pref_name_;
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 34
64 DISALLOW_COPY_AND_ASSIGN(PluginDataRemoverHelper); 35 DISALLOW_COPY_AND_ASSIGN(PluginDataRemoverHelper);
65 }; 36 };
66 37
67 #endif // CHROME_BROWSER_PLUGIN_DATA_REMOVER_HELPER_H_ 38 #endif // CHROME_BROWSER_PLUGIN_DATA_REMOVER_HELPER_H_
OLDNEW
« no previous file with comments | « chrome/browser/pepper_flash_settings_manager.cc ('k') | chrome/browser/plugin_data_remover_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698