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 | |
| 15 | class ResourceContext; |
| 16 | struct WebPluginInfo; |
| 17 | |
| 18 | class 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 Roman | 3bca4bf | 2019-07-11 03:41:25 | [diff] [blame^] | 38 | base::WeakPtrFactory<PluginRegistryImpl> weak_factory_{this}; |
Jeremy Roman | b702474 | 2018-06-18 22:00:22 | [diff] [blame] | 39 | }; |
| 40 | |
| 41 | } // namespace content |
| 42 | |
| 43 | #endif // CONTENT_BROWSER_RENDERER_HOST_PLUGIN_REGISTRY_IMPL_H_ |