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 NotificationDetails; | 18 class NotificationDetails; |
19 class NotificationSource; | 19 class NotificationSource; |
20 class Profile; | 20 class Profile; |
21 | 21 |
22 namespace base { | 22 namespace base { |
23 class DictionaryValue; | 23 class DictionaryValue; |
24 class ListValue; | 24 class ListValue; |
25 } | 25 } |
26 | 26 |
27 namespace webkit { | 27 namespace webkit { |
| 28 struct WebPluginInfo; |
28 namespace npapi { | 29 namespace npapi { |
29 class PluginGroup; | 30 class PluginGroup; |
30 struct WebPluginInfo; | |
31 } | 31 } |
32 } | 32 } |
33 | 33 |
34 class PluginUpdater : public NotificationObserver { | 34 class PluginUpdater : public NotificationObserver { |
35 public: | 35 public: |
36 // 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 |
37 // of the returned ListValue. | 37 // of the returned ListValue. |
38 static base::ListValue* GetPluginGroupsData(); | 38 static base::ListValue* GetPluginGroupsData(); |
39 | 39 |
40 // Enable or disable a plugin group. | 40 // Enable or disable a plugin group. |
(...skipping 25 matching lines...) Expand all Loading... |
66 PluginUpdater(); | 66 PluginUpdater(); |
67 virtual ~PluginUpdater() {} | 67 virtual ~PluginUpdater() {} |
68 | 68 |
69 // Called on the file thread to get the data necessary to update the saved | 69 // Called on the file thread to get the data necessary to update the saved |
70 // preferences. The profile pointer is only to be passed to the UI thread. | 70 // preferences. The profile pointer is only to be passed to the UI thread. |
71 static void GetPreferencesDataOnFileThread(void* profile); | 71 static void GetPreferencesDataOnFileThread(void* profile); |
72 | 72 |
73 // Called on the UI thread with the plugin data to save the preferences. | 73 // Called on the UI thread with the plugin data to save the preferences. |
74 static void OnUpdatePreferences( | 74 static void OnUpdatePreferences( |
75 Profile* profile, | 75 Profile* profile, |
76 const std::vector<webkit::npapi::WebPluginInfo>& plugins, | 76 const std::vector<webkit::WebPluginInfo>& plugins, |
77 const std::vector<webkit::npapi::PluginGroup>& groups); | 77 const std::vector<webkit::npapi::PluginGroup>& groups); |
78 | 78 |
79 // 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 |
80 // 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. |
81 void NotifyPluginStatusChanged(); | 81 void NotifyPluginStatusChanged(); |
82 | 82 |
83 // 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. |
84 static void OnNotifyPluginStatusChanged(); | 84 static void OnNotifyPluginStatusChanged(); |
85 | 85 |
86 static base::DictionaryValue* CreatePluginFileSummary( | 86 static base::DictionaryValue* CreatePluginFileSummary( |
87 const webkit::npapi::WebPluginInfo& plugin); | 87 const webkit::WebPluginInfo& plugin); |
88 | 88 |
89 // Force plugins to be enabled or disabled due to policy. | 89 // Force plugins to be enabled or disabled due to policy. |
90 // |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 |
91 // policy-disabled plugins, |exceptions_list| the policy-allowed plugins, | 91 // policy-disabled plugins, |exceptions_list| the policy-allowed plugins, |
92 // and |enabled_list| the policy-enabled plugins. | 92 // and |enabled_list| the policy-enabled plugins. |
93 void UpdatePluginsStateFromPolicy(const base::ListValue* disabled_list, | 93 void UpdatePluginsStateFromPolicy(const base::ListValue* disabled_list, |
94 const base::ListValue* exceptions_list, | 94 const base::ListValue* exceptions_list, |
95 const base::ListValue* enabled_list); | 95 const base::ListValue* enabled_list); |
96 | 96 |
97 void ListValueToStringSet(const base::ListValue* src, | 97 void ListValueToStringSet(const base::ListValue* src, |
98 std::set<string16>* dest); | 98 std::set<string16>* dest); |
99 | 99 |
100 // Needed to allow singleton instantiation using private constructor. | 100 // Needed to allow singleton instantiation using private constructor. |
101 friend struct DefaultSingletonTraits<PluginUpdater>; | 101 friend struct DefaultSingletonTraits<PluginUpdater>; |
102 | 102 |
103 PrefChangeRegistrar registrar_; | 103 PrefChangeRegistrar registrar_; |
104 | 104 |
105 bool notify_pending_; | 105 bool notify_pending_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(PluginUpdater); | 107 DISALLOW_COPY_AND_ASSIGN(PluginUpdater); |
108 }; | 108 }; |
109 | 109 |
110 #endif // CHROME_BROWSER_PLUGIN_UPDATER_H_ | 110 #endif // CHROME_BROWSER_PLUGIN_UPDATER_H_ |
OLD | NEW |