chromium/chrome/common/extensions/permissions/chrome_permission_message_rules.cc

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

#include "chrome/common/extensions/permissions/chrome_permission_message_rules.h"

#include <initializer_list>
#include <iterator>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "base/feature_list.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/grit/generated_resources.h"
#include "components/device_signals/core/common/signals_features.h"
#include "extensions/common/mojom/api_permission_id.mojom.h"
#include "ui/base/l10n/l10n_util.h"

APIPermissionID;

namespace extensions {

namespace {

// The default formatter for a permission message. Simply displays the message
// with the given ID.
class DefaultPermissionMessageFormatter
    : public ChromePermissionMessageFormatter {};

// A formatter that substitutes the parameter into the message using string
// formatting.
// NOTE: Only one permission with the given ID is substituted using this rule.
class SingleParameterFormatter : public ChromePermissionMessageFormatter {};

// Adds each parameter to a growing list, with the given |root_message_id| as
// the message at the top of the list.
class SimpleListFormatter : public ChromePermissionMessageFormatter {};

// Creates a space-separated list of permissions with the given PermissionID.
// The list is inserted into the messages with the given IDs: one for the case
// where there is a single permission, and the other for the case where there
// are multiple.
// TODO(sashab): Extend this to pluralize correctly in all languages.
class SpaceSeparatedListFormatter : public ChromePermissionMessageFormatter {};

// Creates a list of host permissions. If there are 1-3 hosts, they are inserted
// directly into a message with a given ID. If there are more than 3, they are
// displayed as list of submessages instead.
class HostListFormatter : public ChromePermissionMessageFormatter {};

class USBDevicesFormatter : public ChromePermissionMessageFormatter {};

int GetEnterpriseReportingPrivatePermissionMessageId() {}

}  // namespace

ChromePermissionMessageRule::ChromePermissionMessageRule(
    int message_id,
    const std::initializer_list<APIPermissionID>& required,
    const std::initializer_list<APIPermissionID>& optional)
    :{}

ChromePermissionMessageRule::ChromePermissionMessageRule(
    std::unique_ptr<ChromePermissionMessageFormatter> formatter,
    const std::initializer_list<APIPermissionID>& required,
    const std::initializer_list<APIPermissionID>& optional)
    :{}

ChromePermissionMessageRule::ChromePermissionMessageRule(
    ChromePermissionMessageRule&& other) = default;

ChromePermissionMessageRule& ChromePermissionMessageRule::operator=(
    ChromePermissionMessageRule&& other) = default;

ChromePermissionMessageRule::~ChromePermissionMessageRule() {}

std::set<APIPermissionID> ChromePermissionMessageRule::required_permissions()
    const {}
std::set<APIPermissionID> ChromePermissionMessageRule::optional_permissions()
    const {}

std::set<APIPermissionID> ChromePermissionMessageRule::all_permissions() const {}

PermissionMessage ChromePermissionMessageRule::GetPermissionMessage(
    const PermissionIDSet& permissions) const {}

// static
std::vector<ChromePermissionMessageRule>
ChromePermissionMessageRule::GetAllRules() {}

}  // namespace extensions