#include "chrome/browser/ui/views/frame/system_menu_model_builder.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/toolbar/app_menu_model.h"
#include "chrome/browser/ui/ui_features.h"
#include "chrome/browser/ui/web_applications/app_browser_controller.h"
#include "chrome/common/chrome_features.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/grit/generated_resources.h"
#include "components/strings/grit/components_strings.h"
#include "ui/base/accelerators/accelerator.h"
#include "ui/base/models/simple_menu_model.h"
#if BUILDFLAG(IS_CHROMEOS)
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/browser/ui/settings_window_manager_chromeos.h"
#include "chromeos/strings/grit/chromeos_strings.h"
#include "chromeos/ui/frame/desks/move_to_desks_menu_delegate.h"
#include "chromeos/ui/frame/desks/move_to_desks_menu_model.h"
#include "components/account_id/account_id.h"
#include "components/user_manager/user.h"
#include "components/user_manager/user_manager.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/views/widget/widget.h"
#endif
#if BUILDFLAG(IS_CHROMEOS_ASH)
#include "ash/public/cpp/multi_user_window_manager.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_util.h"
#include "chrome/browser/ui/ash/multi_user/multi_user_window_manager_helper.h"
#endif
#if BUILDFLAG(IS_OZONE) && !BUILDFLAG(IS_CHROMEOS)
#include "ui/ozone/public/ozone_platform.h"
#endif
SystemMenuModelBuilder::SystemMenuModelBuilder(
ui::AcceleratorProvider* provider,
Browser* browser)
: … { … }
SystemMenuModelBuilder::~SystemMenuModelBuilder() = default;
void SystemMenuModelBuilder::Init() { … }
void SystemMenuModelBuilder::BuildMenu(ui::SimpleMenuModel* model) { … }
void SystemMenuModelBuilder::BuildSystemMenuForBrowserWindow(
ui::SimpleMenuModel* model) { … }
void SystemMenuModelBuilder::BuildSystemMenuForAppOrPopupWindow(
ui::SimpleMenuModel* model) { … }
#if BUILDFLAG(IS_CHROMEOS)
void SystemMenuModelBuilder::AppendMoveToDesksMenu(ui::SimpleMenuModel* model) {
gfx::NativeWindow window =
menu_delegate_.browser()->window()->GetNativeWindow();
if (!chromeos::MoveToDesksMenuDelegate::ShouldShowMoveToDesksMenu(window))
return;
model->AddSeparator(ui::NORMAL_SEPARATOR);
move_to_desks_model_ = std::make_unique<chromeos::MoveToDesksMenuModel>(
std::make_unique<chromeos::MoveToDesksMenuDelegate>(
views::Widget::GetWidgetForNativeWindow(window)));
model->AddSubMenuWithStringId(chromeos::MoveToDesksMenuModel::kMenuCommandId,
IDS_MOVE_TO_DESKS_MENU,
move_to_desks_model_.get());
}
#endif
void SystemMenuModelBuilder::AppendTeleportMenu(ui::SimpleMenuModel* model) { … }