| Index: chrome/browser/plugins/plugin_info_message_filter.cc
|
| diff --git a/chrome/browser/plugins/plugin_info_message_filter.cc b/chrome/browser/plugins/plugin_info_message_filter.cc
|
| index 3e0a715c637cf50fcaabd679684b49db46261e3c..69395b8b494c6047de16fc344b84c2f78f15b36a 100644
|
| --- a/chrome/browser/plugins/plugin_info_message_filter.cc
|
| +++ b/chrome/browser/plugins/plugin_info_message_filter.cc
|
| @@ -11,6 +11,7 @@
|
| #include <utility>
|
|
|
| #include "base/bind.h"
|
| +#include "base/memory/singleton.h"
|
| #include "base/metrics/histogram_macros.h"
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "base/task_runner_util.h"
|
| @@ -35,6 +36,7 @@
|
| #include "components/content_settings/core/browser/content_settings_utils.h"
|
| #include "components/content_settings/core/browser/host_content_settings_map.h"
|
| #include "components/content_settings/core/common/content_settings.h"
|
| +#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
|
| #include "components/prefs/pref_service.h"
|
| #include "components/rappor/rappor_service.h"
|
| #include "content/public/browser/browser_thread.h"
|
| @@ -66,6 +68,25 @@ using content::WebPluginInfo;
|
|
|
| namespace {
|
|
|
| +class ShutdownNotifierFactory
|
| + : public BrowserContextKeyedServiceShutdownNotifierFactory {
|
| + public:
|
| + static ShutdownNotifierFactory* GetInstance() {
|
| + return base::Singleton<ShutdownNotifierFactory>::get();
|
| + }
|
| +
|
| + private:
|
| + friend struct base::DefaultSingletonTraits<ShutdownNotifierFactory>;
|
| +
|
| + ShutdownNotifierFactory()
|
| + : BrowserContextKeyedServiceShutdownNotifierFactory(
|
| + "PluginInfoMessageFilter") {}
|
| +
|
| + ~ShutdownNotifierFactory() override {}
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ShutdownNotifierFactory);
|
| +};
|
| +
|
| #if BUILDFLAG(ENABLE_PEPPER_CDMS)
|
|
|
| enum PluginAvailabilityStatusForUMA {
|
| @@ -178,12 +199,28 @@ PluginInfoMessageFilter::Context::Context(int render_process_id,
|
| PluginInfoMessageFilter::Context::~Context() {
|
| }
|
|
|
| +void PluginInfoMessageFilter::Context::ShutdownOnUIThread() {
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
| + always_authorize_plugins_.Destroy();
|
| + allow_outdated_plugins_.Destroy();
|
| +}
|
| +
|
| PluginInfoMessageFilter::PluginInfoMessageFilter(int render_process_id,
|
| Profile* profile)
|
| : BrowserMessageFilter(ChromeMsgStart),
|
| context_(render_process_id, profile),
|
| main_thread_task_runner_(base::ThreadTaskRunnerHandle::Get()),
|
| weak_ptr_factory_(this) {
|
| + shutdown_notifier_ =
|
| + ShutdownNotifierFactory::GetInstance()->Get(profile)->Subscribe(
|
| + base::Bind(&PluginInfoMessageFilter::ShutdownOnUIThread,
|
| + base::Unretained(this)));
|
| +}
|
| +
|
| +void PluginInfoMessageFilter::ShutdownOnUIThread() {
|
| + DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
| + context_.ShutdownOnUIThread();
|
| + shutdown_notifier_.reset();
|
| }
|
|
|
| bool PluginInfoMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
|
|