Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 1 | // 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 | |
| 13 | namespace content { |
| 14 | |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 15 | struct WebPluginInfo; |
| 16 | |
| 17 | class PluginRegistryImpl : public blink::mojom::PluginRegistry { |
| 18 | public: |
Clark DuVall | 1df2052b | 2019-08-05 19:58:46 | [diff] [blame^] | 19 | explicit PluginRegistryImpl(int render_process_id); |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 20 | ~PluginRegistryImpl() override; |
| 21 | |
| 22 | void Bind(blink::mojom::PluginRegistryRequest request); |
| 23 | |
| 24 | // blink::mojom::PluginRegistry |
| 25 | void GetPlugins(bool refresh, |
| 26 | const url::Origin& main_frame_origin, |
| 27 | GetPluginsCallback callback) override; |
| 28 | |
| 29 | private: |
| 30 | void GetPluginsComplete(const url::Origin& main_frame_origin, |
| 31 | GetPluginsCallback callback, |
| 32 | const std::vector<WebPluginInfo>& all_plugins); |
| 33 | |
Clark DuVall | 1df2052b | 2019-08-05 19:58:46 | [diff] [blame^] | 34 | int render_process_id_; |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 35 | mojo::BindingSet<PluginRegistry> bindings_; |
| 36 | base::TimeTicks last_plugin_refresh_time_; |
Jeremy Roman | 3bca4bf | 2019-07-11 03:41:25 | [diff] [blame] | 37 | base::WeakPtrFactory<PluginRegistryImpl> weak_factory_{this}; |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 38 | }; |
| 39 | |
| 40 | } // namespace content |
| 41 | |
| 42 | #endif // CONTENT_BROWSER_RENDERER_HOST_PLUGIN_REGISTRY_IMPL_H_ |