| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
| 13 #include "base/singleton.h" | 13 #include "base/singleton.h" |
| 14 #include "chrome/common/notification_observer.h" | 14 #include "chrome/common/notification_observer.h" |
| 15 #include "webkit/glue/plugins/plugin_list.h" |
| 15 | 16 |
| 16 class DictionaryValue; | 17 class DictionaryValue; |
| 17 class ListValue; | 18 class ListValue; |
| 18 class NotificationDetails; | 19 class NotificationDetails; |
| 19 class NotificationSource; | 20 class NotificationSource; |
| 21 class PluginGroup; |
| 20 class Profile; | 22 class Profile; |
| 21 | |
| 22 namespace webkit { | |
| 23 namespace npapi { | |
| 24 class PluginGroup; | |
| 25 struct WebPluginInfo; | 23 struct WebPluginInfo; |
| 26 } | |
| 27 } | |
| 28 | 24 |
| 29 class PluginUpdater : public NotificationObserver { | 25 class PluginUpdater : public NotificationObserver { |
| 30 public: | 26 public: |
| 31 // Get a list of all the plugin groups. The caller should take ownership | 27 // Get a list of all the plugin groups. The caller should take ownership |
| 32 // of the returned ListValue. | 28 // of the returned ListValue. |
| 33 static ListValue* GetPluginGroupsData(); | 29 static ListValue* GetPluginGroupsData(); |
| 34 | 30 |
| 35 // Enable or disable a plugin group. | 31 // Enable or disable a plugin group. |
| 36 void EnablePluginGroup(bool enable, const string16& group_name); | 32 void EnablePluginGroup(bool enable, const string16& group_name); |
| 37 | 33 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 55 PluginUpdater(); | 51 PluginUpdater(); |
| 56 virtual ~PluginUpdater() {} | 52 virtual ~PluginUpdater() {} |
| 57 | 53 |
| 58 // Called on the file thread to get the data necessary to update the saved | 54 // Called on the file thread to get the data necessary to update the saved |
| 59 // preferences. The profile pointer is only to be passed to the UI thread. | 55 // preferences. The profile pointer is only to be passed to the UI thread. |
| 60 static void GetPreferencesDataOnFileThread(void* profile); | 56 static void GetPreferencesDataOnFileThread(void* profile); |
| 61 | 57 |
| 62 // Called on the UI thread with the plugin data to save the preferences. | 58 // Called on the UI thread with the plugin data to save the preferences. |
| 63 static void OnUpdatePreferences( | 59 static void OnUpdatePreferences( |
| 64 Profile* profile, | 60 Profile* profile, |
| 65 const std::vector<webkit::npapi::WebPluginInfo>& plugins, | 61 const std::vector<WebPluginInfo>& plugins, |
| 66 const std::vector<webkit::npapi::PluginGroup>& groups); | 62 const std::vector<PluginGroup>& groups); |
| 67 | 63 |
| 68 // Queues sending the notification that plugin data has changed. This is done | 64 // Queues sending the notification that plugin data has changed. This is done |
| 69 // so that if a bunch of changes happen, we only send one notification. | 65 // so that if a bunch of changes happen, we only send one notification. |
| 70 void NotifyPluginStatusChanged(); | 66 void NotifyPluginStatusChanged(); |
| 71 | 67 |
| 72 // Used for the post task to notify that plugin enabled status changed. | 68 // Used for the post task to notify that plugin enabled status changed. |
| 73 static void OnNotifyPluginStatusChanged(); | 69 static void OnNotifyPluginStatusChanged(); |
| 74 | 70 |
| 75 static DictionaryValue* CreatePluginFileSummary( | 71 static DictionaryValue* CreatePluginFileSummary(const WebPluginInfo& plugin); |
| 76 const webkit::npapi::WebPluginInfo& plugin); | |
| 77 | 72 |
| 78 // Force plugins to be disabled due to policy. |plugins| contains | 73 // Force plugins to be disabled due to policy. |plugins| contains |
| 79 // the list of StringValues of the names of the policy-disabled plugins. | 74 // the list of StringValues of the names of the policy-disabled plugins. |
| 80 void DisablePluginsFromPolicy(const ListValue* plugin_names); | 75 void DisablePluginsFromPolicy(const ListValue* plugin_names); |
| 81 | 76 |
| 82 // Needed to allow singleton instantiation using private constructor. | 77 // Needed to allow singleton instantiation using private constructor. |
| 83 friend struct DefaultSingletonTraits<PluginUpdater>; | 78 friend struct DefaultSingletonTraits<PluginUpdater>; |
| 84 | 79 |
| 85 // Note: if you change this to false from true, you must update | 80 // Note: if you change this to false from true, you must update |
| 86 // kPluginsEnabledInternalPDF to be a new name (i.e. add 2, 3, 4...) at end. | 81 // kPluginsEnabledInternalPDF to be a new name (i.e. add 2, 3, 4...) at end. |
| 87 bool enable_internal_pdf_; | 82 bool enable_internal_pdf_; |
| 88 | 83 |
| 89 bool notify_pending_; | 84 bool notify_pending_; |
| 90 | 85 |
| 91 DISALLOW_COPY_AND_ASSIGN(PluginUpdater); | 86 DISALLOW_COPY_AND_ASSIGN(PluginUpdater); |
| 92 }; | 87 }; |
| 93 | 88 |
| 94 #endif // CHROME_BROWSER_PLUGIN_UPDATER_H_ | 89 #endif // CHROME_BROWSER_PLUGIN_UPDATER_H_ |
| OLD | NEW |