Avi Drissman | 4e1b7bc3 | 2022-09-15 14:03:50 | [diff] [blame] | 1 | // Copyright 2018 The Chromium Authors |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [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 | |
| 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" |
Miyoung Shin | ad0de7f | 2019-09-02 08:55:11 | [diff] [blame] | 10 | #include "mojo/public/cpp/bindings/pending_receiver.h" |
| 11 | #include "mojo/public/cpp/bindings/receiver_set.h" |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 12 | #include "third_party/blink/public/mojom/plugins/plugin_registry.mojom.h" |
| 13 | |
| 14 | namespace content { |
| 15 | |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 16 | struct WebPluginInfo; |
| 17 | |
| 18 | class PluginRegistryImpl : public blink::mojom::PluginRegistry { |
| 19 | public: |
Clark DuVall | 1df2052b | 2019-08-05 19:58:46 | [diff] [blame] | 20 | explicit PluginRegistryImpl(int render_process_id); |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 21 | ~PluginRegistryImpl() override; |
| 22 | |
Miyoung Shin | ad0de7f | 2019-09-02 08:55:11 | [diff] [blame] | 23 | void Bind(mojo::PendingReceiver<blink::mojom::PluginRegistry> receiver); |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 24 | |
| 25 | // blink::mojom::PluginRegistry |
K. Moon | 1829fee | 2022-01-26 02:36:02 | [diff] [blame] | 26 | void GetPlugins(bool refresh, GetPluginsCallback callback) override; |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 27 | |
| 28 | private: |
K. Moon | 1829fee | 2022-01-26 02:36:02 | [diff] [blame] | 29 | void GetPluginsComplete(GetPluginsCallback callback, |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 30 | const std::vector<WebPluginInfo>& all_plugins); |
| 31 | |
Clark DuVall | 1df2052b | 2019-08-05 19:58:46 | [diff] [blame] | 32 | int render_process_id_; |
Miyoung Shin | ad0de7f | 2019-09-02 08:55:11 | [diff] [blame] | 33 | mojo::ReceiverSet<PluginRegistry> receivers_; |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 34 | base::TimeTicks last_plugin_refresh_time_; |
Jeremy Roman | 3bca4bf | 2019-07-11 03:41:25 | [diff] [blame] | 35 | base::WeakPtrFactory<PluginRegistryImpl> weak_factory_{this}; |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 36 | }; |
| 37 | |
| 38 | } // namespace content |
| 39 | |
| 40 | #endif // CONTENT_BROWSER_RENDERER_HOST_PLUGIN_REGISTRY_IMPL_H_ |