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