chromium/chrome/browser/ui/views/frame/dbus_appmenu.cc

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

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "chrome/browser/ui/views/frame/dbus_appmenu.h"

#include <dlfcn.h>
#include <stddef.h>

#include <limits>
#include <memory>
#include <utility>
#include <vector>

#include "base/check_op.h"
#include "base/containers/contains.h"
#include "base/feature_list.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "build/branding_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/top_sites_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/profiles/profile_metrics.h"
#include "chrome/browser/profiles/profile_window.h"
#include "chrome/browser/sessions/tab_restore_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_live_tab_context.h"
#include "chrome/browser/ui/profiles/profile_picker.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
#include "chrome/browser/ui/views/frame/dbus_appmenu_registrar.h"
#include "chrome/grit/generated_resources.h"
#include "components/bookmarks/common/bookmark_pref_names.h"
#include "components/history/core/browser/top_sites.h"
#include "components/prefs/pref_service.h"
#include "components/sessions/core/tab_restore_service.h"
#include "components/strings/grit/components_strings.h"
#include "dbus/object_path.h"
#include "ui/base/accelerators/menu_label_accelerator_util_linux.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/models/menu_model.h"
#include "ui/base/models/menu_separator_types.h"
#include "ui/events/keycodes/keyboard_code_conversion_x.h"
#include "ui/gfx/text_elider.h"

// A line in the static menu definitions.
struct DbusAppmenuCommand {};

namespace {

// The maximum number of most visited items to display.
const unsigned int kMostVisitedCount =;

// The number of recently closed items to get.
const unsigned int kRecentlyClosedCount =;

// Menus more than this many chars long will get trimmed.
const size_t kMaximumMenuWidthInChars =;

// Constants used in menu definitions.  The first non-Chrome command is at
// IDC_FIRST_UNBOUNDED_MENU.
enum ReservedCommandId {};

constexpr DbusAppmenuCommand kFileMenu[] =;

constexpr DbusAppmenuCommand kEditMenu[] =;

constexpr DbusAppmenuCommand kViewMenu[] =;

constexpr DbusAppmenuCommand kHistoryMenu[] =;

constexpr DbusAppmenuCommand kToolsMenu[] =;

constexpr DbusAppmenuCommand kProfilesMenu[] =;

constexpr DbusAppmenuCommand kHelpMenu[] =;

void FindMenuItemsForCommandAux(
    ui::MenuModel* menu,
    int command,
    std::vector<std::pair<ui::MenuModel*, size_t>>* menu_items) {}

std::vector<std::pair<ui::MenuModel*, size_t>> FindMenuItemsForCommand(
    ui::MenuModel* menu,
    int command) {}

}  // namespace

struct DbusAppmenu::HistoryItem {};

DbusAppmenu::DbusAppmenu(BrowserView* browser_view, uint32_t browser_frame_id)
    :{}

DbusAppmenu::~DbusAppmenu() {}

void DbusAppmenu::Initialize(DbusMenu::InitializedCallback callback) {}

std::string DbusAppmenu::GetPath() const {}

ui::SimpleMenuModel* DbusAppmenu::BuildStaticMenu(
    int string_id,
    const DbusAppmenuCommand* commands) {}

std::unique_ptr<DbusAppmenu::HistoryItem> DbusAppmenu::HistoryItemForTab(
    const sessions::tab_restore::Tab& entry) {}

void DbusAppmenu::AddHistoryItemToMenu(std::unique_ptr<HistoryItem> item,
                                       ui::SimpleMenuModel* menu,
                                       int index) {}

void DbusAppmenu::AddEntryToHistoryMenu(
    SessionID id,
    std::u16string title,
    int index,
    const std::vector<std::unique_ptr<sessions::tab_restore::Tab>>& tabs) {}

void DbusAppmenu::GetTopSitesData() {}

void DbusAppmenu::OnTopSitesReceived(
    const history::MostVisitedURLList& visited_list) {}

void DbusAppmenu::OnBookmarkBarVisibilityChanged() {}

void DbusAppmenu::RebuildProfilesMenu() {}

int DbusAppmenu::ClearHistoryMenuSection(int header_command_id) {}

void DbusAppmenu::RegisterCommandObserver(int command) {}

int DbusAppmenu::NextCommandId() {}

void DbusAppmenu::OnAvatarMenuChanged(AvatarMenu* avatar_menu) {}

void DbusAppmenu::OnBrowserSetLastActive(Browser* browser) {}

void DbusAppmenu::EnabledStateChangedForCommand(int id, bool enabled) {}

void DbusAppmenu::TopSitesLoaded(history::TopSites* top_sites) {}

void DbusAppmenu::TopSitesChanged(history::TopSites* top_sites,
                                  ChangeReason change_reason) {}

void DbusAppmenu::TabRestoreServiceChanged(
    sessions::TabRestoreService* service) {}

void DbusAppmenu::TabRestoreServiceDestroyed(
    sessions::TabRestoreService* service) {}

bool DbusAppmenu::IsCommandIdChecked(int command_id) const {}

bool DbusAppmenu::IsCommandIdEnabled(int command_id) const {}

void DbusAppmenu::ExecuteCommand(int command_id, int event_flags) {}

void DbusAppmenu::OnMenuWillShow(ui::SimpleMenuModel* source) {}

bool DbusAppmenu::GetAcceleratorForCommandId(
    int command_id,
    ui::Accelerator* accelerator) const {}