plugin_utils.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright 2016 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. #ifndef ELECTRON_SHELL_BROWSER_PLUGINS_PLUGIN_UTILS_H_
  5. #define ELECTRON_SHELL_BROWSER_PLUGINS_PLUGIN_UTILS_H_
  6. #include <string>
  7. #include "base/containers/flat_map.h"
  8. namespace content {
  9. class BrowserContext;
  10. }
  11. class PluginUtils {
  12. public:
  13. // disable copy
  14. PluginUtils() = delete;
  15. PluginUtils(const PluginUtils&) = delete;
  16. PluginUtils& operator=(const PluginUtils&) = delete;
  17. // If there's an extension that is allowed to handle |mime_type|, returns its
  18. // ID. Otherwise returns an empty string.
  19. static std::string GetExtensionIdForMimeType(
  20. content::BrowserContext* browser_context,
  21. const std::string& mime_type);
  22. // Returns a map populated with MIME types that are handled by an extension as
  23. // keys and the corresponding extensions Ids as values.
  24. static base::flat_map<std::string, std::string> GetMimeTypeToExtensionIdMap(
  25. content::BrowserContext* browser_context);
  26. };
  27. #endif // ELECTRON_SHELL_BROWSER_PLUGINS_PLUGIN_UTILS_H_