OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UPDATER_H_ | 5 #ifndef CHROME_BROWSER_PLUGIN_UPDATER_H_ |
6 #define CHROME_BROWSER_PLUGIN_UPDATER_H_ | 6 #define CHROME_BROWSER_PLUGIN_UPDATER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
14 #include "base/memory/singleton.h" | 14 #include "base/memory/singleton.h" |
15 #include "chrome/browser/prefs/pref_change_registrar.h" | 15 #include "chrome/browser/prefs/pref_change_registrar.h" |
16 #include "content/common/notification_observer.h" | 16 #include "content/common/notification_observer.h" |
17 | 17 |
18 class DictionaryValue; | |
19 class ListValue; | |
20 class NotificationDetails; | 18 class NotificationDetails; |
21 class NotificationSource; | 19 class NotificationSource; |
22 class Profile; | 20 class Profile; |
23 | 21 |
| 22 namespace base { |
| 23 class DictionaryValue; |
| 24 class ListValue; |
| 25 } |
| 26 |
24 namespace webkit { | 27 namespace webkit { |
25 namespace npapi { | 28 namespace npapi { |
26 class PluginGroup; | 29 class PluginGroup; |
27 struct WebPluginInfo; | 30 struct WebPluginInfo; |
28 } | 31 } |
29 } | 32 } |
30 | 33 |
31 class PluginUpdater : public NotificationObserver { | 34 class PluginUpdater : public NotificationObserver { |
32 public: | 35 public: |
33 // Get a list of all the plugin groups. The caller should take ownership | 36 // Get a list of all the plugin groups. The caller should take ownership |
34 // of the returned ListValue. | 37 // of the returned ListValue. |
35 static ListValue* GetPluginGroupsData(); | 38 static base::ListValue* GetPluginGroupsData(); |
36 | 39 |
37 // Enable or disable a plugin group. | 40 // Enable or disable a plugin group. |
38 void EnablePluginGroup(bool enable, const string16& group_name); | 41 void EnablePluginGroup(bool enable, const string16& group_name); |
39 | 42 |
40 // Enable or disable a specific plugin file. | 43 // Enable or disable a specific plugin file. |
41 void EnablePlugin(bool enable, const FilePath::StringType& file_path); | 44 void EnablePlugin(bool enable, const FilePath::StringType& file_path); |
42 | 45 |
43 // Associates the PluginUpdater with |profile|. This enables or disables | 46 // Associates the PluginUpdater with |profile|. This enables or disables |
44 // plugin groups as defined by the user's preferences. | 47 // plugin groups as defined by the user's preferences. |
45 void SetProfile(Profile* profile); | 48 void SetProfile(Profile* profile); |
(...skipping 27 matching lines...) Expand all Loading... |
73 const std::vector<webkit::npapi::WebPluginInfo>& plugins, | 76 const std::vector<webkit::npapi::WebPluginInfo>& plugins, |
74 const std::vector<webkit::npapi::PluginGroup>& groups); | 77 const std::vector<webkit::npapi::PluginGroup>& groups); |
75 | 78 |
76 // Queues sending the notification that plugin data has changed. This is done | 79 // Queues sending the notification that plugin data has changed. This is done |
77 // so that if a bunch of changes happen, we only send one notification. | 80 // so that if a bunch of changes happen, we only send one notification. |
78 void NotifyPluginStatusChanged(); | 81 void NotifyPluginStatusChanged(); |
79 | 82 |
80 // Used for the post task to notify that plugin enabled status changed. | 83 // Used for the post task to notify that plugin enabled status changed. |
81 static void OnNotifyPluginStatusChanged(); | 84 static void OnNotifyPluginStatusChanged(); |
82 | 85 |
83 static DictionaryValue* CreatePluginFileSummary( | 86 static base::DictionaryValue* CreatePluginFileSummary( |
84 const webkit::npapi::WebPluginInfo& plugin); | 87 const webkit::npapi::WebPluginInfo& plugin); |
85 | 88 |
86 // Force plugins to be enabled or disabled due to policy. | 89 // Force plugins to be enabled or disabled due to policy. |
87 // |disabled_list| contains the list of StringValues of the names of the | 90 // |disabled_list| contains the list of StringValues of the names of the |
88 // policy-disabled plugins, |exceptions_list| the policy-allowed plugins, | 91 // policy-disabled plugins, |exceptions_list| the policy-allowed plugins, |
89 // and |enabled_list| the policy-enabled plugins. | 92 // and |enabled_list| the policy-enabled plugins. |
90 void UpdatePluginsStateFromPolicy(const ListValue* disabled_list, | 93 void UpdatePluginsStateFromPolicy(const base::ListValue* disabled_list, |
91 const ListValue* exceptions_list, | 94 const base::ListValue* exceptions_list, |
92 const ListValue* enabled_list); | 95 const base::ListValue* enabled_list); |
93 | 96 |
94 void ListValueToStringSet(const ListValue* src, std::set<string16>* dest); | 97 void ListValueToStringSet(const base::ListValue* src, |
| 98 std::set<string16>* dest); |
95 | 99 |
96 // Needed to allow singleton instantiation using private constructor. | 100 // Needed to allow singleton instantiation using private constructor. |
97 friend struct DefaultSingletonTraits<PluginUpdater>; | 101 friend struct DefaultSingletonTraits<PluginUpdater>; |
98 | 102 |
99 PrefChangeRegistrar registrar_; | 103 PrefChangeRegistrar registrar_; |
100 | 104 |
101 bool notify_pending_; | 105 bool notify_pending_; |
102 | 106 |
103 DISALLOW_COPY_AND_ASSIGN(PluginUpdater); | 107 DISALLOW_COPY_AND_ASSIGN(PluginUpdater); |
104 }; | 108 }; |
105 | 109 |
106 #endif // CHROME_BROWSER_PLUGIN_UPDATER_H_ | 110 #endif // CHROME_BROWSER_PLUGIN_UPDATER_H_ |
OLD | NEW |