chore: bump chromium to 106.0.5216.0 (main) (#34993)
This commit is contained in:
parent
e15e66f229
commit
97b353a30a
114 changed files with 886 additions and 779 deletions
|
@ -71,8 +71,8 @@ bool StringToAccelerator(const std::string& shortcut,
|
|||
|
||||
void GenerateAcceleratorTable(AcceleratorTable* table,
|
||||
electron::ElectronMenuModel* model) {
|
||||
int count = model->GetItemCount();
|
||||
for (int i = 0; i < count; ++i) {
|
||||
size_t count = model->GetItemCount();
|
||||
for (size_t i = 0; i < count; ++i) {
|
||||
electron::ElectronMenuModel::ItemType type = model->GetTypeAt(i);
|
||||
if (type == electron::ElectronMenuModel::TYPE_SUBMENU) {
|
||||
auto* submodel = model->GetSubmenuModelAt(i);
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
namespace accelerator_util {
|
||||
|
||||
typedef struct {
|
||||
int position;
|
||||
size_t position;
|
||||
electron::ElectronMenuModel* model;
|
||||
} MenuItem;
|
||||
typedef std::map<ui::Accelerator, MenuItem> AcceleratorTable;
|
||||
|
|
|
@ -27,42 +27,43 @@ ElectronMenuModel::ElectronMenuModel(Delegate* delegate)
|
|||
|
||||
ElectronMenuModel::~ElectronMenuModel() = default;
|
||||
|
||||
void ElectronMenuModel::SetToolTip(int index, const std::u16string& toolTip) {
|
||||
void ElectronMenuModel::SetToolTip(size_t index,
|
||||
const std::u16string& toolTip) {
|
||||
int command_id = GetCommandIdAt(index);
|
||||
toolTips_[command_id] = toolTip;
|
||||
}
|
||||
|
||||
std::u16string ElectronMenuModel::GetToolTipAt(int index) {
|
||||
std::u16string ElectronMenuModel::GetToolTipAt(size_t index) {
|
||||
const int command_id = GetCommandIdAt(index);
|
||||
const auto iter = toolTips_.find(command_id);
|
||||
return iter == std::end(toolTips_) ? std::u16string() : iter->second;
|
||||
}
|
||||
|
||||
void ElectronMenuModel::SetRole(int index, const std::u16string& role) {
|
||||
void ElectronMenuModel::SetRole(size_t index, const std::u16string& role) {
|
||||
int command_id = GetCommandIdAt(index);
|
||||
roles_[command_id] = role;
|
||||
}
|
||||
|
||||
std::u16string ElectronMenuModel::GetRoleAt(int index) {
|
||||
std::u16string ElectronMenuModel::GetRoleAt(size_t index) {
|
||||
const int command_id = GetCommandIdAt(index);
|
||||
const auto iter = roles_.find(command_id);
|
||||
return iter == std::end(roles_) ? std::u16string() : iter->second;
|
||||
}
|
||||
|
||||
void ElectronMenuModel::SetSecondaryLabel(int index,
|
||||
void ElectronMenuModel::SetSecondaryLabel(size_t index,
|
||||
const std::u16string& sublabel) {
|
||||
int command_id = GetCommandIdAt(index);
|
||||
sublabels_[command_id] = sublabel;
|
||||
}
|
||||
|
||||
std::u16string ElectronMenuModel::GetSecondaryLabelAt(int index) const {
|
||||
std::u16string ElectronMenuModel::GetSecondaryLabelAt(size_t index) const {
|
||||
int command_id = GetCommandIdAt(index);
|
||||
const auto iter = sublabels_.find(command_id);
|
||||
return iter == std::end(sublabels_) ? std::u16string() : iter->second;
|
||||
}
|
||||
|
||||
bool ElectronMenuModel::GetAcceleratorAtWithParams(
|
||||
int index,
|
||||
size_t index,
|
||||
bool use_default_accelerator,
|
||||
ui::Accelerator* accelerator) const {
|
||||
if (delegate_) {
|
||||
|
@ -72,7 +73,7 @@ bool ElectronMenuModel::GetAcceleratorAtWithParams(
|
|||
return false;
|
||||
}
|
||||
|
||||
bool ElectronMenuModel::ShouldRegisterAcceleratorAt(int index) const {
|
||||
bool ElectronMenuModel::ShouldRegisterAcceleratorAt(size_t index) const {
|
||||
if (delegate_) {
|
||||
return delegate_->ShouldRegisterAcceleratorForCommandId(
|
||||
GetCommandIdAt(index));
|
||||
|
@ -80,7 +81,7 @@ bool ElectronMenuModel::ShouldRegisterAcceleratorAt(int index) const {
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ElectronMenuModel::WorksWhenHiddenAt(int index) const {
|
||||
bool ElectronMenuModel::WorksWhenHiddenAt(size_t index) const {
|
||||
if (delegate_) {
|
||||
return delegate_->ShouldCommandIdWorkWhenHidden(GetCommandIdAt(index));
|
||||
}
|
||||
|
@ -88,7 +89,8 @@ bool ElectronMenuModel::WorksWhenHiddenAt(int index) const {
|
|||
}
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
bool ElectronMenuModel::GetSharingItemAt(int index, SharingItem* item) const {
|
||||
bool ElectronMenuModel::GetSharingItemAt(size_t index,
|
||||
SharingItem* item) const {
|
||||
if (delegate_)
|
||||
return delegate_->GetSharingItemForCommandId(GetCommandIdAt(index), item);
|
||||
return false;
|
||||
|
@ -118,7 +120,7 @@ void ElectronMenuModel::MenuWillShow() {
|
|||
}
|
||||
}
|
||||
|
||||
ElectronMenuModel* ElectronMenuModel::GetSubmenuModelAt(int index) {
|
||||
ElectronMenuModel* ElectronMenuModel::GetSubmenuModelAt(size_t index) {
|
||||
return static_cast<ElectronMenuModel*>(
|
||||
ui::SimpleMenuModel::GetSubmenuModelAt(index));
|
||||
}
|
||||
|
|
|
@ -81,20 +81,20 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
|
|||
void AddObserver(Observer* obs) { observers_.AddObserver(obs); }
|
||||
void RemoveObserver(Observer* obs) { observers_.RemoveObserver(obs); }
|
||||
|
||||
void SetToolTip(int index, const std::u16string& toolTip);
|
||||
std::u16string GetToolTipAt(int index);
|
||||
void SetRole(int index, const std::u16string& role);
|
||||
std::u16string GetRoleAt(int index);
|
||||
void SetSecondaryLabel(int index, const std::u16string& sublabel);
|
||||
std::u16string GetSecondaryLabelAt(int index) const override;
|
||||
bool GetAcceleratorAtWithParams(int index,
|
||||
void SetToolTip(size_t index, const std::u16string& toolTip);
|
||||
std::u16string GetToolTipAt(size_t index);
|
||||
void SetRole(size_t index, const std::u16string& role);
|
||||
std::u16string GetRoleAt(size_t index);
|
||||
void SetSecondaryLabel(size_t index, const std::u16string& sublabel);
|
||||
std::u16string GetSecondaryLabelAt(size_t index) const override;
|
||||
bool GetAcceleratorAtWithParams(size_t index,
|
||||
bool use_default_accelerator,
|
||||
ui::Accelerator* accelerator) const;
|
||||
bool ShouldRegisterAcceleratorAt(int index) const;
|
||||
bool WorksWhenHiddenAt(int index) const;
|
||||
bool ShouldRegisterAcceleratorAt(size_t index) const;
|
||||
bool WorksWhenHiddenAt(size_t index) const;
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
// Return the SharingItem of menu item.
|
||||
bool GetSharingItemAt(int index, SharingItem* item) const;
|
||||
bool GetSharingItemAt(size_t index, SharingItem* item) const;
|
||||
// Set/Get the SharingItem of this menu.
|
||||
void SetSharingItem(SharingItem item);
|
||||
const absl::optional<SharingItem>& GetSharingItem() const;
|
||||
|
@ -109,7 +109,7 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
|
|||
}
|
||||
|
||||
using SimpleMenuModel::GetSubmenuModelAt;
|
||||
ElectronMenuModel* GetSubmenuModelAt(int index);
|
||||
ElectronMenuModel* GetSubmenuModelAt(size_t index);
|
||||
|
||||
private:
|
||||
Delegate* delegate_; // weak ref.
|
||||
|
|
|
@ -150,7 +150,7 @@ void ExecuteCommand(ui::MenuModel* model, int id) {
|
|||
|
||||
if (event && event->type == GDK_BUTTON_RELEASE)
|
||||
event_flags = EventFlagsFromGdkState(event->button.state);
|
||||
model->ActivatedAt(id, event_flags);
|
||||
model->ActivatedAt(static_cast<int>(id), event_flags);
|
||||
|
||||
if (event)
|
||||
gdk_event_free(event);
|
||||
|
@ -163,7 +163,7 @@ void BuildSubmenuFromModel(ui::MenuModel* model,
|
|||
void* this_ptr) {
|
||||
std::map<int, GtkWidget*> radio_groups;
|
||||
GtkWidget* menu_item = nullptr;
|
||||
for (int i = 0; i < model->GetItemCount(); ++i) {
|
||||
for (size_t i = 0; i < model->GetItemCount(); ++i) {
|
||||
std::string label = ui::ConvertAcceleratorsFromWindowsStyle(
|
||||
base::UTF16ToUTF8(model->GetLabelAt(i)));
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ ElectronMenuModel* ModelForMenuItem(DbusmenuMenuitem* item) {
|
|||
g_object_get_data(G_OBJECT(item), "model"));
|
||||
}
|
||||
|
||||
bool GetMenuItemID(DbusmenuMenuitem* item, int* id) {
|
||||
bool GetMenuItemID(DbusmenuMenuitem* item, size_t* id) {
|
||||
gpointer id_ptr = g_object_get_data(G_OBJECT(item), "menu-id");
|
||||
if (id_ptr != nullptr) {
|
||||
*id = GPOINTER_TO_INT(id_ptr) - 1;
|
||||
|
@ -162,7 +162,7 @@ void SetMenuItemID(DbusmenuMenuitem* item, int id) {
|
|||
|
||||
std::string GetMenuModelStatus(ElectronMenuModel* model) {
|
||||
std::string ret;
|
||||
for (int i = 0; i < model->GetItemCount(); ++i) {
|
||||
for (size_t i = 0; i < model->GetItemCount(); ++i) {
|
||||
int status = model->GetTypeAt(i) | (model->IsVisibleAt(i) << 3) |
|
||||
(model->IsEnabledAt(i) << 4) |
|
||||
(model->IsItemCheckedAt(i) << 5);
|
||||
|
@ -231,7 +231,7 @@ void GlobalMenuBarX11::OnWindowUnmapped() {
|
|||
|
||||
void GlobalMenuBarX11::BuildMenuFromModel(ElectronMenuModel* model,
|
||||
DbusmenuMenuitem* parent) {
|
||||
for (int i = 0; i < model->GetItemCount(); ++i) {
|
||||
for (size_t i = 0; i < model->GetItemCount(); ++i) {
|
||||
DbusmenuMenuitem* item = menuitem_new();
|
||||
menuitem_property_set_bool(item, kPropertyVisible, model->IsVisibleAt(i));
|
||||
|
||||
|
@ -309,14 +309,14 @@ void GlobalMenuBarX11::RegisterAccelerator(DbusmenuMenuitem* item,
|
|||
|
||||
void GlobalMenuBarX11::OnItemActivated(DbusmenuMenuitem* item,
|
||||
unsigned int timestamp) {
|
||||
int id;
|
||||
size_t id;
|
||||
ElectronMenuModel* model = ModelForMenuItem(item);
|
||||
if (model && GetMenuItemID(item, &id))
|
||||
model->ActivatedAt(id, 0);
|
||||
}
|
||||
|
||||
void GlobalMenuBarX11::OnSubMenuShow(DbusmenuMenuitem* item) {
|
||||
int id;
|
||||
size_t id;
|
||||
ElectronMenuModel* model = ModelForMenuItem(item);
|
||||
if (!model || !GetMenuItemID(item, &id))
|
||||
return;
|
||||
|
|
|
@ -81,7 +81,7 @@ void MenuBar::ActivateAccelerator(char16_t key) {
|
|||
static_cast<SubmenuButton*>(child)->Activate(nullptr);
|
||||
}
|
||||
|
||||
int MenuBar::GetItemCount() const {
|
||||
size_t MenuBar::GetItemCount() const {
|
||||
return menu_model_ ? menu_model_->GetItemCount() : 0;
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ bool MenuBar::GetMenuButtonFromScreenPoint(const gfx::Point& screenPoint,
|
|||
return false;
|
||||
|
||||
auto children = GetChildrenInZOrder();
|
||||
for (int i = 0, n = children.size(); i < n; ++i) {
|
||||
for (size_t i = 0, n = children.size(); i < n; ++i) {
|
||||
if (children[i]->GetBoundsInScreen().Contains(screenPoint) &&
|
||||
(menu_model_->GetTypeAt(i) == ElectronMenuModel::TYPE_SUBMENU)) {
|
||||
*menu_model = menu_model_->GetSubmenuModelAt(i);
|
||||
|
@ -174,7 +174,7 @@ const char* MenuBar::GetClassName() const {
|
|||
return kViewClassName;
|
||||
}
|
||||
|
||||
void MenuBar::ButtonPressed(int id, const ui::Event& event) {
|
||||
void MenuBar::ButtonPressed(size_t id, const ui::Event& event) {
|
||||
// Hide the accelerator when a submenu is activated.
|
||||
SetAcceleratorVisibility(pane_has_focus());
|
||||
|
||||
|
@ -193,7 +193,8 @@ void MenuBar::ButtonPressed(int id, const ui::Event& event) {
|
|||
SubmenuButton* source = nullptr;
|
||||
for (auto* child : children()) {
|
||||
auto* button = static_cast<SubmenuButton*>(child);
|
||||
if (button->GetID() == id) {
|
||||
int button_id = button->GetID();
|
||||
if (button_id >= 0 && static_cast<size_t>(button_id) == id) {
|
||||
source = button;
|
||||
break;
|
||||
}
|
||||
|
@ -222,7 +223,7 @@ void MenuBar::RefreshColorCache(const ui::NativeTheme* theme) {
|
|||
|
||||
void MenuBar::RebuildChildren() {
|
||||
RemoveAllChildViews();
|
||||
for (int i = 0, n = GetItemCount(); i < n; ++i) {
|
||||
for (size_t i = 0, n = GetItemCount(); i < n; ++i) {
|
||||
auto* button = new SubmenuButton(
|
||||
base::BindRepeating(&MenuBar::ButtonPressed, base::Unretained(this), i),
|
||||
menu_model_->GetLabelAt(i), background_color_);
|
||||
|
|
|
@ -43,7 +43,7 @@ class MenuBar : public views::AccessiblePaneView,
|
|||
void ActivateAccelerator(char16_t key);
|
||||
|
||||
// Returns there are how many items in the root menu.
|
||||
int GetItemCount() const;
|
||||
size_t GetItemCount() const;
|
||||
|
||||
// Get the menu under specified screen point.
|
||||
bool GetMenuButtonFromScreenPoint(const gfx::Point& point,
|
||||
|
@ -71,7 +71,7 @@ class MenuBar : public views::AccessiblePaneView,
|
|||
const char* GetClassName() const override;
|
||||
void GetAccessibleNodeData(ui::AXNodeData* node_data) override;
|
||||
|
||||
void ButtonPressed(int id, const ui::Event& event);
|
||||
void ButtonPressed(size_t id, const ui::Event& event);
|
||||
|
||||
void RebuildChildren();
|
||||
void UpdateViewColors();
|
||||
|
|
|
@ -14,7 +14,7 @@ MenuModelAdapter::~MenuModelAdapter() = default;
|
|||
bool MenuModelAdapter::GetAccelerator(int id,
|
||||
ui::Accelerator* accelerator) const {
|
||||
ui::MenuModel* model = menu_model_;
|
||||
int index = 0;
|
||||
size_t index = 0;
|
||||
if (ui::MenuModel::GetModelAndIndexForCommandId(id, &model, &index)) {
|
||||
return static_cast<ElectronMenuModel*>(model)->GetAcceleratorAtWithParams(
|
||||
index, true, accelerator);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue