Index: chrome/browser/ui/webui/plugins/plugins_handler.h |
diff --git a/chrome/browser/ui/webui/plugins/plugins_handler.h b/chrome/browser/ui/webui/plugins/plugins_handler.h |
index 2fba979650f42a596a4c8743d7b7df06d3601cc7..24cf3ac07e2336f3cabc8e6f498b20db49a6ccc8 100644 |
--- a/chrome/browser/ui/webui/plugins/plugins_handler.h |
+++ b/chrome/browser/ui/webui/plugins/plugins_handler.h |
@@ -8,20 +8,33 @@ |
#include "base/memory/weak_ptr.h" |
#include "base/prefs/pref_member.h" |
#include "base/values.h" |
+#include "chrome/browser/ui/webui/mojo_web_ui_handler.h" |
+#include "chrome/browser/ui/webui/plugins/plugins.mojom.h" |
#include "content/public/browser/notification_observer.h" |
#include "content/public/browser/notification_registrar.h" |
#include "content/public/browser/notification_source.h" |
#include "content/public/browser/web_ui_message_handler.h" |
#include "content/public/common/webplugininfo.h" |
+#include "mojo/public/cpp/bindings/binding.h" |
-class PluginsHandler : public content::WebUIMessageHandler, |
- public content::NotificationObserver { |
+class PluginsHandler : |
+ public MojoWebUIHandler, public PluginsHandlerMojo, |
+ public content::NotificationObserver { |
Dan Beam
2016/01/26 20:10:43
wrong indent
dpapad
2016/01/26 22:34:48
Fixed (along with other style issues, just run cla
|
public: |
- PluginsHandler(); |
+ PluginsHandler(content::WebUI* web_ui, |
+ mojo::InterfaceRequest<PluginsHandlerMojo> request); |
~PluginsHandler() override; |
- // content::WebUIMessageHandler implementation. |
- void RegisterMessages() override; |
+ // PluginsHandlerMojo overrides: |
+ void GetPluginsData(const GetPluginsDataCallback& callback) override; |
+ void GetShowDetails(const GetShowDetailsCallback& callback) override; |
+ void SaveShowDetailsToPrefs(bool details_mode) override; |
+ void SetPluginAlwaysAllowed( |
+ const mojo::String& plugin, bool allowed) override; |
+ void SetPluginEnabled(const mojo::String& plugin_path, bool enable) override; |
+ void SetPluginGroupEnabled(const mojo::String& group_name, bool enable) |
+ override; |
+ void SetClientPage(PluginsPageMojoPtr page) override; |
// content::NotificationObserver implementation. |
void Observe(int type, |
@@ -29,25 +42,12 @@ class PluginsHandler : public content::WebUIMessageHandler, |
const content::NotificationDetails& details) override; |
private: |
- // Callback for the "requestPluginsData" message. |
- void HandleRequestPluginsData(const base::ListValue* args); |
+ mojo::Array<PluginDataPtr> GeneratePluginsData( |
+ const std::vector<content::WebPluginInfo>& plugins); |
- // Callback for the "enablePlugin" message. |
- void HandleEnablePluginMessage(const base::ListValue* args); |
- |
- // Callback for the "saveShowDetailsToPrefs" message. |
- void HandleSaveShowDetailsToPrefs(const base::ListValue* args); |
- |
- // Calback for the "getShowDetails" message. |
- void HandleGetShowDetails(const base::ListValue* args); |
- |
- // Callback for the "setPluginAlwaysAllowed" message. |
- void HandleSetPluginAlwaysAllowed(const base::ListValue* args); |
- |
- void LoadPlugins(); |
- |
- // Called on the UI thread when the plugin information is ready. |
- void PluginsLoaded(const std::vector<content::WebPluginInfo>& plugins); |
+ PluginFilePtr GeneratePluginFile(const content::WebPluginInfo& plugin, |
+ const base::string16& group_name, |
+ bool plugin_enabled) const; |
// Detect a plugin's enabled mode (one of enabledByUser, disabledByUser, |
// enabledByPolicy, disabledByPolicy). |
@@ -57,8 +57,20 @@ class PluginsHandler : public content::WebUIMessageHandler, |
// Detect a plugin group's enabled mode (one of enabledByUser, disabledByUser, |
// enabledByPolicy, disabledByPolicy, managedByPolicy). |
- std::string GetPluginGroupEnabledMode(const base::ListValue& plugin_files, |
- bool group_enabled) const; |
+ std::string GetPluginGroupEnabledMode( |
+ const mojo::Array<PluginFilePtr>& plugin_files, |
+ bool group_enabled) const; |
+ |
+ // Called on the UI thread when the plugin info requested fom GetPluginsData |
+ // is ready. |
+ void RespondWithPluginsData( |
+ const GetPluginsDataCallback& callback, |
+ const std::vector<content::WebPluginInfo>& plugins); |
+ |
+ // Called on the UI thread when the plugin info has changed and calls the page |
+ // to update it. |
+ void NotifyWithPluginsData( |
+ const std::vector<content::WebPluginInfo>& plugins); |
content::NotificationRegistrar registrar_; |
@@ -66,6 +78,12 @@ class PluginsHandler : public content::WebUIMessageHandler, |
// not. |
BooleanPrefMember show_details_; |
+ content::WebUI* web_ui_; |
Dan Beam
2016/01/26 20:10:43
nit: document ownership
dpapad
2016/01/26 22:34:48
Done.
|
+ mojo::Binding<PluginsHandlerMojo> binding_; |
+ |
+ // Handle back to the page by which JS methods can be called. |
+ PluginsPageMojoPtr page_; |
+ |
base::WeakPtrFactory<PluginsHandler> weak_ptr_factory_; |
DISALLOW_COPY_AND_ASSIGN(PluginsHandler); |