chore: bump chromium to f755b70e34659441e72c1a928a406 (master) (#21000)

This commit is contained in:
Electron Bot 2019-12-10 16:22:35 -08:00 committed by Jeremy Apthorp
parent a5c9bd53e0
commit 49b47ee4ed
181 changed files with 1117 additions and 1786 deletions

View file

@ -112,7 +112,7 @@ index a258d038da4a2bbfc6ec13c250781166235c1fbc..f6dbaa19cdb8938204c3452622589708
+ EXPECT_EQ(7, changed_count());
}
diff --git a/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc b/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc
index 654d0bf906c4785321a1fcdad9e12a22dbbbc170..6159eca4a400112f10647defe857c72740ff2779 100644
index 1d7f5dc3abe95ffaa847454e2be1e9872fedc287..6e67fff6631d2d5339df6a912d917862bce37f3d 100644
--- a/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc
+++ b/chrome/browser/ui/views/menu_item_view_interactive_uitest.cc
@@ -91,8 +91,8 @@ class MenuItemViewTestInsert : public MenuTestBase {
@ -180,10 +180,10 @@ index 73f0ab6d84d2cab6732866a6dc4b781faf630c0e..3319d058e8303066e0159d02d27ee2e8
return base::string16();
}
diff --git a/ui/base/models/menu_model.h b/ui/base/models/menu_model.h
index b0ae539ba1dc5a4c11390267c3053058e92e7f34..1e28cd2b1bc66d512ea4e0b8ae62bc8ec03d7a1b 100644
index 5bcc6204c2b579fb2cba47ba1bc156967ec87faf..34e647d56dfe583a3484fb8df0a148064eacb07b 100644
--- a/ui/base/models/menu_model.h
+++ b/ui/base/models/menu_model.h
@@ -65,6 +65,10 @@ class UI_BASE_EXPORT MenuModel : public base::SupportsWeakPtr<MenuModel> {
@@ -67,6 +67,10 @@ class UI_BASE_EXPORT MenuModel : public base::SupportsWeakPtr<MenuModel> {
// Returns the label of the item at the specified index.
virtual base::string16 GetLabelAt(int index) const = 0;
@ -195,10 +195,10 @@ index b0ae539ba1dc5a4c11390267c3053058e92e7f34..1e28cd2b1bc66d512ea4e0b8ae62bc8e
// is rendered to the right of the label and using the font GetLabelFontAt().
virtual base::string16 GetMinorTextAt(int index) const;
diff --git a/ui/base/models/simple_menu_model.cc b/ui/base/models/simple_menu_model.cc
index 0aeeb3e47074590834de6d9ca7e3eb7dbf6a7793..5efc0589644e243a095765710302af992d53f5b8 100644
index 6a55c0f82ce3df3d8b2b31dbb67830bb5464019c..c42dee1fc9ddccf5b5556fff7282a64d14c8333d 100644
--- a/ui/base/models/simple_menu_model.cc
+++ b/ui/base/models/simple_menu_model.cc
@@ -42,6 +42,11 @@ base::string16 SimpleMenuModel::Delegate::GetLabelForCommandId(
@@ -46,6 +46,16 @@ base::string16 SimpleMenuModel::Delegate::GetLabelForCommandId(
return base::string16();
}
@ -207,22 +207,15 @@ index 0aeeb3e47074590834de6d9ca7e3eb7dbf6a7793..5efc0589644e243a095765710302af99
+ return base::string16();
+}
+
base::string16 SimpleMenuModel::Delegate::GetMinorTextForCommandId(
int command_id) const {
return base::string16();
@@ -324,6 +329,11 @@ void SimpleMenuModel::SetLabel(int index, const base::string16& label) {
MenuItemsChanged();
}
+void SimpleMenuModel::SetSublabel(int index, const base::string16& sublabel) {
+ items_[ValidateItemIndex(index)].sublabel = sublabel;
+ MenuItemsChanged();
+}
+
void SimpleMenuModel::SetMinorText(int index,
const base::string16& minor_text) {
items_[ValidateItemIndex(index)].minor_text = minor_text;
@@ -398,6 +408,12 @@ base::string16 SimpleMenuModel::GetLabelAt(int index) const {
bool SimpleMenuModel::Delegate::GetIconForCommandId(
int command_id, gfx::Image* image_skia) const {
return false;
@@ -404,6 +414,12 @@ base::string16 SimpleMenuModel::GetLabelAt(int index) const {
return items_[ValidateItemIndex(index)].label;
}
@ -233,27 +226,21 @@ index 0aeeb3e47074590834de6d9ca7e3eb7dbf6a7793..5efc0589644e243a095765710302af99
+}
+
base::string16 SimpleMenuModel::GetMinorTextAt(int index) const {
if (IsItemDynamicAt(index))
return delegate_->GetMinorTextForCommandId(GetCommandIdAt(index));
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 3cc9d686da8f64ddc8bdc66df40b1866bdd20607..dfacbdd4a55b5f5aa4d8c67136c607f75a880278 100644
index 1ae8909a1404a43b34b9ef585511c7a3de39fa28..0d2a74ab5e9d55201a4992d81aecf9c2a83af5b8 100644
--- a/ui/base/models/simple_menu_model.h
+++ b/ui/base/models/simple_menu_model.h
@@ -44,10 +44,11 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
// Delegate should return true if |command_id| should be visible.
virtual bool IsCommandIdVisible(int command_id) const;
- // Some command ids have labels, minor text and icons that change over
- // time.
+ // Some command ids have labels, sublabels, minor text and icons that change
+ // over time.
@@ -47,6 +47,7 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
// Some command ids have labels and icons that change over time.
virtual bool IsItemForCommandIdDynamic(int command_id) const;
virtual base::string16 GetLabelForCommandId(int command_id) const;
+ virtual base::string16 GetSublabelForCommandId(int command_id) const;
virtual base::string16 GetMinorTextForCommandId(int command_id) const;
// Gets the icon for the item with the specified id, returning true if there
// is an icon, false otherwise.
@@ -175,6 +176,9 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
virtual bool GetIconForCommandId(int command_id,
@@ -174,6 +175,9 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
// Sets the label for the item at |index|.
void SetLabel(int index, const base::string16& label);
@ -263,7 +250,7 @@ index 3cc9d686da8f64ddc8bdc66df40b1866bdd20607..dfacbdd4a55b5f5aa4d8c67136c607f7
// Sets the minor text for the item at |index|.
void SetMinorText(int index, const base::string16& minor_text);
@@ -201,6 +205,7 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
@@ -200,6 +204,7 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
ui::MenuSeparatorType GetSeparatorTypeAt(int index) const override;
int GetCommandIdAt(int index) const override;
base::string16 GetLabelAt(int index) const override;
@ -271,7 +258,7 @@ index 3cc9d686da8f64ddc8bdc66df40b1866bdd20607..dfacbdd4a55b5f5aa4d8c67136c607f7
base::string16 GetMinorTextAt(int index) const override;
const gfx::VectorIcon* GetMinorIconAt(int index) const override;
bool IsItemDynamicAt(int index) const override;
@@ -236,6 +241,7 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
@@ -235,6 +240,7 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
int command_id = 0;
ItemType type = TYPE_COMMAND;
base::string16 label;
@ -280,10 +267,10 @@ index 3cc9d686da8f64ddc8bdc66df40b1866bdd20607..dfacbdd4a55b5f5aa4d8c67136c607f7
const gfx::VectorIcon* minor_icon = nullptr;
gfx::Image icon;
diff --git a/ui/views/controls/menu/menu_item_view.cc b/ui/views/controls/menu/menu_item_view.cc
index 0fcca1e59688eda967c59397ea932637810af27b..35e7e3dc8f18fffa1713d6821c2bef87bdfce181 100644
index e86941132ce80e262d1961ff3cdad79b44abb878..6e67ffea103e7169d35b37455ded83d8d812d77b 100644
--- a/ui/views/controls/menu/menu_item_view.cc
+++ b/ui/views/controls/menu/menu_item_view.cc
@@ -277,6 +277,7 @@ MenuItemView* MenuItemView::AddMenuItemAt(
@@ -278,6 +278,7 @@ MenuItemView* MenuItemView::AddMenuItemAt(
int index,
int item_id,
const base::string16& label,
@ -291,7 +278,7 @@ index 0fcca1e59688eda967c59397ea932637810af27b..35e7e3dc8f18fffa1713d6821c2bef87
const base::string16& minor_text,
const gfx::VectorIcon* minor_icon,
const gfx::ImageSkia& icon,
@@ -297,6 +298,7 @@ MenuItemView* MenuItemView::AddMenuItemAt(
@@ -298,6 +299,7 @@ MenuItemView* MenuItemView::AddMenuItemAt(
item->SetTitle(GetDelegate()->GetLabel(item_id));
else
item->SetTitle(label);
@ -299,45 +286,24 @@ index 0fcca1e59688eda967c59397ea932637810af27b..35e7e3dc8f18fffa1713d6821c2bef87
item->SetMinorText(minor_text);
item->SetMinorIcon(minor_icon);
if (vector_icon) {
@@ -338,21 +340,23 @@ void MenuItemView::RemoveAllMenuItems() {
@@ -339,21 +341,22 @@ void MenuItemView::RemoveAllMenuItems() {
MenuItemView* MenuItemView::AppendMenuItem(int item_id,
const base::string16& label,
Type type) {
- return AppendMenuItemImpl(item_id, label, base::string16(), nullptr,
- gfx::ImageSkia(), type, ui::NORMAL_SEPARATOR);
+ return AppendMenuItemImpl(item_id, label, base::string16(), base::string16(),
+ nullptr, gfx::ImageSkia(), type,
+ ui::NORMAL_SEPARATOR);
const gfx::ImageSkia& icon) {
- return AppendMenuItemImpl(item_id, label, icon, NORMAL);
+ return AppendMenuItemImpl(item_id, label, base::string16(), icon, NORMAL);
}
MenuItemView* MenuItemView::AppendSubMenu(int item_id,
const base::string16& label) {
- return AppendMenuItemImpl(item_id, label, base::string16(), nullptr,
- gfx::ImageSkia(), SUBMENU, ui::NORMAL_SEPARATOR);
+ return AppendMenuItemImpl(item_id, label, base::string16(), base::string16(),
+ nullptr, gfx::ImageSkia(), SUBMENU,
+ ui::NORMAL_SEPARATOR);
}
MenuItemView* MenuItemView::AppendSubMenuWithIcon(int item_id,
const base::string16& label,
const gfx::ImageSkia& icon) {
- return AppendMenuItemImpl(item_id, label, base::string16(), nullptr, icon,
- SUBMENU, ui::NORMAL_SEPARATOR);
+ return AppendMenuItemImpl(item_id, label, base::string16(), base::string16(),
+ nullptr, icon, SUBMENU, ui::NORMAL_SEPARATOR);
}
MenuItemView* MenuItemView::AppendMenuItemWithLabel(
@@ -366,12 +370,14 @@ MenuItemView* MenuItemView::AppendDelegateMenuItem(int item_id) {
const base::string16& label,
const gfx::ImageSkia& icon) {
- return AppendMenuItemImpl(item_id, label, icon, SUBMENU);
+ return AppendMenuItemImpl(item_id, label, base::string16(), icon, SUBMENU);
}
void MenuItemView::AppendSeparator() {
- AppendMenuItemImpl(0, base::string16(), base::string16(), nullptr,
- gfx::ImageSkia(), SEPARATOR, ui::NORMAL_SEPARATOR);
+ AppendMenuItemImpl(0, base::string16(), base::string16(), base::string16(),
+ nullptr, gfx::ImageSkia(), SEPARATOR,
+ ui::NORMAL_SEPARATOR);
- AppendMenuItemImpl(0, base::string16(), gfx::ImageSkia(), SEPARATOR);
+ AppendMenuItemImpl(0, base::string16(), base::string16(), gfx::ImageSkia(), SEPARATOR);
}
void MenuItemView::AddSeparatorAt(int index) {
@ -346,34 +312,20 @@ index 0fcca1e59688eda967c59397ea932637810af27b..35e7e3dc8f18fffa1713d6821c2bef87
/*minor_text=*/base::string16(), /*minor_icon=*/nullptr,
/*icon=*/gfx::ImageSkia(), /*vector_icon=*/nullptr,
/*type=*/SEPARATOR,
@@ -381,21 +387,22 @@ void MenuItemView::AddSeparatorAt(int index) {
MenuItemView* MenuItemView::AppendMenuItemWithIcon(int item_id,
const base::string16& label,
const gfx::ImageSkia& icon) {
- return AppendMenuItemImpl(item_id, label, base::string16(), nullptr, icon,
- NORMAL, ui::NORMAL_SEPARATOR);
+ return AppendMenuItemImpl(item_id, label, base::string16(), base::string16(),
+ nullptr, icon, NORMAL, ui::NORMAL_SEPARATOR);
}
@@ -362,10 +365,11 @@ void MenuItemView::AddSeparatorAt(int index) {
MenuItemView* MenuItemView::AppendMenuItemImpl(
int item_id,
const base::string16& label,
+ const base::string16& sublabel,
const base::string16& minor_text,
const gfx::VectorIcon* minor_icon,
const gfx::ImageSkia& icon,
Type type,
ui::MenuSeparatorType separator_style) {
MenuItemView* MenuItemView::AppendMenuItemImpl(int item_id,
const base::string16& label,
+ const base::string16& sublabel,
const gfx::ImageSkia& icon,
Type type) {
const int index = submenu_ ? int{submenu_->children().size()} : 0;
- return AddMenuItemAt(index, item_id, label, minor_text, minor_icon, icon,
- nullptr, type, separator_style);
+ return AddMenuItemAt(index, item_id, label, sublabel, minor_text, minor_icon,
+ icon, nullptr, type, separator_style);
- return AddMenuItemAt(index, item_id, label, base::string16(), nullptr, icon,
+ return AddMenuItemAt(index, item_id, label, sublabel, base::string16(), nullptr, icon,
nullptr, type, ui::NORMAL_SEPARATOR);
}
SubmenuView* MenuItemView::CreateSubmenu() {
@@ -427,6 +434,11 @@ void MenuItemView::SetTitle(const base::string16& title) {
@@ -398,6 +402,11 @@ void MenuItemView::SetTitle(const base::string16& title) {
invalidate_dimensions(); // Triggers preferred size recalculation.
}
@ -385,7 +337,7 @@ index 0fcca1e59688eda967c59397ea932637810af27b..35e7e3dc8f18fffa1713d6821c2bef87
void MenuItemView::SetMinorText(const base::string16& minor_text) {
minor_text_ = minor_text;
invalidate_dimensions(); // Triggers preferred size recalculation.
@@ -1016,13 +1028,23 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
@@ -987,13 +996,23 @@ void MenuItemView::PaintButton(gfx::Canvas* canvas, PaintButtonMode mode) {
(!delegate ||
delegate->ShouldReserveSpaceForSubmenuIndicator() ?
item_right_margin_ : config.arrow_to_edge_padding);
@ -410,7 +362,7 @@ index 0fcca1e59688eda967c59397ea932637810af27b..35e7e3dc8f18fffa1713d6821c2bef87
PaintMinorIconAndText(canvas, style);
// Set the submenu indicator (arrow) image and color.
@@ -1274,6 +1296,11 @@ MenuItemView::MenuItemDimensions MenuItemView::CalculateDimensions() const {
@@ -1244,6 +1263,11 @@ MenuItemView::MenuItemDimensions MenuItemView::CalculateDimensions() const {
// Determine the length of the label text.
int string_width = gfx::GetStringWidth(title_, style.font_list);
@ -422,7 +374,7 @@ index 0fcca1e59688eda967c59397ea932637810af27b..35e7e3dc8f18fffa1713d6821c2bef87
dimensions.standard_width = string_width + label_start +
item_right_margin_;
// Determine the length of the right-side text.
@@ -1281,9 +1308,10 @@ MenuItemView::MenuItemDimensions MenuItemView::CalculateDimensions() const {
@@ -1251,9 +1275,10 @@ MenuItemView::MenuItemDimensions MenuItemView::CalculateDimensions() const {
minor_text.empty() ? 0 : gfx::GetStringWidth(minor_text, style.font_list);
// Determine the height to use.
@ -437,10 +389,10 @@ index 0fcca1e59688eda967c59397ea932637810af27b..35e7e3dc8f18fffa1713d6821c2bef87
std::max(dimensions.height, MenuConfig::instance().item_min_height);
diff --git a/ui/views/controls/menu/menu_item_view.h b/ui/views/controls/menu/menu_item_view.h
index e129bed9de80df5a6aeaca8e22e7d12a949ab759..d7cfa2a5d93af7b865ab01f2cc004c4215fc9986 100644
index c453320c3fbd8ad5581a78b0b63d7a06cda4d542..b92470f17446698515ae2e973e51628023d075de 100644
--- a/ui/views/controls/menu/menu_item_view.h
+++ b/ui/views/controls/menu/menu_item_view.h
@@ -151,6 +151,7 @@ class VIEWS_EXPORT MenuItemView : public View {
@@ -152,6 +152,7 @@ class VIEWS_EXPORT MenuItemView : public View {
MenuItemView* AddMenuItemAt(int index,
int item_id,
const base::string16& label,
@ -448,15 +400,15 @@ index e129bed9de80df5a6aeaca8e22e7d12a949ab759..d7cfa2a5d93af7b865ab01f2cc004c42
const base::string16& minor_text,
const gfx::VectorIcon* minor_icon,
const gfx::ImageSkia& icon,
@@ -214,6 +215,7 @@ class VIEWS_EXPORT MenuItemView : public View {
@@ -194,6 +195,7 @@ class VIEWS_EXPORT MenuItemView : public View {
// All the AppendXXX methods funnel into this.
MenuItemView* AppendMenuItemImpl(int item_id,
const base::string16& label,
+ const base::string16& sublabel,
const base::string16& minor_text,
const gfx::VectorIcon* minor_icon,
const gfx::ImageSkia& icon,
@@ -241,6 +243,9 @@ class VIEWS_EXPORT MenuItemView : public View {
Type type);
@@ -218,6 +220,9 @@ class VIEWS_EXPORT MenuItemView : public View {
void SetTitle(const base::string16& title);
const base::string16& title() const { return title_; }
@ -466,7 +418,7 @@ index e129bed9de80df5a6aeaca8e22e7d12a949ab759..d7cfa2a5d93af7b865ab01f2cc004c42
// Sets the minor text.
void SetMinorText(const base::string16& minor_text);
@@ -451,7 +456,7 @@ class VIEWS_EXPORT MenuItemView : public View {
@@ -428,7 +433,7 @@ class VIEWS_EXPORT MenuItemView : public View {
void DestroyAllMenuHosts();
// Returns the text that should be displayed on the end (right) of the menu
@ -475,7 +427,7 @@ index e129bed9de80df5a6aeaca8e22e7d12a949ab759..d7cfa2a5d93af7b865ab01f2cc004c42
base::string16 GetMinorText() const;
// Returns the icon that should be displayed to the left of the minor text.
@@ -542,6 +547,9 @@ class VIEWS_EXPORT MenuItemView : public View {
@@ -519,6 +524,9 @@ class VIEWS_EXPORT MenuItemView : public View {
// Title.
base::string16 title_;
@ -486,10 +438,10 @@ index e129bed9de80df5a6aeaca8e22e7d12a949ab759..d7cfa2a5d93af7b865ab01f2cc004c42
base::string16 minor_text_;
diff --git a/ui/views/controls/menu/menu_item_view_unittest.cc b/ui/views/controls/menu/menu_item_view_unittest.cc
index f51bd9d85dad7771f18fc535b55b30a855eac48f..63aa8eddf51cb4821517902564e94813f6a42c02 100644
index 27d189a5be20d001ac6c457f4540e5e5430dde37..5c749133714d40595ef804d56951eed35abee91e 100644
--- a/ui/views/controls/menu/menu_item_view_unittest.cc
+++ b/ui/views/controls/menu/menu_item_view_unittest.cc
@@ -324,10 +324,10 @@ class MenuItemViewPaintUnitTest : public ViewsTestBase {
@@ -322,10 +322,10 @@ class MenuItemViewPaintUnitTest : public ViewsTestBase {
// Provides assertion coverage for painting minor text and icons.
TEST_F(MenuItemViewPaintUnitTest, MinorTextAndIconAssertionCoverage) {
auto AddItem = [this](auto label, auto minor_label, auto minor_icon) {
@ -505,10 +457,10 @@ index f51bd9d85dad7771f18fc535b55b30a855eac48f..63aa8eddf51cb4821517902564e94813
AddItem("No minor content", base::string16(), nullptr);
AddItem("Minor text only", base::ASCIIToUTF16("minor text"), nullptr);
diff --git a/ui/views/controls/menu/menu_model_adapter.cc b/ui/views/controls/menu/menu_model_adapter.cc
index 09b72733e66d1e13182730e475b781ffefe649c0..e45e249f2a89e1bfd31cc82341a65341571ffc21 100644
index beac9986b2c6d13cde9cb26310eefc01cfbbbe09..ab9ac14fcd346ce5490c916cf3eceb534510fb69 100644
--- a/ui/views/controls/menu/menu_model_adapter.cc
+++ b/ui/views/controls/menu/menu_model_adapter.cc
@@ -96,8 +96,8 @@ MenuItemView* MenuModelAdapter::AddMenuItemFromModelAt(ui::MenuModel* model,
@@ -99,8 +99,8 @@ MenuItemView* MenuModelAdapter::AddMenuItemFromModelAt(ui::MenuModel* model,
if (*type == MenuItemView::SEPARATOR) {
return menu->AddMenuItemAt(menu_index, item_id, base::string16(),
@ -519,7 +471,7 @@ index 09b72733e66d1e13182730e475b781ffefe649c0..e45e249f2a89e1bfd31cc82341a65341
model->GetSeparatorTypeAt(model_index));
}
@@ -105,7 +105,8 @@ MenuItemView* MenuModelAdapter::AddMenuItemFromModelAt(ui::MenuModel* model,
@@ -108,7 +108,8 @@ MenuItemView* MenuModelAdapter::AddMenuItemFromModelAt(ui::MenuModel* model,
model->GetIconAt(model_index, &icon);
return menu->AddMenuItemAt(
menu_index, item_id, model->GetLabelAt(model_index),