[email protected] | dca589ef | 2012-01-09 11:53:32 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 5 | #include "chrome/browser/plugins/plugin_info_host_impl.h" |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 6 | |
avi | b896c71 | 2015-12-26 02:10:43 | [diff] [blame] | 7 | #include <stddef.h> |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 8 | |
waffles | cd59e9b | 2016-08-30 04:34:44 | [diff] [blame] | 9 | #include <algorithm> |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 10 | #include <memory> |
dcheng | e73d8520c | 2015-12-27 01:19:09 | [diff] [blame] | 11 | #include <utility> |
avi | b896c71 | 2015-12-26 02:10:43 | [diff] [blame] | 12 | |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 13 | #include "base/bind.h" |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 14 | #include "base/memory/singleton.h" |
Eugene Kim | 0b4b457 | 2018-09-01 02:37:58 | [diff] [blame] | 15 | #include "base/stl_util.h" |
[email protected] | e309f31 | 2013-06-07 21:50:08 | [diff] [blame] | 16 | #include "base/strings/utf_string_conversions.h" |
Eric Seckler | 8652dcd5 | 2018-09-20 10:42:28 | [diff] [blame] | 17 | #include "base/task/post_task.h" |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 18 | #include "base/task_runner_util.h" |
Nico Weber | eaa0841 | 2019-08-14 01:24:37 | [diff] [blame] | 19 | #include "build/branding_buildflags.h" |
avi | b896c71 | 2015-12-26 02:10:43 | [diff] [blame] | 20 | #include "build/build_config.h" |
wfh | dfcab2e4 | 2014-11-07 06:48:32 | [diff] [blame] | 21 | #include "chrome/browser/browser_process.h" |
peconn | 5100d43 | 2015-09-16 12:03:08 | [diff] [blame] | 22 | #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
[email protected] | 6be31d20 | 2013-02-01 18:20:54 | [diff] [blame] | 23 | #include "chrome/browser/plugins/chrome_plugin_service_filter.h" |
[email protected] | cd33d28 | 2012-09-21 12:53:04 | [diff] [blame] | 24 | #include "chrome/browser/plugins/plugin_finder.h" |
[email protected] | de75c70 | 2012-09-25 23:06:02 | [diff] [blame] | 25 | #include "chrome/browser/plugins/plugin_metadata.h" |
[email protected] | 601e3c8 | 2013-10-03 01:31:20 | [diff] [blame] | 26 | #include "chrome/browser/plugins/plugin_prefs.h" |
raymes | 978301a2 | 2016-09-22 00:54:28 | [diff] [blame] | 27 | #include "chrome/browser/plugins/plugin_utils.h" |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 28 | #include "chrome/browser/profiles/profile.h" |
wfh | dfcab2e4 | 2014-11-07 06:48:32 | [diff] [blame] | 29 | #include "chrome/browser/ui/browser_otr_state.h" |
Scott Violet | 6200d33 | 2018-02-23 21:29:23 | [diff] [blame] | 30 | #include "chrome/common/buildflags.h" |
waffles | cd59e9b | 2016-08-30 04:34:44 | [diff] [blame] | 31 | #include "chrome/common/chrome_content_client.h" |
tommycli | c0c4f94 | 2016-09-19 19:35:00 | [diff] [blame] | 32 | #include "chrome/common/chrome_features.h" |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 33 | #include "chrome/common/plugin.mojom.h" |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 34 | #include "chrome/common/pref_names.h" |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 35 | #include "components/component_updater/component_updater_service.h" |
mukai | 8eaec82 | 2014-10-25 17:53:16 | [diff] [blame] | 36 | #include "components/content_settings/core/browser/content_settings_utils.h" |
| 37 | #include "components/content_settings/core/browser/host_content_settings_map.h" |
mukai | 077089f | 2014-09-11 18:41:52 | [diff] [blame] | 38 | #include "components/content_settings/core/common/content_settings.h" |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 39 | #include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h" |
Scott Violet | 9ae8289 | 2018-03-01 18:38:12 | [diff] [blame] | 40 | #include "components/nacl/common/buildflags.h" |
Bernhard Bauer | 1919073 | 2017-09-28 09:03:33 | [diff] [blame] | 41 | #include "components/pref_registry/pref_registry_syncable.h" |
brettw | b1fc1b8 | 2016-02-02 00:19:08 | [diff] [blame] | 42 | #include "components/prefs/pref_service.h" |
Steven Holte | f0f4677 | 2017-12-11 20:54:51 | [diff] [blame] | 43 | #include "components/ukm/content/source_url_recorder.h" |
Eric Seckler | 8652dcd5 | 2018-09-20 10:42:28 | [diff] [blame] | 44 | #include "content/public/browser/browser_task_traits.h" |
[email protected] | 3a5180ae | 2011-12-21 02:39:38 | [diff] [blame] | 45 | #include "content/public/browser/plugin_service.h" |
[email protected] | 31f376c | 2012-03-13 16:43:09 | [diff] [blame] | 46 | #include "content/public/browser/plugin_service_filter.h" |
tommycli | 910b408 | 2017-04-03 17:04:15 | [diff] [blame] | 47 | #include "content/public/browser/render_frame_host.h" |
wfh | dfcab2e4 | 2014-11-07 06:48:32 | [diff] [blame] | 48 | #include "content/public/common/content_constants.h" |
Scott Violet | c8240b0 | 2018-03-08 22:03:59 | [diff] [blame] | 49 | #include "extensions/buildflags/buildflags.h" |
wfh | dfcab2e4 | 2014-11-07 06:48:32 | [diff] [blame] | 50 | #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
Scott Violet | 02e38b9 | 2018-03-27 23:42:14 | [diff] [blame] | 51 | #include "ppapi/buildflags/buildflags.h" |
Steven Holte | f0f4677 | 2017-12-11 20:54:51 | [diff] [blame] | 52 | #include "services/metrics/public/cpp/ukm_builders.h" |
Mounir Lamouri | fd9dcefa | 2017-07-06 10:26:55 | [diff] [blame] | 53 | #include "services/metrics/public/cpp/ukm_recorder.h" |
[email protected] | 761fa470 | 2013-07-02 15:25:15 | [diff] [blame] | 54 | #include "url/gurl.h" |
tommycli | f2a1e9f | 2016-10-06 18:34:36 | [diff] [blame] | 55 | #include "url/origin.h" |
[email protected] | b9b88a08 | 2013-03-21 03:51:02 | [diff] [blame] | 56 | |
brettw | 00899e6 | 2016-11-12 02:10:17 | [diff] [blame] | 57 | #if BUILDFLAG(ENABLE_EXTENSIONS) |
fsamuel | 8dfa19a | 2015-05-05 01:00:39 | [diff] [blame] | 58 | #include "components/guest_view/browser/guest_view_base.h" |
Sadrul Habib Chowdhury | f43c33c | 2014-12-04 15:53:52 | [diff] [blame] | 59 | #include "extensions/browser/extension_registry.h" |
hanxi | 0d0a1e9 | 2014-08-26 18:39:48 | [diff] [blame] | 60 | #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" |
lfg | 44c8a68f | 2015-04-16 16:38:15 | [diff] [blame] | 61 | #include "extensions/common/constants.h" |
Sadrul Habib Chowdhury | f43c33c | 2014-12-04 15:53:52 | [diff] [blame] | 62 | #include "extensions/common/extension.h" |
| 63 | #include "extensions/common/manifest_handlers/webview_info.h" |
[email protected] | 21a2013 | 2014-07-16 00:48:59 | [diff] [blame] | 64 | #endif |
| 65 | |
Nico Weber | af3b00b | 2017-09-11 17:58:17 | [diff] [blame] | 66 | #if BUILDFLAG(ENABLE_NACL) |
[email protected] | e0ff1aa | 2014-08-16 01:38:11 | [diff] [blame] | 67 | #include "components/nacl/common/nacl_constants.h" |
| 68 | #endif |
| 69 | |
[email protected] | 3a5180ae | 2011-12-21 02:39:38 | [diff] [blame] | 70 | using content::PluginService; |
[email protected] | d7bd3e5 | 2013-07-21 04:29:20 | [diff] [blame] | 71 | using content::WebPluginInfo; |
[email protected] | 3a5180ae | 2011-12-21 02:39:38 | [diff] [blame] | 72 | |
[email protected] | b9b88a08 | 2013-03-21 03:51:02 | [diff] [blame] | 73 | namespace { |
| 74 | |
Daniel Bratell | 84928c5 | 2018-01-16 21:40:34 | [diff] [blame] | 75 | class PluginInfoHostImplShutdownNotifierFactory |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 76 | : public BrowserContextKeyedServiceShutdownNotifierFactory { |
| 77 | public: |
Daniel Bratell | 84928c5 | 2018-01-16 21:40:34 | [diff] [blame] | 78 | static PluginInfoHostImplShutdownNotifierFactory* GetInstance() { |
| 79 | return base::Singleton<PluginInfoHostImplShutdownNotifierFactory>::get(); |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 80 | } |
| 81 | |
| 82 | private: |
Daniel Bratell | 84928c5 | 2018-01-16 21:40:34 | [diff] [blame] | 83 | friend struct base::DefaultSingletonTraits< |
| 84 | PluginInfoHostImplShutdownNotifierFactory>; |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 85 | |
Daniel Bratell | 84928c5 | 2018-01-16 21:40:34 | [diff] [blame] | 86 | PluginInfoHostImplShutdownNotifierFactory() |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 87 | : BrowserContextKeyedServiceShutdownNotifierFactory( |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 88 | "PluginInfoHostImpl") {} |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 89 | |
Daniel Bratell | 84928c5 | 2018-01-16 21:40:34 | [diff] [blame] | 90 | ~PluginInfoHostImplShutdownNotifierFactory() override {} |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 91 | |
Daniel Bratell | 84928c5 | 2018-01-16 21:40:34 | [diff] [blame] | 92 | DISALLOW_COPY_AND_ASSIGN(PluginInfoHostImplShutdownNotifierFactory); |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 93 | }; |
| 94 | |
brettw | 00899e6 | 2016-11-12 02:10:17 | [diff] [blame] | 95 | #if BUILDFLAG(ENABLE_EXTENSIONS) |
Sadrul Habib Chowdhury | f43c33c | 2014-12-04 15:53:52 | [diff] [blame] | 96 | // Returns whether a request from a plugin to load |resource| from a renderer |
| 97 | // with process id |process_id| is a request for an internal resource by an app |
| 98 | // listed in |accessible_resources| in its manifest. |
| 99 | bool IsPluginLoadingAccessibleResourceInWebView( |
| 100 | extensions::ExtensionRegistry* extension_registry, |
| 101 | int process_id, |
| 102 | const GURL& resource) { |
| 103 | extensions::WebViewRendererState* renderer_state = |
| 104 | extensions::WebViewRendererState::GetInstance(); |
| 105 | std::string partition_id; |
| 106 | if (!renderer_state->IsGuest(process_id) || |
| 107 | !renderer_state->GetPartitionID(process_id, &partition_id)) { |
| 108 | return false; |
| 109 | } |
| 110 | |
| 111 | const std::string extension_id = resource.host(); |
paulmeyer | ad727fc6 | 2015-09-09 15:29:59 | [diff] [blame] | 112 | const extensions::Extension* extension = extension_registry->GetExtensionById( |
| 113 | extension_id, extensions::ExtensionRegistry::ENABLED); |
| 114 | if (!extension || !extensions::WebviewInfo::IsResourceWebviewAccessible( |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 115 | extension, partition_id, resource.path())) { |
Sadrul Habib Chowdhury | f43c33c | 2014-12-04 15:53:52 | [diff] [blame] | 116 | return false; |
| 117 | } |
| 118 | |
| 119 | // Make sure the renderer making the request actually belongs to the |
| 120 | // same extension. |
| 121 | std::string owner_extension; |
| 122 | return renderer_state->GetOwnerInfo(process_id, nullptr, &owner_extension) && |
| 123 | owner_extension == extension_id; |
| 124 | } |
brettw | 00899e6 | 2016-11-12 02:10:17 | [diff] [blame] | 125 | #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
Sadrul Habib Chowdhury | f43c33c | 2014-12-04 15:53:52 | [diff] [blame] | 126 | |
[email protected] | b9b88a08 | 2013-03-21 03:51:02 | [diff] [blame] | 127 | } // namespace |
| 128 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 129 | PluginInfoHostImpl::Context::Context(int render_process_id, Profile* profile) |
[email protected] | 0a8f3a7f | 2012-01-17 16:17:19 | [diff] [blame] | 130 | : render_process_id_(render_process_id), |
brettw | 00899e6 | 2016-11-12 02:10:17 | [diff] [blame] | 131 | #if BUILDFLAG(ENABLE_EXTENSIONS) |
Sadrul Habib Chowdhury | f43c33c | 2014-12-04 15:53:52 | [diff] [blame] | 132 | extension_registry_(extensions::ExtensionRegistry::Get(profile)), |
| 133 | #endif |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 134 | host_content_settings_map_( |
| 135 | HostContentSettingsMapFactory::GetForProfile(profile)), |
[email protected] | 601e3c8 | 2013-10-03 01:31:20 | [diff] [blame] | 136 | plugin_prefs_(PluginPrefs::GetForProfile(profile)) { |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 137 | allow_outdated_plugins_.Init(prefs::kPluginsAllowOutdated, |
[email protected] | 96a5c34 | 2012-12-04 18:14:02 | [diff] [blame] | 138 | profile->GetPrefs()); |
Bernhard Bauer | 1919073 | 2017-09-28 09:03:33 | [diff] [blame] | 139 | run_all_flash_in_allow_mode_.Init(prefs::kRunAllFlashInAllowMode, |
| 140 | profile->GetPrefs()); |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 141 | } |
| 142 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 143 | PluginInfoHostImpl::Context::~Context() {} |
[email protected] | 0a8f3a7f | 2012-01-17 16:17:19 | [diff] [blame] | 144 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 145 | void PluginInfoHostImpl::Context::ShutdownOnUIThread() { |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 146 | DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 147 | allow_outdated_plugins_.Destroy(); |
Bernhard Bauer | 1919073 | 2017-09-28 09:03:33 | [diff] [blame] | 148 | run_all_flash_in_allow_mode_.Destroy(); |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 149 | } |
| 150 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 151 | PluginInfoHostImpl::PluginInfoHostImpl(int render_process_id, Profile* profile) |
Clark DuVall | 1df2052b | 2019-08-05 19:58:46 | [diff] [blame] | 152 | : context_(render_process_id, profile) { |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 153 | shutdown_notifier_ = |
Daniel Bratell | 84928c5 | 2018-01-16 21:40:34 | [diff] [blame] | 154 | PluginInfoHostImplShutdownNotifierFactory::GetInstance() |
| 155 | ->Get(profile) |
| 156 | ->Subscribe(base::Bind(&PluginInfoHostImpl::ShutdownOnUIThread, |
| 157 | base::Unretained(this))); |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 158 | } |
| 159 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 160 | void PluginInfoHostImpl::ShutdownOnUIThread() { |
rbpotter | 654f42d | 2016-12-02 22:17:07 | [diff] [blame] | 161 | DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 162 | context_.ShutdownOnUIThread(); |
| 163 | shutdown_notifier_.reset(); |
[email protected] | 0a8f3a7f | 2012-01-17 16:17:19 | [diff] [blame] | 164 | } |
| 165 | |
Bernhard Bauer | 1919073 | 2017-09-28 09:03:33 | [diff] [blame] | 166 | // static |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 167 | void PluginInfoHostImpl::RegisterUserPrefs( |
Bernhard Bauer | 1919073 | 2017-09-28 09:03:33 | [diff] [blame] | 168 | user_prefs::PrefRegistrySyncable* registry) { |
| 169 | registry->RegisterBooleanPref(prefs::kPluginsAllowOutdated, false); |
Bernhard Bauer | 1919073 | 2017-09-28 09:03:33 | [diff] [blame] | 170 | registry->RegisterBooleanPref(prefs::kRunAllFlashInAllowMode, false); |
| 171 | } |
| 172 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 173 | PluginInfoHostImpl::~PluginInfoHostImpl() {} |
[email protected] | 649d1c0 | 2012-04-27 02:56:21 | [diff] [blame] | 174 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 175 | struct PluginInfoHostImpl::GetPluginInfo_Params { |
[email protected] | 60eca4eb | 2013-12-06 00:02:16 | [diff] [blame] | 176 | int render_frame_id; |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 177 | GURL url; |
tommycli | f2a1e9f | 2016-10-06 18:34:36 | [diff] [blame] | 178 | url::Origin main_frame_origin; |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 179 | std::string mime_type; |
| 180 | }; |
| 181 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 182 | void PluginInfoHostImpl::GetPluginInfo(int32_t render_frame_id, |
| 183 | const GURL& url, |
| 184 | const url::Origin& origin, |
| 185 | const std::string& mime_type, |
tzik | cd02d3b | 2018-08-09 21:32:47 | [diff] [blame] | 186 | GetPluginInfoCallback callback) { |
Clark DuVall | 1df2052b | 2019-08-05 19:58:46 | [diff] [blame] | 187 | DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 188 | GetPluginInfo_Params params = {render_frame_id, url, origin, mime_type}; |
Clark DuVall | 1df2052b | 2019-08-05 19:58:46 | [diff] [blame] | 189 | PluginService::GetInstance()->GetPlugins( |
| 190 | base::BindOnce(&PluginInfoHostImpl::PluginsLoaded, |
| 191 | weak_factory_.GetWeakPtr(), params, std::move(callback))); |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 192 | } |
| 193 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 194 | void PluginInfoHostImpl::PluginsLoaded( |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 195 | const GetPluginInfo_Params& params, |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 196 | GetPluginInfoCallback callback, |
[email protected] | dfdfeb7 | 2012-06-08 11:29:02 | [diff] [blame] | 197 | const std::vector<WebPluginInfo>& plugins) { |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 198 | chrome::mojom::PluginInfoPtr output = chrome::mojom::PluginInfo::New(); |
[email protected] | 79fa336 | 2012-03-28 16:21:11 | [diff] [blame] | 199 | // This also fills in |actual_mime_type|. |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 200 | std::unique_ptr<PluginMetadata> plugin_metadata; |
[email protected] | 60eca4eb | 2013-12-06 00:02:16 | [diff] [blame] | 201 | if (context_.FindEnabledPlugin(params.render_frame_id, params.url, |
tommycli | f2a1e9f | 2016-10-06 18:34:36 | [diff] [blame] | 202 | params.main_frame_origin, params.mime_type, |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 203 | &output->status, &output->plugin, |
| 204 | &output->actual_mime_type, &plugin_metadata)) { |
tommycli | e97656b8 | 2016-11-30 16:43:00 | [diff] [blame] | 205 | context_.DecidePluginStatus( |
| 206 | params.url, params.main_frame_origin, output->plugin, |
| 207 | plugin_metadata->GetSecurityStatus(output->plugin), |
| 208 | plugin_metadata->identifier(), &output->status); |
[email protected] | 79fa336 | 2012-03-28 16:21:11 | [diff] [blame] | 209 | } |
[email protected] | cd33d28 | 2012-09-21 12:53:04 | [diff] [blame] | 210 | |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 211 | if (output->status == chrome::mojom::PluginStatus::kNotFound) { |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 212 | // Check to see if the component updater can fetch an implementation. |
Clark DuVall | 1df2052b | 2019-08-05 19:58:46 | [diff] [blame] | 213 | std::unique_ptr<component_updater::ComponentInfo> cus_plugin_info = |
| 214 | g_browser_process->component_updater()->GetComponentForMimeType( |
| 215 | params.mime_type); |
| 216 | ComponentPluginLookupDone(params, std::move(output), std::move(callback), |
| 217 | std::move(plugin_metadata), |
| 218 | std::move(cus_plugin_info)); |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 219 | } else { |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 220 | GetPluginInfoFinish(params, std::move(output), std::move(callback), |
| 221 | std::move(plugin_metadata)); |
wfh | be79ad5 | 2014-11-07 19:02:07 | [diff] [blame] | 222 | } |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 223 | } |
| 224 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 225 | void PluginInfoHostImpl::Context::DecidePluginStatus( |
tommycli | e97656b8 | 2016-11-30 16:43:00 | [diff] [blame] | 226 | const GURL& url, |
| 227 | const url::Origin& main_frame_origin, |
[email protected] | 546abf3 | 2012-09-14 16:55:09 | [diff] [blame] | 228 | const WebPluginInfo& plugin, |
tommycli | e97656b8 | 2016-11-30 16:43:00 | [diff] [blame] | 229 | PluginMetadata::SecurityStatus security_status, |
| 230 | const std::string& plugin_identifier, |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 231 | chrome::mojom::PluginStatus* status) const { |
tommycli | e97656b8 | 2016-11-30 16:43:00 | [diff] [blame] | 232 | if (security_status == PluginMetadata::SECURITY_STATUS_FULLY_TRUSTED) { |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 233 | *status = chrome::mojom::PluginStatus::kAllowed; |
wfh | e53608b | 2016-04-07 02:18:53 | [diff] [blame] | 234 | return; |
| 235 | } |
| 236 | |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 237 | ContentSetting plugin_setting = CONTENT_SETTING_DEFAULT; |
| 238 | bool uses_default_content_setting = true; |
[email protected] | 6a9d1deb | 2014-01-13 19:39:41 | [diff] [blame] | 239 | bool is_managed = false; |
tommycli | e86b298 | 2015-03-16 20:16:45 | [diff] [blame] | 240 | // Check plugin content settings. The primary URL is the top origin URL and |
| 241 | // the secondary URL is the plugin URL. |
raymes | 978301a2 | 2016-09-22 00:54:28 | [diff] [blame] | 242 | PluginUtils::GetPluginContentSetting( |
tommycli | e97656b8 | 2016-11-30 16:43:00 | [diff] [blame] | 243 | host_content_settings_map_, plugin, main_frame_origin, url, |
| 244 | plugin_identifier, &plugin_setting, &uses_default_content_setting, |
| 245 | &is_managed); |
tommycli | e2b1f1b | 2015-03-31 22:54:59 | [diff] [blame] | 246 | |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 247 | DCHECK(plugin_setting != CONTENT_SETTING_DEFAULT); |
tommycli | e2b1f1b | 2015-03-31 22:54:59 | [diff] [blame] | 248 | DCHECK(plugin_setting != CONTENT_SETTING_ASK); |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 249 | |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 250 | if (*status == chrome::mojom::PluginStatus::kFlashHiddenPreferHtml) { |
tommycli | e97656b8 | 2016-11-30 16:43:00 | [diff] [blame] | 251 | if (plugin_setting == CONTENT_SETTING_BLOCK) { |
Tommy C. Li | 717a34a | 2019-03-28 16:24:51 | [diff] [blame] | 252 | *status = is_managed ? chrome::mojom::PluginStatus::kBlockedByPolicy |
| 253 | : chrome::mojom::PluginStatus::kBlockedNoLoading; |
tommycli | e97656b8 | 2016-11-30 16:43:00 | [diff] [blame] | 254 | } |
| 255 | return; |
| 256 | } |
| 257 | |
bauerb | ecab4f5 | 2017-03-13 20:16:41 | [diff] [blame] | 258 | #if BUILDFLAG(ENABLE_PLUGINS) |
tommycli | e86b298 | 2015-03-16 20:16:45 | [diff] [blame] | 259 | // Check if the plugin is outdated. |
tommycli | e97656b8 | 2016-11-30 16:43:00 | [diff] [blame] | 260 | if (security_status == PluginMetadata::SECURITY_STATUS_OUT_OF_DATE && |
[email protected] | 9f230ed | 2012-05-24 11:19:40 | [diff] [blame] | 261 | !allow_outdated_plugins_.GetValue()) { |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 262 | if (allow_outdated_plugins_.IsManaged()) { |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 263 | *status = chrome::mojom::PluginStatus::kOutdatedDisallowed; |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 264 | } else { |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 265 | *status = chrome::mojom::PluginStatus::kOutdatedBlocked; |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 266 | } |
| 267 | return; |
| 268 | } |
bauerb | ecab4f5 | 2017-03-13 20:16:41 | [diff] [blame] | 269 | #endif // BUILDFLAG(ENABLE_PLUGINS) |
[email protected] | ef97ce34 | 2012-09-24 20:05:02 | [diff] [blame] | 270 | |
tommycli | e86b298 | 2015-03-16 20:16:45 | [diff] [blame] | 271 | // Check if the plugin is crashing too much. |
[email protected] | ef97ce34 | 2012-09-24 20:05:02 | [diff] [blame] | 272 | if (PluginService::GetInstance()->IsPluginUnstable(plugin.path) && |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 273 | plugin_setting != CONTENT_SETTING_BLOCK && uses_default_content_setting) { |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 274 | *status = chrome::mojom::PluginStatus::kUnauthorized; |
[email protected] | ef97ce34 | 2012-09-24 20:05:02 | [diff] [blame] | 275 | return; |
| 276 | } |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 277 | |
brettw | 00899e6 | 2016-11-12 02:10:17 | [diff] [blame] | 278 | #if BUILDFLAG(ENABLE_EXTENSIONS) |
Sadrul Habib Chowdhury | f43c33c | 2014-12-04 15:53:52 | [diff] [blame] | 279 | // If an app has explicitly made internal resources available by listing them |
| 280 | // in |accessible_resources| in the manifest, then allow them to be loaded by |
| 281 | // plugins inside a guest-view. |
tommycli | e97656b8 | 2016-11-30 16:43:00 | [diff] [blame] | 282 | if (url.SchemeIs(extensions::kExtensionScheme) && !is_managed && |
lfg | 44c8a68f | 2015-04-16 16:38:15 | [diff] [blame] | 283 | plugin_setting == CONTENT_SETTING_BLOCK && |
tommycli | e97656b8 | 2016-11-30 16:43:00 | [diff] [blame] | 284 | IsPluginLoadingAccessibleResourceInWebView(extension_registry_, |
| 285 | render_process_id_, url)) { |
Sadrul Habib Chowdhury | f43c33c | 2014-12-04 15:53:52 | [diff] [blame] | 286 | plugin_setting = CONTENT_SETTING_ALLOW; |
| 287 | } |
brettw | 00899e6 | 2016-11-12 02:10:17 | [diff] [blame] | 288 | #endif // BUILDFLAG(ENABLE_EXTENSIONS) |
Sadrul Habib Chowdhury | f43c33c | 2014-12-04 15:53:52 | [diff] [blame] | 289 | |
tommycli | 608ec89b | 2016-09-28 16:39:00 | [diff] [blame] | 290 | if (plugin_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT || |
| 291 | (plugin_setting == CONTENT_SETTING_ALLOW && |
Bernhard Bauer | 1919073 | 2017-09-28 09:03:33 | [diff] [blame] | 292 | !run_all_flash_in_allow_mode_.GetValue())) { |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 293 | *status = chrome::mojom::PluginStatus::kPlayImportantContent; |
tommycli | e2b1f1b | 2015-03-31 22:54:59 | [diff] [blame] | 294 | } else if (plugin_setting == CONTENT_SETTING_BLOCK) { |
Tommy C. Li | 717a34a | 2019-03-28 16:24:51 | [diff] [blame] | 295 | *status = is_managed ? chrome::mojom::PluginStatus::kBlockedByPolicy |
| 296 | : chrome::mojom::PluginStatus::kBlocked; |
[email protected] | 6a9d1deb | 2014-01-13 19:39:41 | [diff] [blame] | 297 | } |
[email protected] | aea757d | 2013-09-27 22:27:38 | [diff] [blame] | 298 | |
brettw | 00899e6 | 2016-11-12 02:10:17 | [diff] [blame] | 299 | #if BUILDFLAG(ENABLE_EXTENSIONS) |
tommycli | 550b222 | 2015-09-03 21:06:10 | [diff] [blame] | 300 | // Allow an embedder of <webview> to block a plugin from being loaded inside |
| 301 | // the guest. In order to do this, set the status to 'Unauthorized' here, |
| 302 | // and update the status as appropriate depending on the response from the |
| 303 | // embedder. |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 304 | if (*status == chrome::mojom::PluginStatus::kAllowed || |
| 305 | *status == chrome::mojom::PluginStatus::kBlocked || |
| 306 | *status == chrome::mojom::PluginStatus::kPlayImportantContent) { |
[email protected] | 140d6cd9 | 2014-08-12 18:26:46 | [diff] [blame] | 307 | if (extensions::WebViewRendererState::GetInstance()->IsGuest( |
tommycli | 550b222 | 2015-09-03 21:06:10 | [diff] [blame] | 308 | render_process_id_)) |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 309 | *status = chrome::mojom::PluginStatus::kUnauthorized; |
[email protected] | aea757d | 2013-09-27 22:27:38 | [diff] [blame] | 310 | } |
tommycli | 550b222 | 2015-09-03 21:06:10 | [diff] [blame] | 311 | #endif |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 312 | } |
| 313 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 314 | bool PluginInfoHostImpl::Context::FindEnabledPlugin( |
[email protected] | 60eca4eb | 2013-12-06 00:02:16 | [diff] [blame] | 315 | int render_frame_id, |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 316 | const GURL& url, |
tommycli | f2a1e9f | 2016-10-06 18:34:36 | [diff] [blame] | 317 | const url::Origin& main_frame_origin, |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 318 | const std::string& mime_type, |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 319 | chrome::mojom::PluginStatus* status, |
[email protected] | dfdfeb7 | 2012-06-08 11:29:02 | [diff] [blame] | 320 | WebPluginInfo* plugin, |
[email protected] | 4da40567 | 2012-10-25 10:43:03 | [diff] [blame] | 321 | std::string* actual_mime_type, |
dcheng | 4af4858 | 2016-04-19 00:29:35 | [diff] [blame] | 322 | std::unique_ptr<PluginMetadata>* plugin_metadata) const { |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 323 | *status = chrome::mojom::PluginStatus::kAllowed; |
bauerb | 96d29c0 | 2015-04-09 08:40:35 | [diff] [blame] | 324 | |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 325 | bool allow_wildcard = true; |
[email protected] | dfdfeb7 | 2012-06-08 11:29:02 | [diff] [blame] | 326 | std::vector<WebPluginInfo> matching_plugins; |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 327 | std::vector<std::string> mime_types; |
| 328 | PluginService::GetInstance()->GetPluginInfoArray( |
| 329 | url, mime_type, allow_wildcard, &matching_plugins, &mime_types); |
Nico Weber | eaa0841 | 2019-08-14 01:24:37 | [diff] [blame] | 330 | #if BUILDFLAG(GOOGLE_CHROME_BRANDING) |
Eugene Kim | 0b4b457 | 2018-09-01 02:37:58 | [diff] [blame] | 331 | base::EraseIf(matching_plugins, [&](const WebPluginInfo& info) { |
| 332 | return info.path.value() == ChromeContentClient::kNotPresent; |
| 333 | }); |
Nico Weber | eaa0841 | 2019-08-14 01:24:37 | [diff] [blame] | 334 | #endif // BUILDFLAG(GOOGLE_CHROME_BRANDING) |
[email protected] | 4da40567 | 2012-10-25 10:43:03 | [diff] [blame] | 335 | if (matching_plugins.empty()) { |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 336 | *status = chrome::mojom::PluginStatus::kNotFound; |
[email protected] | 4da40567 | 2012-10-25 10:43:03 | [diff] [blame] | 337 | return false; |
| 338 | } |
| 339 | |
[email protected] | 3a5180ae | 2011-12-21 02:39:38 | [diff] [blame] | 340 | content::PluginServiceFilter* filter = |
| 341 | PluginService::GetInstance()->GetFilter(); |
[email protected] | 4da40567 | 2012-10-25 10:43:03 | [diff] [blame] | 342 | size_t i = 0; |
| 343 | for (; i < matching_plugins.size(); ++i) { |
Clark DuVall | 1df2052b | 2019-08-05 19:58:46 | [diff] [blame] | 344 | if (!filter || |
| 345 | filter->IsPluginAvailable(render_process_id_, render_frame_id, url, |
| 346 | main_frame_origin, &matching_plugins[i])) { |
[email protected] | 4da40567 | 2012-10-25 10:43:03 | [diff] [blame] | 347 | break; |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 348 | } |
| 349 | } |
| 350 | |
tommycli | e86b298 | 2015-03-16 20:16:45 | [diff] [blame] | 351 | // If we broke out of the loop, we have found an enabled plugin. |
[email protected] | 4da40567 | 2012-10-25 10:43:03 | [diff] [blame] | 352 | bool enabled = i < matching_plugins.size(); |
| 353 | if (!enabled) { |
tommycli | e86b298 | 2015-03-16 20:16:45 | [diff] [blame] | 354 | // Otherwise, we only found disabled plugins, so we take the first one. |
[email protected] | 4da40567 | 2012-10-25 10:43:03 | [diff] [blame] | 355 | i = 0; |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 356 | *status = chrome::mojom::PluginStatus::kDisabled; |
tommycli | c0c4f94 | 2016-09-19 19:35:00 | [diff] [blame] | 357 | |
Tommy C. Li | 5834262 | 2019-03-27 23:08:51 | [diff] [blame] | 358 | // Special case for Flash: this is our Prefer HTML over Plugins logic. |
| 359 | if (matching_plugins[0].name == |
| 360 | base::ASCIIToUTF16(content::kFlashPluginName)) { |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 361 | *status = chrome::mojom::PluginStatus::kFlashHiddenPreferHtml; |
tommycli | e97656b8 | 2016-11-30 16:43:00 | [diff] [blame] | 362 | |
| 363 | // In the Prefer HTML case, the plugin is actually enabled, but hidden. |
| 364 | // It will still be blocked in the body of DecidePluginStatus. |
| 365 | enabled = true; |
tommycli | c0c4f94 | 2016-09-19 19:35:00 | [diff] [blame] | 366 | } |
[email protected] | 4da40567 | 2012-10-25 10:43:03 | [diff] [blame] | 367 | } |
| 368 | |
| 369 | *plugin = matching_plugins[i]; |
| 370 | *actual_mime_type = mime_types[i]; |
| 371 | if (plugin_metadata) |
| 372 | *plugin_metadata = PluginFinder::GetInstance()->GetPluginMetadata(*plugin); |
| 373 | |
| 374 | return enabled; |
[email protected] | 8aa7a41 | 2011-11-07 12:33:42 | [diff] [blame] | 375 | } |
| 376 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 377 | void PluginInfoHostImpl::ComponentPluginLookupDone( |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 378 | const GetPluginInfo_Params& params, |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 379 | chrome::mojom::PluginInfoPtr output, |
| 380 | GetPluginInfoCallback callback, |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 381 | std::unique_ptr<PluginMetadata> plugin_metadata, |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 382 | std::unique_ptr<component_updater::ComponentInfo> cus_plugin_info) { |
| 383 | if (cus_plugin_info) { |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 384 | output->status = chrome::mojom::PluginStatus::kComponentUpdateRequired; |
Sean McAllister | df80771 | 2020-08-13 23:19:09 | [diff] [blame^] | 385 | #if defined(OS_LINUX) || defined(OS_CHROMEOS) |
waffles | e7759f7 | 2016-10-10 23:41:25 | [diff] [blame] | 386 | if (cus_plugin_info->version != base::Version("0")) { |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 387 | output->status = chrome::mojom::PluginStatus::kRestartRequired; |
waffles | e7759f7 | 2016-10-10 23:41:25 | [diff] [blame] | 388 | } |
thestig | d6e43818 | 2017-06-01 23:16:27 | [diff] [blame] | 389 | #endif |
Tommy C. Li | 7c493d19 | 2019-03-28 21:50:26 | [diff] [blame] | 390 | // Component Updater wouldn't provide a deprecated plugin. |
| 391 | bool plugin_is_deprecated = false; |
Jeremy Roman | ec48d7a | 2018-03-01 17:35:09 | [diff] [blame] | 392 | plugin_metadata = std::make_unique<PluginMetadata>( |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 393 | cus_plugin_info->id, cus_plugin_info->name, false, GURL(), GURL(), |
Tommy C. Li | 7c493d19 | 2019-03-28 21:50:26 | [diff] [blame] | 394 | base::ASCIIToUTF16(cus_plugin_info->id), std::string(), |
| 395 | plugin_is_deprecated); |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 396 | } |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 397 | GetPluginInfoFinish(params, std::move(output), std::move(callback), |
| 398 | std::move(plugin_metadata)); |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 399 | } |
| 400 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 401 | void PluginInfoHostImpl::GetPluginInfoFinish( |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 402 | const GetPluginInfo_Params& params, |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 403 | chrome::mojom::PluginInfoPtr output, |
| 404 | GetPluginInfoCallback callback, |
| 405 | std::unique_ptr<PluginMetadata> plugin_metadata) { |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 406 | if (plugin_metadata) { |
| 407 | output->group_identifier = plugin_metadata->identifier(); |
| 408 | output->group_name = plugin_metadata->name(); |
| 409 | } |
| 410 | |
| 411 | context_.MaybeGrantAccess(output->status, output->plugin.path); |
| 412 | |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 413 | if (output->status != chrome::mojom::PluginStatus::kNotFound) { |
Will Harris | 235b8517 | 2019-11-07 22:21:37 | [diff] [blame] | 414 | ReportMetrics(params.render_frame_id, output->actual_mime_type, |
Clark DuVall | 1df2052b | 2019-08-05 19:58:46 | [diff] [blame] | 415 | params.main_frame_origin); |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 416 | } |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 417 | std::move(callback).Run(std::move(output)); |
waffles | 77255cc | 2016-08-02 17:25:12 | [diff] [blame] | 418 | } |
| 419 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 420 | void PluginInfoHostImpl::ReportMetrics(int render_frame_id, |
| 421 | const base::StringPiece& mime_type, |
Steven Holte | f0f4677 | 2017-12-11 20:54:51 | [diff] [blame] | 422 | const url::Origin& main_frame_origin) { |
tommycli | 910b408 | 2017-04-03 17:04:15 | [diff] [blame] | 423 | DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 424 | |
| 425 | content::RenderFrameHost* frame = content::RenderFrameHost::FromID( |
| 426 | context_.render_process_id(), render_frame_id); |
| 427 | content::WebContents* web_contents = |
| 428 | content::WebContents::FromRenderFrameHost(frame); |
| 429 | // This can occur the web contents has already been closed or navigated away. |
| 430 | if (!web_contents) |
| 431 | return; |
| 432 | |
| 433 | if (web_contents->GetBrowserContext()->IsOffTheRecord()) |
| 434 | return; |
| 435 | |
Chris Palmer | ab5e5b5 | 2018-09-28 19:19:30 | [diff] [blame] | 436 | if (main_frame_origin.opaque()) |
tommycli | 910b408 | 2017-04-03 17:04:15 | [diff] [blame] | 437 | return; |
| 438 | |
| 439 | if (mime_type != content::kFlashPluginSwfMimeType && |
| 440 | mime_type != content::kFlashPluginSplMimeType) { |
| 441 | return; |
| 442 | } |
| 443 | |
Steven Holte | f0f4677 | 2017-12-11 20:54:51 | [diff] [blame] | 444 | ukm::builders::Plugins_FlashInstance( |
| 445 | ukm::GetSourceIdForWebContentsDocument(web_contents)) |
| 446 | .Record(ukm::UkmRecorder::Get()); |
tommycli | 910b408 | 2017-04-03 17:04:15 | [diff] [blame] | 447 | } |
| 448 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 449 | void PluginInfoHostImpl::Context::MaybeGrantAccess( |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 450 | chrome::mojom::PluginStatus status, |
[email protected] | 650b2d5 | 2013-02-10 03:41:45 | [diff] [blame] | 451 | const base::FilePath& path) const { |
Nicholas Verne | b5df4f7 | 2017-11-08 09:12:07 | [diff] [blame] | 452 | if (status == chrome::mojom::PluginStatus::kAllowed || |
| 453 | status == chrome::mojom::PluginStatus::kPlayImportantContent) { |
[email protected] | 6be31d20 | 2013-02-01 18:20:54 | [diff] [blame] | 454 | ChromePluginServiceFilter::GetInstance()->AuthorizePlugin( |
| 455 | render_process_id_, path); |
| 456 | } |
| 457 | } |
| 458 | |
Nicholas Verne | d391eae | 2017-11-13 02:41:38 | [diff] [blame] | 459 | bool PluginInfoHostImpl::Context::IsPluginEnabled( |
[email protected] | 4cbbeb4 | 2014-07-22 19:29:38 | [diff] [blame] | 460 | const content::WebPluginInfo& plugin) const { |
| 461 | return plugin_prefs_->IsPluginEnabled(plugin); |
| 462 | } |