2e4e6f10de
* chore: bump chromium in DEPS to 122.0.6223.0 * 5129828: Removes special cases for selenium-atoms dependencies. https://chromium-review.googlesource.com/c/chromium/src/+/5129828 * chore: fixup patch indices * 5139789: Deduplicate BrowserContext's ResourceContext https://chromium-review.googlesource.com/c/chromium/src/+/5139789 * 5148579: Simplify SelectFileDialog::Listener https://chromium-review.googlesource.com/c/chromium/src/+/5148579 * 5134038: Code Health: Use string_view in base::i18n::BreakIterator::SetText https://chromium-review.googlesource.com/c/chromium/src/+/5134038 * 5137427: Code Health: Use string_view in SpellCheck::SpellCheckWord https://chromium-review.googlesource.com/c/chromium/src/+/5137427 * [libcxx] adds ranges::fold_left_with_iter and ranges::fold_left Notable things in this commit: * refactors `__indirect_binary_left_foldable`, making it slightly different (but equivalent) to _`indirect-binary-left-foldable`_, which improves readability (a [patch to the Working Paper][patch] was made) * omits `__cpo` namespace, since it is not required for implementing niebloids (a cleanup should happen in 2024) * puts tests ensuring invocable robustness and dangling correctness inside the correctness testing to ensure that the algorithms' results are still correct [patch]: https://github.com/cplusplus/draft/pull/6734 * chore: bump chromium in DEPS to 122.0.6224.0 * 5154766: [Refresh 2023] [GTK] Fix gap above toolbar with fractional scaling https://chromium-review.googlesource.com/c/chromium/src/+/5154766 * chore: fixup patch indices * 5094458: Remove extra CGColorSpace parameters from skia and ui helpers https://chromium-review.googlesource.com/c/chromium/src/+/5094458 * chore: bump chromium in DEPS to 122.0.6226.0 * chore: update patches * chore: bump chromium in DEPS to 122.0.6227.0 * chore: update patches * chore: bump chromium in DEPS to 122.0.6228.0 * chore: update patches * chore: bump chromium in DEPS to 122.0.6230.0 * chore: bump chromium in DEPS to 122.0.6232.0 * chore: bump chromium in DEPS to 122.0.6234.0 * chore: bump chromium in DEPS to 122.0.6236.2 * chore: update patches * fix: remove --disable-color-correct-renderering Per https://electronhq.slack.com/archives/CB6CG54DB/p1698444047862459 it is not used any more and was never documented. * chore: add WEB_PRINTING to content permission converter Unused in non-cros so no need to document Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5136178 * chore: Views is now vec<raw_ptr> instead of raw<T*> Ref: https://chromium-review.googlesource.com/c/chromium/src/+/5140028 * spec: add Iterator to global intrinsics --------- 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 ffafdacb3e0171f81d22fa1736012b92e9df2ba9..dad79e82221c15b887cfde9a35ff7447989da62a 100644
|
|
--- a/ui/base/models/simple_menu_model.cc
|
|
+++ b/ui/base/models/simple_menu_model.cc
|
|
@@ -53,6 +53,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();
|
|
@@ -338,6 +343,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;
|
|
@@ -428,6 +438,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 1539464b1942db2a5e493022109a1c8dc247dc5a..b3979cbccf8eb2f0145e050e11ecbb6303c38d46 100644
|
|
--- a/ui/base/models/simple_menu_model.h
|
|
+++ b/ui/base/models/simple_menu_model.h
|
|
@@ -55,6 +55,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;
|
|
|
|
@@ -174,6 +175,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);
|
|
|
|
@@ -216,6 +220,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;
|
|
@@ -255,6 +260,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;
|