chromium/components/services/app_service/public/cpp/file_handler.h

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

#ifndef COMPONENTS_SERVICES_APP_SERVICE_PUBLIC_CPP_FILE_HANDLER_H_
#define COMPONENTS_SERVICES_APP_SERVICE_PUBLIC_CPP_FILE_HANDLER_H_

#include <ostream>
#include <set>
#include <string>
#include <vector>

#include "base/containers/flat_set.h"
#include "base/values.h"
#include "components/services/app_service/public/cpp/icon_info.h"
#include "url/gurl.h"

namespace apps {

struct FileHandler {};
FileHandlers;

// Get a set of all MIME types supported by any of |file_handlers|.
std::set<std::string> GetMimeTypesFromFileHandlers(
    const FileHandlers& file_handlers);

// Get a set of all MIME types supported by |file_handler|.
std::set<std::string> GetMimeTypesFromFileHandler(
    const FileHandler& file_handler);

// Get a set of all file extensions supported by any of |file_handlers|.
// Note: These are always transformed to lower-case.
std::set<std::string> GetFileExtensionsFromFileHandlers(
    const FileHandlers& file_handlers);

// Get a set of all file extensions supported by |file_handler|.
// Note: These are always transformed to lower-case.
std::set<std::string> GetFileExtensionsFromFileHandler(
    const FileHandler& file_handler);

bool operator==(const FileHandler::AcceptEntry& accept_entry1,
                const FileHandler::AcceptEntry& accept_entry2);
bool operator==(const FileHandler& file_handler1,
                const FileHandler& file_handler2);

bool operator!=(const FileHandler::AcceptEntry& accept_entry1,
                const FileHandler::AcceptEntry& accept_entry2);
bool operator!=(const FileHandler& file_handler1,
                const FileHandler& file_handler2);

}  // namespace apps

#endif  // COMPONENTS_SERVICES_APP_SERVICE_PUBLIC_CPP_FILE_HANDLER_H_