summaryrefslogtreecommitdiff
path: root/chromium/ui/base/models
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/ui/base/models
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/ui/base/models')
-rw-r--r--chromium/ui/base/models/button_menu_item_model.h6
-rw-r--r--chromium/ui/base/models/combobox_model.cc20
-rw-r--r--chromium/ui/base/models/combobox_model.h25
-rw-r--r--chromium/ui/base/models/combobox_model_observer.h5
-rw-r--r--chromium/ui/base/models/image_model.cc8
-rw-r--r--chromium/ui/base/models/image_model.h7
-rw-r--r--chromium/ui/base/models/image_model_unittest.cc8
-rw-r--r--chromium/ui/base/models/list_model.h2
-rw-r--r--chromium/ui/base/models/list_model_observer.h4
-rw-r--r--chromium/ui/base/models/list_selection_model.h4
-rw-r--r--chromium/ui/base/models/menu_model.cc12
-rw-r--r--chromium/ui/base/models/menu_model.h18
-rw-r--r--chromium/ui/base/models/simple_combobox_model.cc4
-rw-r--r--chromium/ui/base/models/simple_combobox_model.h7
-rw-r--r--chromium/ui/base/models/simple_menu_model.cc20
-rw-r--r--chromium/ui/base/models/simple_menu_model.h15
-rw-r--r--chromium/ui/base/models/simple_menu_model_unittest.cc32
-rw-r--r--chromium/ui/base/models/table_model.h6
-rw-r--r--chromium/ui/base/models/table_model_observer.h4
-rw-r--r--chromium/ui/base/models/tree_model.h6
-rw-r--r--chromium/ui/base/models/tree_node_iterator.h2
-rw-r--r--chromium/ui/base/models/tree_node_model.h2
22 files changed, 180 insertions, 37 deletions
diff --git a/chromium/ui/base/models/button_menu_item_model.h b/chromium/ui/base/models/button_menu_item_model.h
index eabf45695aa..7772052fda8 100644
--- a/chromium/ui/base/models/button_menu_item_model.h
+++ b/chromium/ui/base/models/button_menu_item_model.h
@@ -8,16 +8,16 @@
#include <vector>
#include "base/compiler_specific.h"
+#include "base/component_export.h"
#include "base/macros.h"
#include "base/strings/string16.h"
#include "ui/base/accelerators/accelerator.h"
-#include "ui/base/ui_base_export.h"
namespace ui {
// A model representing the rows of buttons that should be inserted in a button
// containing menu item.
-class UI_BASE_EXPORT ButtonMenuItemModel {
+class COMPONENT_EXPORT(UI_BASE) ButtonMenuItemModel {
public:
// Types of buttons.
enum ButtonType {
@@ -26,7 +26,7 @@ class UI_BASE_EXPORT ButtonMenuItemModel {
TYPE_BUTTON_LABEL
};
- class UI_BASE_EXPORT Delegate : public AcceleratorProvider {
+ class COMPONENT_EXPORT(UI_BASE) Delegate : public AcceleratorProvider {
public:
// Some command ids have labels that change over time.
virtual bool IsItemForCommandIdDynamic(int command_id) const;
diff --git a/chromium/ui/base/models/combobox_model.cc b/chromium/ui/base/models/combobox_model.cc
index c6913da55e5..a6a311fc465 100644
--- a/chromium/ui/base/models/combobox_model.cc
+++ b/chromium/ui/base/models/combobox_model.cc
@@ -4,9 +4,27 @@
#include "ui/base/models/combobox_model.h"
+#include "ui/base/models/image_model.h"
+
namespace ui {
-bool ComboboxModel::IsItemSeparatorAt(int index) {
+base::string16 ComboboxModel::GetDropDownTextAt(int index) const {
+ return GetItemAt(index);
+}
+
+base::string16 ComboboxModel::GetDropDownSecondaryTextAt(int index) const {
+ return base::string16();
+}
+
+ImageModel ComboboxModel::GetIconAt(int index) const {
+ return ui::ImageModel();
+}
+
+ImageModel ComboboxModel::GetDropDownIconAt(int index) const {
+ return GetIconAt(index);
+}
+
+bool ComboboxModel::IsItemSeparatorAt(int index) const {
return false;
}
diff --git a/chromium/ui/base/models/combobox_model.h b/chromium/ui/base/models/combobox_model.h
index 2fcd7b69029..994ac2bbef7 100644
--- a/chromium/ui/base/models/combobox_model.h
+++ b/chromium/ui/base/models/combobox_model.h
@@ -5,15 +5,16 @@
#ifndef UI_BASE_MODELS_COMBOBOX_MODEL_H_
#define UI_BASE_MODELS_COMBOBOX_MODEL_H_
+#include "base/component_export.h"
#include "base/strings/string16.h"
-#include "ui/base/ui_base_export.h"
namespace ui {
class ComboboxModelObserver;
+class ImageModel;
// A data model for a combo box.
-class UI_BASE_EXPORT ComboboxModel {
+class COMPONENT_EXPORT(UI_BASE) ComboboxModel {
public:
virtual ~ComboboxModel() {}
@@ -21,11 +22,27 @@ class UI_BASE_EXPORT ComboboxModel {
virtual int GetItemCount() const = 0;
// Returns the string at the specified index.
- virtual base::string16 GetItemAt(int index) = 0;
+ virtual base::string16 GetItemAt(int index) const = 0;
+
+ // Returns the string to be shown in the dropdown for the item at |index|. By
+ // default, it returns GetItemAt(index).
+ virtual base::string16 GetDropDownTextAt(int index) const;
+
+ // Returns the secondary string at the specified index. Secondary strings are
+ // displayed in a second line inside every menu item.
+ virtual base::string16 GetDropDownSecondaryTextAt(int index) const;
+
+ // Gets the icon for the item at the specified index. ImageModel is empty if
+ // there is no icon.
+ virtual ImageModel GetIconAt(int index) const;
+
+ // Gets the icon for the item at |index|. ImageModel is empty if there is no
+ // icon. By default, it returns GetIconAt(index).
+ virtual ImageModel GetDropDownIconAt(int index) const;
// Should return true if the item at |index| is a non-selectable separator
// item.
- virtual bool IsItemSeparatorAt(int index);
+ virtual bool IsItemSeparatorAt(int index) const;
// The index of the item that is selected by default (before user
// interaction).
diff --git a/chromium/ui/base/models/combobox_model_observer.h b/chromium/ui/base/models/combobox_model_observer.h
index 42d15bdc0e0..5e00ab68a0c 100644
--- a/chromium/ui/base/models/combobox_model_observer.h
+++ b/chromium/ui/base/models/combobox_model_observer.h
@@ -5,15 +5,16 @@
#ifndef UI_BASE_MODELS_COMBOBOX_MODEL_OBSERVER_H_
#define UI_BASE_MODELS_COMBOBOX_MODEL_OBSERVER_H_
+#include "base/component_export.h"
#include "base/observer_list_types.h"
-#include "ui/base/ui_base_export.h"
namespace ui {
class ComboboxModel;
// Observer for the ComboboxModel.
-class UI_BASE_EXPORT ComboboxModelObserver : public base::CheckedObserver {
+class COMPONENT_EXPORT(UI_BASE) ComboboxModelObserver
+ : public base::CheckedObserver {
public:
// Invoked when |model| has changed in some way. The observer should assume
// everything changed.
diff --git a/chromium/ui/base/models/image_model.cc b/chromium/ui/base/models/image_model.cc
index 501f8dc9495..9578759666b 100644
--- a/chromium/ui/base/models/image_model.cc
+++ b/chromium/ui/base/models/image_model.cc
@@ -84,6 +84,14 @@ bool ImageModel::IsImage() const {
return image_ && !image_.value().IsEmpty();
}
+gfx::Size ImageModel::Size() const {
+ if (IsVectorIcon()) {
+ const int icon_size = GetVectorIcon().icon_size();
+ return gfx::Size(icon_size, icon_size);
+ }
+ return IsImage() ? GetImage().Size() : gfx::Size();
+}
+
const VectorIconModel ImageModel::GetVectorIcon() const {
DCHECK(IsVectorIcon());
return vector_icon_model_.value();
diff --git a/chromium/ui/base/models/image_model.h b/chromium/ui/base/models/image_model.h
index 098a92ed42d..dbc4cf8b01d 100644
--- a/chromium/ui/base/models/image_model.h
+++ b/chromium/ui/base/models/image_model.h
@@ -6,9 +6,9 @@
#define UI_BASE_MODELS_IMAGE_MODEL_H_
#include "base/callback.h"
+#include "base/component_export.h"
#include "base/optional.h"
#include "third_party/skia/include/core/SkColor.h"
-#include "ui/base/ui_base_export.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia.h"
@@ -28,7 +28,7 @@ namespace ui {
// is only used internal to ImageModel and should never be instantiated except
// by ImageModel.
-class UI_BASE_EXPORT VectorIconModel {
+class COMPONENT_EXPORT(UI_BASE) VectorIconModel {
public:
VectorIconModel();
VectorIconModel(const VectorIconModel&);
@@ -71,7 +71,7 @@ class UI_BASE_EXPORT VectorIconModel {
// of the two may be specified at a given time. This class is instantiated via
// the FromXXXX static factory functions.
-class UI_BASE_EXPORT ImageModel {
+class COMPONENT_EXPORT(UI_BASE) ImageModel {
public:
ImageModel();
ImageModel(const ImageModel&);
@@ -92,6 +92,7 @@ class UI_BASE_EXPORT ImageModel {
bool IsEmpty() const;
bool IsVectorIcon() const;
bool IsImage() const;
+ gfx::Size Size() const;
// Only valid if IsVectorIcon() or IsImage() return true, respectively.
const VectorIconModel GetVectorIcon() const;
const gfx::Image GetImage() const;
diff --git a/chromium/ui/base/models/image_model_unittest.cc b/chromium/ui/base/models/image_model_unittest.cc
index 3b494797afc..8bb31fc06a1 100644
--- a/chromium/ui/base/models/image_model_unittest.cc
+++ b/chromium/ui/base/models/image_model_unittest.cc
@@ -54,6 +54,14 @@ TEST(ImageModelTest, CheckForImage) {
EXPECT_TRUE(image_model.IsImage());
}
+TEST(ImageModelTest, Size) {
+ EXPECT_EQ(gfx::Size(), ImageModel().Size());
+ EXPECT_EQ(gfx::Size(16, 16),
+ ImageModel::FromVectorIcon(GetVectorIcon(), -1, 16).Size());
+ EXPECT_EQ(gfx::Size(16, 16),
+ ImageModel::FromImage(gfx::test::CreateImage(16, 16)).Size());
+}
+
TEST(ImageModelTest, CheckAssignVectorIcon) {
VectorIconModel vector_icon_model_dest;
VectorIconModel vector_icon_model_src =
diff --git a/chromium/ui/base/models/list_model.h b/chromium/ui/base/models/list_model.h
index 3187ee5fd86..ed5217d99d9 100644
--- a/chromium/ui/base/models/list_model.h
+++ b/chromium/ui/base/models/list_model.h
@@ -11,7 +11,7 @@
#include <utility>
#include <vector>
-#include "base/logging.h"
+#include "base/check_op.h"
#include "base/macros.h"
#include "base/observer_list.h"
#include "ui/base/models/list_model_observer.h"
diff --git a/chromium/ui/base/models/list_model_observer.h b/chromium/ui/base/models/list_model_observer.h
index cc8be0f6e0a..c7d42310504 100644
--- a/chromium/ui/base/models/list_model_observer.h
+++ b/chromium/ui/base/models/list_model_observer.h
@@ -7,11 +7,11 @@
#include <stddef.h>
-#include "ui/base/ui_base_export.h"
+#include "base/component_export.h"
namespace ui {
-class UI_BASE_EXPORT ListModelObserver {
+class COMPONENT_EXPORT(UI_BASE) ListModelObserver {
public:
// Invoked after items has been added to the model.
virtual void ListItemsAdded(size_t start, size_t count) = 0;
diff --git a/chromium/ui/base/models/list_selection_model.h b/chromium/ui/base/models/list_selection_model.h
index e4e25150351..4c98ae9f645 100644
--- a/chromium/ui/base/models/list_selection_model.h
+++ b/chromium/ui/base/models/list_selection_model.h
@@ -9,7 +9,7 @@
#include <vector>
-#include "ui/base/ui_base_export.h"
+#include "base/component_export.h"
namespace ui {
@@ -25,7 +25,7 @@ namespace ui {
//
// Typically there is only one selected item, in which case the anchor and
// active index correspond to the same thing.
-class UI_BASE_EXPORT ListSelectionModel {
+class COMPONENT_EXPORT(UI_BASE) ListSelectionModel {
public:
using SelectedIndices = std::vector<int>;
diff --git a/chromium/ui/base/models/menu_model.cc b/chromium/ui/base/models/menu_model.cc
index 90a350cf9ce..32070758287 100644
--- a/chromium/ui/base/models/menu_model.cc
+++ b/chromium/ui/base/models/menu_model.cc
@@ -19,6 +19,14 @@ bool MenuModel::IsVisibleAt(int index) const {
return true;
}
+bool MenuModel::IsAlertedAt(int index) const {
+ return false;
+}
+
+bool MenuModel::IsNewFeatureAt(int index) const {
+ return false;
+}
+
// static
bool MenuModel::GetModelAndIndexForCommandId(int command_id,
MenuModel** model,
@@ -52,6 +60,10 @@ base::string16 MenuModel::GetMinorTextAt(int index) const {
return base::string16();
}
+base::string16 MenuModel::GetSecondaryLabelAt(int index) const {
+ return base::string16();
+}
+
ImageModel MenuModel::GetMinorIconAt(int index) const {
return ImageModel();
}
diff --git a/chromium/ui/base/models/menu_model.h b/chromium/ui/base/models/menu_model.h
index 887eee64e27..c746b37d627 100644
--- a/chromium/ui/base/models/menu_model.h
+++ b/chromium/ui/base/models/menu_model.h
@@ -5,11 +5,11 @@
#ifndef UI_BASE_MODELS_MENU_MODEL_H_
#define UI_BASE_MODELS_MENU_MODEL_H_
+#include "base/component_export.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
#include "ui/base/models/menu_model_delegate.h"
#include "ui/base/models/menu_separator_types.h"
-#include "ui/base/ui_base_export.h"
#include "ui/gfx/native_widget_types.h"
namespace gfx {
@@ -23,7 +23,8 @@ class ButtonMenuItemModel;
class ImageModel;
// An interface implemented by an object that provides the content of a menu.
-class UI_BASE_EXPORT MenuModel : public base::SupportsWeakPtr<MenuModel> {
+class COMPONENT_EXPORT(UI_BASE) MenuModel
+ : public base::SupportsWeakPtr<MenuModel> {
public:
// The type of item.
enum ItemType {
@@ -65,6 +66,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;
+ // Returns the secondary label of the item at the specified index. Secondary
+ // label is shown below the label.
+ virtual base::string16 GetSecondaryLabelAt(int index) const;
+
// Returns the minor text of the item at the specified index. The minor text
// is rendered to the right of the label and using the font GetLabelFontAt().
virtual base::string16 GetMinorTextAt(int index) const;
@@ -108,6 +113,15 @@ class UI_BASE_EXPORT MenuModel : public base::SupportsWeakPtr<MenuModel> {
// Returns true if the menu item is visible.
virtual bool IsVisibleAt(int index) const;
+ // Returns true if the item is rendered specially to draw attention
+ // for in-product help.
+ virtual bool IsAlertedAt(int index) const;
+
+ // Returns true if the menu item grants access to a new feature that we want
+ // to show off to users (items marked as new will receive a "New" badge when
+ // the appropriate flag is enabled).
+ virtual bool IsNewFeatureAt(int index) const;
+
// Returns the model for the submenu at the specified index.
virtual MenuModel* GetSubmenuModelAt(int index) const = 0;
diff --git a/chromium/ui/base/models/simple_combobox_model.cc b/chromium/ui/base/models/simple_combobox_model.cc
index ff4f04f8036..64e05588544 100644
--- a/chromium/ui/base/models/simple_combobox_model.cc
+++ b/chromium/ui/base/models/simple_combobox_model.cc
@@ -18,11 +18,11 @@ int SimpleComboboxModel::GetItemCount() const {
return items_.size();
}
-base::string16 SimpleComboboxModel::GetItemAt(int index) {
+base::string16 SimpleComboboxModel::GetItemAt(int index) const {
return items_[index];
}
-bool SimpleComboboxModel::IsItemSeparatorAt(int index) {
+bool SimpleComboboxModel::IsItemSeparatorAt(int index) const {
return items_[index].empty();
}
diff --git a/chromium/ui/base/models/simple_combobox_model.h b/chromium/ui/base/models/simple_combobox_model.h
index a50373a5cf5..140760a604b 100644
--- a/chromium/ui/base/models/simple_combobox_model.h
+++ b/chromium/ui/base/models/simple_combobox_model.h
@@ -5,6 +5,7 @@
#ifndef UI_BASE_MODELS_SIMPLE_COMBOBOX_MODEL_H_
#define UI_BASE_MODELS_SIMPLE_COMBOBOX_MODEL_H_
+#include "base/component_export.h"
#include "base/macros.h"
#include "ui/base/models/combobox_model.h"
@@ -14,15 +15,15 @@ namespace ui {
// A simple data model for a combobox that takes a string16 vector as the items.
// An empty string will be a separator.
-class UI_BASE_EXPORT SimpleComboboxModel : public ComboboxModel {
+class COMPONENT_EXPORT(UI_BASE) SimpleComboboxModel : public ComboboxModel {
public:
explicit SimpleComboboxModel(std::vector<base::string16> items);
~SimpleComboboxModel() override;
// ui::ComboboxModel:
int GetItemCount() const override;
- base::string16 GetItemAt(int index) override;
- bool IsItemSeparatorAt(int index) override;
+ base::string16 GetItemAt(int index) const override;
+ bool IsItemSeparatorAt(int index) const override;
int GetDefaultIndex() const override;
private:
diff --git a/chromium/ui/base/models/simple_menu_model.cc b/chromium/ui/base/models/simple_menu_model.cc
index 88053e9d501..0c37f6e2cae 100644
--- a/chromium/ui/base/models/simple_menu_model.cc
+++ b/chromium/ui/base/models/simple_menu_model.cc
@@ -39,6 +39,10 @@ bool SimpleMenuModel::Delegate::IsCommandIdVisible(int command_id) const {
return true;
}
+bool SimpleMenuModel::Delegate::IsCommandIdAlerted(int command_id) const {
+ return false;
+}
+
bool SimpleMenuModel::Delegate::IsItemForCommandIdDynamic(
int command_id) const {
return false;
@@ -317,6 +321,10 @@ void SimpleMenuModel::SetVisibleAt(int index, bool visible) {
MenuItemsChanged();
}
+void SimpleMenuModel::SetIsNewFeatureAt(int index, bool is_new_feature) {
+ items_[ValidateItemIndex(index)].is_new_feature = is_new_feature;
+}
+
void SimpleMenuModel::Clear() {
items_.clear();
MenuItemsChanged();
@@ -432,6 +440,18 @@ bool SimpleMenuModel::IsVisibleAt(int index) const {
items_[ValidateItemIndex(index)].visible;
}
+bool SimpleMenuModel::IsAlertedAt(int index) const {
+ const int command_id = GetCommandIdAt(index);
+ if (!delegate_ || command_id == kSeparatorId || command_id == kTitleId)
+ return false;
+
+ return delegate_->IsCommandIdAlerted(command_id);
+}
+
+bool SimpleMenuModel::IsNewFeatureAt(int index) const {
+ return items_[ValidateItemIndex(index)].is_new_feature;
+}
+
void SimpleMenuModel::ActivatedAt(int index) {
ActivatedAt(index, 0);
}
diff --git a/chromium/ui/base/models/simple_menu_model.h b/chromium/ui/base/models/simple_menu_model.h
index 2b06f3f4a03..5f1116ba19b 100644
--- a/chromium/ui/base/models/simple_menu_model.h
+++ b/chromium/ui/base/models/simple_menu_model.h
@@ -9,6 +9,7 @@
#include <vector>
#include "base/compiler_specific.h"
+#include "base/component_export.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/strings/string16.h"
@@ -24,9 +25,9 @@ class ButtonMenuItemModel;
// items. This makes it easy to construct fixed menus. Menus populated by
// dynamic data sources may be better off implementing MenuModel directly.
// The breadth of MenuModel is not exposed through this API.
-class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
+class COMPONENT_EXPORT(UI_BASE) SimpleMenuModel : public MenuModel {
public:
- class UI_BASE_EXPORT Delegate : public AcceleratorProvider {
+ class COMPONENT_EXPORT(UI_BASE) Delegate : public AcceleratorProvider {
public:
~Delegate() override {}
@@ -40,6 +41,10 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
// Delegate should return true if |command_id| should be visible.
virtual bool IsCommandIdVisible(int command_id) const;
+ // Determines if |command_id| should be rendered with an alert for
+ // in-product help.
+ virtual bool IsCommandIdAlerted(int command_id) const;
+
// 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;
@@ -158,6 +163,9 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
// Sets whether the item at |index| is visible.
void SetVisibleAt(int index, bool visible);
+ // Sets whether the item at |index| is new.
+ void SetIsNewFeatureAt(int index, bool is_new_feature);
+
// Clears all items. Note that it does not free MenuModel of submenu.
void Clear();
@@ -182,6 +190,8 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
ui::ButtonMenuItemModel* GetButtonMenuItemAt(int index) const override;
bool IsEnabledAt(int index) const override;
bool IsVisibleAt(int index) const override;
+ bool IsAlertedAt(int index) const override;
+ bool IsNewFeatureAt(int index) const override;
void ActivatedAt(int index) override;
void ActivatedAt(int index, int event_flags) override;
MenuModel* GetSubmenuModelAt(int index) const override;
@@ -215,6 +225,7 @@ class UI_BASE_EXPORT SimpleMenuModel : public MenuModel {
MenuSeparatorType separator_type = NORMAL_SEPARATOR;
bool enabled = true;
bool visible = true;
+ bool is_new_feature = false;
};
typedef std::vector<Item> ItemVector;
diff --git a/chromium/ui/base/models/simple_menu_model_unittest.cc b/chromium/ui/base/models/simple_menu_model_unittest.cc
index 4fe768d11b9..b38debbc855 100644
--- a/chromium/ui/base/models/simple_menu_model_unittest.cc
+++ b/chromium/ui/base/models/simple_menu_model_unittest.cc
@@ -16,6 +16,8 @@ namespace ui {
namespace {
+constexpr int kAlertedCommandId = 2;
+
class DelegateBase : public SimpleMenuModel::Delegate {
public:
DelegateBase() : SimpleMenuModel::Delegate() {}
@@ -37,6 +39,10 @@ class DelegateBase : public SimpleMenuModel::Delegate {
return command_id < 100;
}
+ bool IsCommandIdAlerted(int command_id) const override {
+ return command_id == kAlertedCommandId;
+ }
+
void ExecuteCommand(int command_id, int event_flags) override {}
bool IsItemForCommandIdDynamic(int command_id) const override {
@@ -147,6 +153,32 @@ TEST(SimpleMenuModelTest, IsVisibleAtWithDelegateAndCommandNotVisible) {
ASSERT_FALSE(simple_menu_model.IsEnabledAt(0));
}
+TEST(SimpleMenuModelTest, IsAlertedAtViaDelegate) {
+ DelegateBase delegate;
+ SimpleMenuModel simple_menu_model(&delegate);
+ simple_menu_model.AddItem(kAlertedCommandId,
+ base::ASCIIToUTF16("alerted item"));
+ simple_menu_model.AddItem(kAlertedCommandId + 1,
+ base::ASCIIToUTF16("non-alerted item"));
+
+ EXPECT_TRUE(simple_menu_model.IsAlertedAt(0));
+ EXPECT_FALSE(simple_menu_model.IsAlertedAt(1));
+}
+
+TEST(SimpleMenuModelTest, SetIsNewFeatureAt) {
+ SimpleMenuModel simple_menu_model(nullptr);
+ simple_menu_model.AddItem(/*command_id*/ 5,
+ base::ASCIIToUTF16("menu item 0"));
+ simple_menu_model.AddItem(/*command_id*/ 6,
+ base::ASCIIToUTF16("menu item 1"));
+
+ simple_menu_model.SetIsNewFeatureAt(/*index*/ 0, false);
+ simple_menu_model.SetIsNewFeatureAt(/*index*/ 1, true);
+
+ ASSERT_FALSE(simple_menu_model.IsNewFeatureAt(0));
+ ASSERT_TRUE(simple_menu_model.IsNewFeatureAt(1));
+}
+
TEST(SimpleMenuModelTest, HasIconsViaDelegate) {
DelegateBase delegate;
SimpleMenuModel simple_menu_model(&delegate);
diff --git a/chromium/ui/base/models/table_model.h b/chromium/ui/base/models/table_model.h
index 088cda5a42d..6e098fbe8dc 100644
--- a/chromium/ui/base/models/table_model.h
+++ b/chromium/ui/base/models/table_model.h
@@ -7,9 +7,9 @@
#include <vector>
+#include "base/component_export.h"
#include "base/strings/string16.h"
#include "third_party/icu/source/i18n/unicode/coll.h"
-#include "ui/base/ui_base_export.h"
namespace gfx {
class ImageSkia;
@@ -20,7 +20,7 @@ namespace ui {
class TableModelObserver;
// The model driving the TableView.
-class UI_BASE_EXPORT TableModel {
+class COMPONENT_EXPORT(UI_BASE) TableModel {
public:
// Size of the table row icon, if used.
static constexpr int kIconSize = 16;
@@ -65,7 +65,7 @@ class UI_BASE_EXPORT TableModel {
};
// TableColumn specifies the title, alignment and size of a particular column.
-struct UI_BASE_EXPORT TableColumn {
+struct COMPONENT_EXPORT(UI_BASE) TableColumn {
enum Alignment {
LEFT, RIGHT, CENTER
};
diff --git a/chromium/ui/base/models/table_model_observer.h b/chromium/ui/base/models/table_model_observer.h
index 20b5c7f0e13..eaff0750819 100644
--- a/chromium/ui/base/models/table_model_observer.h
+++ b/chromium/ui/base/models/table_model_observer.h
@@ -5,13 +5,13 @@
#ifndef UI_BASE_MODELS_TABLE_MODEL_OBSERVER_H_
#define UI_BASE_MODELS_TABLE_MODEL_OBSERVER_H_
-#include "ui/base/ui_base_export.h"
+#include "base/component_export.h"
namespace ui {
// Observer for a TableModel. Anytime the model changes, it must notify its
// observer.
-class UI_BASE_EXPORT TableModelObserver {
+class COMPONENT_EXPORT(UI_BASE) TableModelObserver {
public:
// Invoked when the model has been completely changed.
virtual void OnModelChanged() = 0;
diff --git a/chromium/ui/base/models/tree_model.h b/chromium/ui/base/models/tree_model.h
index 815cebbdea9..20dc6cdef24 100644
--- a/chromium/ui/base/models/tree_model.h
+++ b/chromium/ui/base/models/tree_model.h
@@ -7,8 +7,8 @@
#include <vector>
+#include "base/component_export.h"
#include "base/strings/string16.h"
-#include "ui/base/ui_base_export.h"
namespace gfx {
class ImageSkia;
@@ -34,7 +34,7 @@ class TreeModelNode {
};
// Observer for the TreeModel. Notified of significant events to the model.
-class UI_BASE_EXPORT TreeModelObserver {
+class COMPONENT_EXPORT(UI_BASE) TreeModelObserver {
public:
// Notification that nodes were added to the specified parent.
virtual void TreeNodesAdded(TreeModel* model,
@@ -61,7 +61,7 @@ class UI_BASE_EXPORT TreeModelObserver {
// of bookkeeping for the tree to be implemented. Generally you will want to
// use TreeNodeModel which provides a standard implementation for basic
// hierarchy and observer notification. See tree_node_model.h.
-class UI_BASE_EXPORT TreeModel {
+class COMPONENT_EXPORT(UI_BASE) TreeModel {
public:
using Nodes = std::vector<TreeModelNode*>;
diff --git a/chromium/ui/base/models/tree_node_iterator.h b/chromium/ui/base/models/tree_node_iterator.h
index 4f84b20e2b9..931e2606e0d 100644
--- a/chromium/ui/base/models/tree_node_iterator.h
+++ b/chromium/ui/base/models/tree_node_iterator.h
@@ -6,8 +6,8 @@
#define UI_BASE_MODELS_TREE_NODE_ITERATOR_H_
#include "base/callback.h"
+#include "base/check.h"
#include "base/containers/stack.h"
-#include "base/logging.h"
#include "base/macros.h"
namespace ui {
diff --git a/chromium/ui/base/models/tree_node_model.h b/chromium/ui/base/models/tree_node_model.h
index b1213ba67a5..d21bf9a66d0 100644
--- a/chromium/ui/base/models/tree_node_model.h
+++ b/chromium/ui/base/models/tree_node_model.h
@@ -11,7 +11,7 @@
#include <memory>
#include <vector>
-#include "base/logging.h"
+#include "base/check_op.h"
#include "base/macros.h"
#include "base/observer_list.h"
#include "base/strings/string16.h"