electron_plugin_info_host_impl.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // Copyright 2012 The Chromium Authors
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef SHELL_BROWSER_ELECTRON_PLUGIN_INFO_HOST_IMPL_H_
  5. #define SHELL_BROWSER_ELECTRON_PLUGIN_INFO_HOST_IMPL_H_
  6. #include <string>
  7. #include <vector>
  8. #include "shell/common/plugin.mojom.h"
  9. class GURL;
  10. namespace content {
  11. struct WebPluginInfo;
  12. } // namespace content
  13. namespace url {
  14. class Origin;
  15. }
  16. namespace electron {
  17. // Implements ElectronPluginInfoHost interface.
  18. class ElectronPluginInfoHostImpl : public mojom::ElectronPluginInfoHost {
  19. public:
  20. struct GetPluginInfo_Params;
  21. ElectronPluginInfoHostImpl();
  22. ElectronPluginInfoHostImpl(const ElectronPluginInfoHostImpl&) = delete;
  23. ElectronPluginInfoHostImpl& operator=(const ElectronPluginInfoHostImpl&) =
  24. delete;
  25. ~ElectronPluginInfoHostImpl() override;
  26. // mojom::ElectronPluginInfoHost
  27. void GetPluginInfo(const GURL& url,
  28. const url::Origin& origin,
  29. const std::string& mime_type,
  30. GetPluginInfoCallback callback) override;
  31. private:
  32. // |params| wraps the parameters passed to |OnGetPluginInfo|, because
  33. // |base::Bind| doesn't support the required arity <http://crbug.com/98542>.
  34. void PluginsLoaded(const GetPluginInfo_Params& params,
  35. GetPluginInfoCallback callback,
  36. const std::vector<content::WebPluginInfo>& plugins);
  37. base::WeakPtrFactory<ElectronPluginInfoHostImpl> weak_factory_{this};
  38. };
  39. } // namespace electron
  40. #endif // SHELL_BROWSER_ELECTRON_PLUGIN_INFO_HOST_IMPL_H_