blob: 061dd21cbbd1e90b82be3d3bc816ef5369a5c3f6 [file] [log] [blame]
Jeremy Romanb7024742018-06-18 22:00:221// Copyright 2018 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef CONTENT_BROWSER_RENDERER_HOST_PLUGIN_REGISTRY_IMPL_H_
6#define CONTENT_BROWSER_RENDERER_HOST_PLUGIN_REGISTRY_IMPL_H_
7
8#include "base/memory/weak_ptr.h"
9#include "base/time/time.h"
10#include "mojo/public/cpp/bindings/binding_set.h"
11#include "third_party/blink/public/mojom/plugins/plugin_registry.mojom.h"
12
13namespace content {
14
15class ResourceContext;
16struct WebPluginInfo;
17
18class PluginRegistryImpl : public blink::mojom::PluginRegistry {
19 public:
20 explicit PluginRegistryImpl(ResourceContext* resource_context);
21 ~PluginRegistryImpl() override;
22
23 void Bind(blink::mojom::PluginRegistryRequest request);
24
25 // blink::mojom::PluginRegistry
26 void GetPlugins(bool refresh,
27 const url::Origin& main_frame_origin,
28 GetPluginsCallback callback) override;
29
30 private:
31 void GetPluginsComplete(const url::Origin& main_frame_origin,
32 GetPluginsCallback callback,
33 const std::vector<WebPluginInfo>& all_plugins);
34
35 ResourceContext* const resource_context_;
36 mojo::BindingSet<PluginRegistry> bindings_;
37 base::TimeTicks last_plugin_refresh_time_;
Jeremy Roman3bca4bf2019-07-11 03:41:2538 base::WeakPtrFactory<PluginRegistryImpl> weak_factory_{this};
Jeremy Romanb7024742018-06-18 22:00:2239};
40
41} // namespace content
42
43#endif // CONTENT_BROWSER_RENDERER_HOST_PLUGIN_REGISTRY_IMPL_H_