| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_UI_WEBUI_PLUGINS_PLUGINS_HANDLER_H_ | 5 #ifndef CHROME_BROWSER_UI_WEBUI_PLUGINS_PLUGINS_HANDLER_H_ |
| 6 #define CHROME_BROWSER_UI_WEBUI_PLUGINS_PLUGINS_HANDLER_H_ | 6 #define CHROME_BROWSER_UI_WEBUI_PLUGINS_PLUGINS_HANDLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/weak_ptr.h" | 8 #include "base/memory/weak_ptr.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/ui/webui/mojo_web_ui_handler.h" | 10 #include "chrome/browser/ui/webui/mojo_web_ui_handler.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 public content::NotificationObserver { | 22 public content::NotificationObserver { |
| 23 public: | 23 public: |
| 24 PluginsPageHandler(content::WebUI* web_ui, | 24 PluginsPageHandler(content::WebUI* web_ui, |
| 25 mojo::InterfaceRequest<mojom::PluginsPageHandler> request); | 25 mojo::InterfaceRequest<mojom::PluginsPageHandler> request); |
| 26 ~PluginsPageHandler() override; | 26 ~PluginsPageHandler() override; |
| 27 | 27 |
| 28 // mojom::PluginsPageHandler overrides: | 28 // mojom::PluginsPageHandler overrides: |
| 29 void GetPluginsData(const GetPluginsDataCallback& callback) override; | 29 void GetPluginsData(const GetPluginsDataCallback& callback) override; |
| 30 void GetShowDetails(const GetShowDetailsCallback& callback) override; | 30 void GetShowDetails(const GetShowDetailsCallback& callback) override; |
| 31 void SaveShowDetailsToPrefs(bool details_mode) override; | 31 void SaveShowDetailsToPrefs(bool details_mode) override; |
| 32 void SetPluginAlwaysAllowed(const mojo::String& plugin, | 32 void SetPluginAlwaysAllowed(const std::string& plugin, bool allowed) override; |
| 33 bool allowed) override; | 33 void SetPluginEnabled(const std::string& plugin_path, bool enable) override; |
| 34 void SetPluginEnabled(const mojo::String& plugin_path, bool enable) override; | 34 void SetPluginGroupEnabled(const std::string& group_name, |
| 35 void SetPluginGroupEnabled(const mojo::String& group_name, | |
| 36 bool enable) override; | 35 bool enable) override; |
| 37 void SetClientPage(mojom::PluginsPagePtr page) override; | 36 void SetClientPage(mojom::PluginsPagePtr page) override; |
| 38 | 37 |
| 39 // content::NotificationObserver implementation. | 38 // content::NotificationObserver implementation. |
| 40 void Observe(int type, | 39 void Observe(int type, |
| 41 const content::NotificationSource& source, | 40 const content::NotificationSource& source, |
| 42 const content::NotificationDetails& details) override; | 41 const content::NotificationDetails& details) override; |
| 43 | 42 |
| 44 private: | 43 private: |
| 45 mojo::Array<mojom::PluginDataPtr> GeneratePluginsData( | 44 std::vector<mojom::PluginDataPtr> GeneratePluginsData( |
| 46 const std::vector<content::WebPluginInfo>& plugins); | 45 const std::vector<content::WebPluginInfo>& plugins); |
| 47 | 46 |
| 48 mojom::PluginFilePtr GeneratePluginFile(const content::WebPluginInfo& plugin, | 47 mojom::PluginFilePtr GeneratePluginFile(const content::WebPluginInfo& plugin, |
| 49 const base::string16& group_name, | 48 const base::string16& group_name, |
| 50 bool plugin_enabled) const; | 49 bool plugin_enabled) const; |
| 51 | 50 |
| 52 // Detect a plugin's enabled mode (one of enabledByUser, disabledByUser, | 51 // Detect a plugin's enabled mode (one of enabledByUser, disabledByUser, |
| 53 // enabledByPolicy, disabledByPolicy). | 52 // enabledByPolicy, disabledByPolicy). |
| 54 std::string GetPluginEnabledMode(const base::string16& plugin_name, | 53 std::string GetPluginEnabledMode(const base::string16& plugin_name, |
| 55 const base::string16& group_name, | 54 const base::string16& group_name, |
| 56 bool plugin_enabled) const; | 55 bool plugin_enabled) const; |
| 57 | 56 |
| 58 // Returns whether the policy for the current profile is "Click To Play" i.e. | 57 // Returns whether the policy for the current profile is "Click To Play" i.e. |
| 59 // DefaultPluginsSetting is 3 (ASK). | 58 // DefaultPluginsSetting is 3 (ASK). |
| 60 bool GetClickToPlayPolicyEnabled() const; | 59 bool GetClickToPlayPolicyEnabled() const; |
| 61 | 60 |
| 62 // Detect a plugin group's enabled mode (one of enabledByUser, disabledByUser, | 61 // Detect a plugin group's enabled mode (one of enabledByUser, disabledByUser, |
| 63 // enabledByPolicy, disabledByPolicy, managedByPolicy). | 62 // enabledByPolicy, disabledByPolicy, managedByPolicy). |
| 64 std::string GetPluginGroupEnabledMode( | 63 std::string GetPluginGroupEnabledMode( |
| 65 const mojo::Array<mojom::PluginFilePtr>& plugin_files, | 64 const std::vector<mojom::PluginFilePtr>& plugin_files, |
| 66 bool group_enabled) const; | 65 bool group_enabled) const; |
| 67 | 66 |
| 68 // Called on the UI thread when the plugin info requested fom GetPluginsData | 67 // Called on the UI thread when the plugin info requested fom GetPluginsData |
| 69 // is ready. | 68 // is ready. |
| 70 void RespondWithPluginsData( | 69 void RespondWithPluginsData( |
| 71 const GetPluginsDataCallback& callback, | 70 const GetPluginsDataCallback& callback, |
| 72 const std::vector<content::WebPluginInfo>& plugins); | 71 const std::vector<content::WebPluginInfo>& plugins); |
| 73 | 72 |
| 74 // Called on the UI thread when the plugin info has changed and calls the page | 73 // Called on the UI thread when the plugin info has changed and calls the page |
| 75 // to update it. | 74 // to update it. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 89 | 88 |
| 90 // Handle back to the page by which JS methods can be called. | 89 // Handle back to the page by which JS methods can be called. |
| 91 mojom::PluginsPagePtr page_; | 90 mojom::PluginsPagePtr page_; |
| 92 | 91 |
| 93 base::WeakPtrFactory<PluginsPageHandler> weak_ptr_factory_; | 92 base::WeakPtrFactory<PluginsPageHandler> weak_ptr_factory_; |
| 94 | 93 |
| 95 DISALLOW_COPY_AND_ASSIGN(PluginsPageHandler); | 94 DISALLOW_COPY_AND_ASSIGN(PluginsPageHandler); |
| 96 }; | 95 }; |
| 97 | 96 |
| 98 #endif // CHROME_BROWSER_UI_WEBUI_PLUGINS_PLUGINS_HANDLER_H_ | 97 #endif // CHROME_BROWSER_UI_WEBUI_PLUGINS_PLUGINS_HANDLER_H_ |
| OLD | NEW |