cfc0826b65
* chore: bump chromium in DEPS to 117.0.5899.0 * 4686653: webui: Filter out non-chrome scheme URLs in WebUIConfigMap https://chromium-review.googlesource.com/c/chromium/src/+/4686653 * 4696355: Remove deprecated version of base::CommandLine::CopySwitchesFrom() https://chromium-review.googlesource.com/c/chromium/src/+/4696355 * chore: fixup patch indices * 4603888: Reland "Enable raw_ref check on linux" https://chromium-review.googlesource.com/c/chromium/src/+/4603888 * chore: bump chromium in DEPS to 117.0.5901.0 * chore: update patches * chore: bump chromium in DEPS to 117.0.5903.0 * chore: bump chromium in DEPS to 117.0.5903.2 * chore: bump chromium in DEPS to 117.0.5905.0 * 4706792: Printing: Add debug code for a DispatchBeforePrintEvent() failure https://chromium-review.googlesource.com/c/chromium/src/+/4706792 * 4704786: Refactor libunwind build rules/flags https://chromium-review.googlesource.com/c/chromium/src/+/4704786 * 4701710: [Linux Ui] Set toolkit dark preference based on FDO dark preference https://chromium-review.googlesource.com/c/chromium/src/+/4701710 * chore: fixup patch indices * chore: bump chromium in DEPS to 117.0.5907.0 * chore: bump chromium in DEPS to 117.0.5909.2 * chore: update patches * chore: bump chromium in DEPS to 117.0.5911.0 * chore: update patches * chore: build-what-we-include * fix: set allowFileAccess on devtools extensions correctly Ref: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/4714725 * 4670615: Reland "[iterator-helpers] Shipping iterator helpers" https://chromium-review.googlesource.com/c/v8/v8/+/4670615 --------- Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: Samuel Attard <marshallofsound@electronjs.org>
86 lines
3.9 KiB
Diff
86 lines
3.9 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: deepak1556 <hop2deep@gmail.com>
|
|
Date: Thu, 21 May 2020 13:58:01 -0700
|
|
Subject: Allow setting secondary label via SimpleMenuModel
|
|
|
|
Builds on https://chromium-review.googlesource.com/c/chromium/src/+/2208976
|
|
|
|
diff --git a/ui/base/models/simple_menu_model.cc b/ui/base/models/simple_menu_model.cc
|
|
index 7c13717b3d397310bc66ae77928cb4f42730496c..2980b8ddf0a58d74f98fc2136f537185a5596149 100644
|
|
--- a/ui/base/models/simple_menu_model.cc
|
|
+++ b/ui/base/models/simple_menu_model.cc
|
|
@@ -48,6 +48,11 @@ std::u16string SimpleMenuModel::Delegate::GetLabelForCommandId(
|
|
return std::u16string();
|
|
}
|
|
|
|
+std::u16string SimpleMenuModel::Delegate::GetSecondaryLabelForCommandId(
|
|
+ int command_id) const {
|
|
+ return std::u16string();
|
|
+}
|
|
+
|
|
ImageModel SimpleMenuModel::Delegate::GetIconForCommandId(
|
|
int command_id) const {
|
|
return ImageModel();
|
|
@@ -333,6 +338,11 @@ void SimpleMenuModel::SetLabel(size_t index, const std::u16string& label) {
|
|
MenuItemsChanged();
|
|
}
|
|
|
|
+void SimpleMenuModel::SetSecondaryLabel(size_t index, const std::u16string& secondary_label) {
|
|
+ items_[ValidateItemIndex(index)].secondary_label = secondary_label;
|
|
+ MenuItemsChanged();
|
|
+}
|
|
+
|
|
void SimpleMenuModel::SetMinorText(size_t index,
|
|
const std::u16string& minor_text) {
|
|
items_[ValidateItemIndex(index)].minor_text = minor_text;
|
|
@@ -426,6 +436,12 @@ std::u16string SimpleMenuModel::GetLabelAt(size_t index) const {
|
|
return items_[ValidateItemIndex(index)].label;
|
|
}
|
|
|
|
+std::u16string SimpleMenuModel::GetSecondaryLabelAt(size_t index) const {
|
|
+ if (IsItemDynamicAt(index))
|
|
+ return delegate_->GetSecondaryLabelForCommandId(GetCommandIdAt(index));
|
|
+ return items_[ValidateItemIndex(index)].secondary_label;
|
|
+}
|
|
+
|
|
std::u16string SimpleMenuModel::GetMinorTextAt(size_t index) const {
|
|
return items_[ValidateItemIndex(index)].minor_text;
|
|
}
|
|
diff --git a/ui/base/models/simple_menu_model.h b/ui/base/models/simple_menu_model.h
|
|
index c507638d611613f267e0e4adf09c5d050afa5267..3eb9036708d459c7657085f7ca4d55c1a181ffc3 100644
|
|
--- a/ui/base/models/simple_menu_model.h
|
|
+++ b/ui/base/models/simple_menu_model.h
|
|
@@ -50,6 +50,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel {
|
|
// Some command ids have labels and icons that change over time.
|
|
virtual bool IsItemForCommandIdDynamic(int command_id) const;
|
|
virtual std::u16string GetLabelForCommandId(int command_id) const;
|
|
+ virtual std::u16string GetSecondaryLabelForCommandId(int command_id) const;
|
|
// Gets the icon for the item with the specified id.
|
|
virtual ImageModel GetIconForCommandId(int command_id) const;
|
|
|
|
@@ -169,6 +170,9 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel {
|
|
// Sets the label for the item at |index|.
|
|
void SetLabel(size_t index, const std::u16string& label);
|
|
|
|
+ // Sets the secondary_label for the item at |index|.
|
|
+ void SetSecondaryLabel(size_t index, const std::u16string& secondary_label);
|
|
+
|
|
// Sets the minor text for the item at |index|.
|
|
void SetMinorText(size_t index, const std::u16string& minor_text);
|
|
|
|
@@ -208,6 +212,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel {
|
|
ui::MenuSeparatorType GetSeparatorTypeAt(size_t index) const override;
|
|
int GetCommandIdAt(size_t index) const override;
|
|
std::u16string GetLabelAt(size_t index) const override;
|
|
+ std::u16string GetSecondaryLabelAt(size_t index) const override;
|
|
std::u16string GetMinorTextAt(size_t index) const override;
|
|
ImageModel GetMinorIconAt(size_t index) const override;
|
|
bool IsItemDynamicAt(size_t index) const override;
|
|
@@ -247,6 +252,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel {
|
|
int command_id = 0;
|
|
ItemType type = TYPE_COMMAND;
|
|
std::u16string label;
|
|
+ std::u16string secondary_label;
|
|
std::u16string minor_text;
|
|
ImageModel minor_icon;
|
|
ImageModel icon;
|