chromium/extensions/common/command.cc

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

#include "extensions/common/command.h"

#include <stddef.h>

#include <string_view>

#include "base/check.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "build/android_buildflags.h"
#include "build/build_config.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/manifest_constants.h"
#include "ui/base/accelerators/media_keys_listener.h"

namespace extensions {

errors;
keys;
values;

namespace {

static const char kMissing[] =;

static const char kCommandKeyNotSupported[] =;

#if BUILDFLAG(IS_CHROMEOS)
// ChromeOS supports an additional modifier 'Search', which can result in longer
// sequences.
static const int kMaxTokenSize = 4;
#else
static const int kMaxTokenSize =;
#endif  // BUILDFLAG(IS_CHROMEOS)

bool DoesRequireModifier(const std::string& accelerator) {}

// Parse an |accelerator| for a given platform (specified by |platform_key|) and
// return the result as a ui::Accelerator if successful, or VKEY_UNKNOWN if not.
// |index| is used when constructing an |error| messages to show which command
// in the manifest is failing and |should_parse_media_keys| specifies whether
// media keys are to be considered for parsing.
// Note: If the parsing rules here are changed, make sure to update the
// corresponding extension_command_list.js validation, which validates the user
// input for chrome://extensions/configureCommands.
ui::Accelerator ParseImpl(const std::string& accelerator,
                          const std::string& platform_key,
                          int index,
                          bool should_parse_media_keys,
                          std::u16string* error) {}

// For Mac, we convert "Ctrl" to "Command" and "MacCtrl" to "Ctrl". Other
// platforms leave the shortcut untouched.
std::string NormalizeShortcutSuggestion(const std::string& suggestion,
                                        const std::string& platform) {}

}  // namespace

Command::Command() :{}

Command::Command(const std::string& command_name,
                 const std::u16string& description,
                 const std::string& accelerator,
                 bool global)
    :{}

Command::Command(const Command& other) = default;

Command::~Command() = default;

// static
std::string Command::CommandPlatform() {}

// static
ui::Accelerator Command::StringToAccelerator(const std::string& accelerator,
                                             const std::string& command_name) {}

// static
std::string Command::AcceleratorToString(const ui::Accelerator& accelerator) {}

// static
bool Command::IsMediaKey(const ui::Accelerator& accelerator) {}

// static
bool Command::IsActionRelatedCommand(const std::string& command_name) {}

bool Command::Parse(const base::Value::Dict& command,
                    const std::string& command_name,
                    int index,
                    std::u16string* error) {}

}  // namespace extensions