87f7625c5d
* chore: bump chromium in DEPS to 96.0.4662.0 * chore: bump chromium in DEPS to 96.0.4663.0 * chore: update patches * [Extensions] Remove RuntimeData entirely https://chromium-review.googlesource.com/c/chromium/src/+/3177328 * Make helper macros behave consistently for //content/public UserData types https://chromium-review.googlesource.com/c/chromium/src/+/3198788 * Enabling sandboxing for the speech recognition service browser tests https://chromium-review.googlesource.com/c/chromium/src/+/3146090 * [devtools] Add 'RegisterPreference' host binding https://chromium-review.googlesource.com/c/chromium/src/+/3162281 * [Reland][Extensions]: Add persistAcrossSessions flag (scripting API) https://chromium-review.googlesource.com/c/chromium/src/+/3175161 * [Bluetooth] Add Passkey prompt dialog for bonding. https://chromium-review.googlesource.com/c/chromium/src/+/2841104 * Clipboard: Remove ReadImage path in browser https://chromium-review.googlesource.com/c/chromium/src/+/3194826 * Split printing metafile code into its own target. https://chromium-review.googlesource.com/c/chromium/src/+/3164925 * Cleanup unused DesktopMediaListObserver params https://chromium-review.googlesource.com/c/chromium/src/+/3179203 * Remove base::DictionaryValue::GetBinary https://chromium-review.googlesource.com/c/chromium/src/+/3201974 * Window Placement: change RWHV::GetDisplayList to GetScreenInfos https://chromium-review.googlesource.com/c/chromium/src/+/3138774 * Add a preview to the Tab Capture picker dialog https://chromium-review.googlesource.com/c/chromium/src/+/3045268 * Add service-based usage to update print settings https://chromium-review.googlesource.com/c/chromium/src/+/3155426 * chore: bump chromium in DEPS to 96.0.4664.2 * chore: update patches * chore: bump chromium in DEPS to 96.0.4664.4 * chore: update patches * chore: bump chromium in DEPS to 97.0.4666.0 * Revert "chore: bump chromium in DEPS to 97.0.4666.0" This reverts commit d73caae8ba4b39efc9b3ea4de52685b9c92ef3d0. * Reland "Block external protocol handler with sandbox." https://chromium-review.googlesource.com/c/chromium/src/+/3198263 * fixup for lint * Add CookiePartitionKeychain parameter to CookeManager.GetCookieList. https://chromium-review.googlesource.com/c/chromium/src/+/3206016 * Move ui/gfx/transform*,rrect*,mask_filter_info* into ui/gfx/geometry https://chromium-review.googlesource.com/c/chromium/src/+/3200392 * fixup Move ui/gfx/transform*,rrect*,mask_filter_info* into ui/gfx/geometry * ozone: //chrome/browser clean up from USE_X11 https://chromium-review.googlesource.com/c/chromium/src/+/3186490 * content: don't load v8 snapshot in browser process https://chromium-review.googlesource.com/c/chromium/src/+/3183394 * [devtools] Add 'RegisterPreference' host binding https://chromium-review.googlesource.com/c/chromium/src/+/3162281 * 3186491: Add 'devtools.sync_preferences' preference https://chromium-review.googlesource.com/c/chromium/src/+/3186491 * 2951147: DCHECK accessible names for focusable Views https://chromium-review.googlesource.com/c/chromium/src/+/2951147 * 3201014: Use real font size for calculation of SmallTextRatio https://chromium-review.googlesource.com/c/chromium/src/+/3201014 * fixup Clipboard: Remove ReadImage path in browser * chore: update patches * fix: disable PlzServiceWorker to fix custom protocol SW script loading Ref: https://chromium-review.googlesource.com/c/chromium/src/+/3199761 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@electronjs.org> Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com> Co-authored-by: John Kleinschmidt <jkleinsc@github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
86 lines
3.8 KiB
Diff
86 lines
3.8 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 1bfe8fb90673a0d0f9f9228a43eafc3b01b00c5f..1484fc4e477b97b6deb8e23b8a749264990cc1c6 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();
|
|
@@ -304,6 +309,11 @@ void SimpleMenuModel::SetLabel(int index, const std::u16string& label) {
|
|
MenuItemsChanged();
|
|
}
|
|
|
|
+void SimpleMenuModel::SetSecondaryLabel(int index, const std::u16string& secondary_label) {
|
|
+ items_[ValidateItemIndex(index)].secondary_label = secondary_label;
|
|
+ MenuItemsChanged();
|
|
+}
|
|
+
|
|
void SimpleMenuModel::SetMinorText(int index,
|
|
const std::u16string& minor_text) {
|
|
items_[ValidateItemIndex(index)].minor_text = minor_text;
|
|
@@ -396,6 +406,12 @@ std::u16string SimpleMenuModel::GetLabelAt(int index) const {
|
|
return items_[ValidateItemIndex(index)].label;
|
|
}
|
|
|
|
+std::u16string SimpleMenuModel::GetSecondaryLabelAt(int index) const {
|
|
+ if (IsItemDynamicAt(index))
|
|
+ return delegate_->GetSecondaryLabelForCommandId(GetCommandIdAt(index));
|
|
+ return items_[ValidateItemIndex(index)].secondary_label;
|
|
+}
|
|
+
|
|
std::u16string SimpleMenuModel::GetMinorTextAt(int 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 60a5e6490d5153772c28551a160ac7c95a744279..e04f0e4d6f9d54cb6b50346ddcbbd16f73135db6 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;
|
|
|
|
@@ -161,6 +162,9 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel {
|
|
// Sets the label for the item at |index|.
|
|
void SetLabel(int index, const std::u16string& label);
|
|
|
|
+ // Sets the secondary_label for the item at |index|.
|
|
+ void SetSecondaryLabel(int index, const std::u16string& secondary_label);
|
|
+
|
|
// Sets the minor text for the item at |index|.
|
|
void SetMinorText(int index, const std::u16string& minor_text);
|
|
|
|
@@ -200,6 +204,7 @@ class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel {
|
|
ui::MenuSeparatorType GetSeparatorTypeAt(int index) const override;
|
|
int GetCommandIdAt(int index) const override;
|
|
std::u16string GetLabelAt(int index) const override;
|
|
+ std::u16string GetSecondaryLabelAt(int index) const override;
|
|
std::u16string GetMinorTextAt(int index) const override;
|
|
ImageModel GetMinorIconAt(int index) const override;
|
|
bool IsItemDynamicAt(int index) const override;
|
|
@@ -239,6 +244,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;
|