chromium/services/network/orb/orb_mimetypes.h

// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef SERVICES_NETWORK_ORB_ORB_MIMETYPES_H_
#define SERVICES_NETWORK_ORB_ORB_MIMETYPES_H_

#include <string_view>

#include "base/component_export.h"

namespace network::orb {

// This enum describes how ORB will classify MIME types (content types).
//
// Note that these values are used in histograms, and must not change.
enum class MimeType {};

// Returns whether `mime_type` is a Javascript MIME type based on
// https://mimesniff.spec.whatwg.org/#javascript-mime-type
COMPONENT_EXPORT(NETWORK_SERVICE)
bool IsJavascriptMimeType(std::string_view mime_type);

// Returns the representative mime type enum value of the mime type of
// response. For example, this returns the same value for all text/xml mime
// type families such as application/xml, application/rss+xml.
COMPONENT_EXPORT(NETWORK_SERVICE)
MimeType GetCanonicalMimeType(std::string_view mime_type);
}  // namespace network::orb

#endif  // SERVICES_NETWORK_ORB_ORB_MIMETYPES_H_