| 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_PLUGINS_PLUGIN_UTILS_H_ | 5 #ifndef CHROME_BROWSER_PLUGINS_PLUGIN_UTILS_H_ |
| 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_UTILS_H_ | 6 #define CHROME_BROWSER_PLUGINS_PLUGIN_UTILS_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "components/content_settings/core/common/content_settings.h" | 9 #include "components/content_settings/core/common/content_settings.h" |
| 10 | 10 |
| 11 class GURL; | 11 class GURL; |
| 12 class HostContentSettingsMap; | 12 class HostContentSettingsMap; |
| 13 struct PermissionResult; |
| 13 | 14 |
| 14 namespace content { | 15 namespace content { |
| 15 struct WebPluginInfo; | 16 struct WebPluginInfo; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace url { | 19 namespace url { |
| 19 class Origin; | 20 class Origin; |
| 20 } | 21 } |
| 21 | 22 |
| 22 class PluginUtils { | 23 class PluginUtils { |
| 23 public: | 24 public: |
| 24 // |is_default| and |is_managed| may be nullptr. In that case, they aren't | 25 // |is_default| and |is_managed| may be nullptr. In that case, they aren't |
| 25 // set. | 26 // set. |
| 26 static void GetPluginContentSetting( | 27 static void GetPluginContentSetting( |
| 27 const HostContentSettingsMap* host_content_settings_map, | 28 const HostContentSettingsMap* host_content_settings_map, |
| 28 const content::WebPluginInfo& plugin, | 29 const content::WebPluginInfo& plugin, |
| 29 const url::Origin& main_frame_origin, | 30 const url::Origin& main_frame_origin, |
| 30 const GURL& plugin_url, | 31 const GURL& plugin_url, |
| 31 const std::string& resource, | 32 const std::string& resource, |
| 32 ContentSetting* setting, | 33 PermissionResult* setting, |
| 33 bool* is_default, | 34 bool* is_default, |
| 34 bool* is_managed); | 35 bool* is_managed); |
| 35 | 36 |
| 36 // Returns the content setting for Flash. This is the same as | 37 // Returns the content setting for Flash. This is the same as |
| 37 // |GetPluginContentSetting| but flash-specific. | 38 // |GetPluginContentSetting| but flash-specific. |
| 38 static ContentSetting GetFlashPluginContentSetting( | 39 static PermissionResult GetFlashPluginContentSetting( |
| 39 const HostContentSettingsMap* host_content_settings_map, | 40 const HostContentSettingsMap* host_content_settings_map, |
| 40 const url::Origin& main_frame_origin, | 41 const url::Origin& main_frame_origin, |
| 41 const GURL& plugin_url, | 42 const GURL& plugin_url, |
| 42 bool* is_managed); | 43 bool* is_managed); |
| 43 | 44 |
| 44 // Returns true if HTML content should be prefered, by hiding Flash from the | 45 // Returns true if HTML content should be prefered, by hiding Flash from the |
| 45 // plugin list. Use this instead of | 46 // plugin list. Use this instead of |
| 46 // base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins). | 47 // base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins). |
| 47 static bool ShouldPreferHtmlOverPlugins( | 48 static bool ShouldPreferHtmlOverPlugins( |
| 48 const HostContentSettingsMap* host_content_settings_map); | 49 const HostContentSettingsMap* host_content_settings_map); |
| 49 | 50 |
| 50 private: | 51 private: |
| 51 DISALLOW_IMPLICIT_CONSTRUCTORS(PluginUtils); | 52 DISALLOW_IMPLICIT_CONSTRUCTORS(PluginUtils); |
| 52 }; | 53 }; |
| 53 | 54 |
| 54 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_UTILS_H_ | 55 #endif // CHROME_BROWSER_PLUGINS_PLUGIN_UTILS_H_ |
| OLD | NEW |