Update source files for bracket style

This commit is contained in:
Marshall Greenblatt
2023-01-02 17:59:03 -05:00
parent d84b07a5cb
commit 3af3eab3e4
366 changed files with 7275 additions and 3834 deletions

View File

@ -70,43 +70,49 @@ void CefSimpleMenuModelImpl::Detach() {
submenumap_.clear();
}
if (is_owned_)
if (is_owned_) {
delete model_;
}
model_ = nullptr;
}
bool CefSimpleMenuModelImpl::IsSubMenu() {
if (!VerifyContext())
if (!VerifyContext()) {
return false;
}
return is_submenu_;
}
bool CefSimpleMenuModelImpl::Clear() {
if (!VerifyContext())
if (!VerifyContext()) {
return false;
}
model_->Clear();
return true;
}
size_t CefSimpleMenuModelImpl::GetCount() {
if (!VerifyContext())
if (!VerifyContext()) {
return 0;
}
return model_->GetItemCount();
}
bool CefSimpleMenuModelImpl::AddSeparator() {
if (!VerifyContext())
if (!VerifyContext()) {
return false;
}
model_->AddSeparator(ui::NORMAL_SEPARATOR);
return true;
}
bool CefSimpleMenuModelImpl::AddItem(int command_id, const CefString& label) {
if (!VerifyContext())
if (!VerifyContext()) {
return false;
}
model_->AddItem(command_id, label);
return true;
@ -114,8 +120,9 @@ bool CefSimpleMenuModelImpl::AddItem(int command_id, const CefString& label) {
bool CefSimpleMenuModelImpl::AddCheckItem(int command_id,
const CefString& label) {
if (!VerifyContext())
if (!VerifyContext()) {
return false;
}
model_->AddCheckItem(command_id, label);
return true;
@ -124,8 +131,9 @@ bool CefSimpleMenuModelImpl::AddCheckItem(int command_id,
bool CefSimpleMenuModelImpl::AddRadioItem(int command_id,
const CefString& label,
int group_id) {
if (!VerifyContext())
if (!VerifyContext()) {
return false;
}
model_->AddRadioItem(command_id, label, group_id);
return true;
@ -134,8 +142,9 @@ bool CefSimpleMenuModelImpl::AddRadioItem(int command_id,
CefRefPtr<CefMenuModel> CefSimpleMenuModelImpl::AddSubMenu(
int command_id,
const CefString& label) {
if (!VerifyContext())
if (!VerifyContext()) {
return nullptr;
}
auto new_menu = CreateNewSubMenu(nullptr);
model_->AddSubMenu(command_id, label, new_menu->model());
@ -143,8 +152,9 @@ CefRefPtr<CefMenuModel> CefSimpleMenuModelImpl::AddSubMenu(
}
bool CefSimpleMenuModelImpl::InsertSeparatorAt(size_t index) {
if (!VerifyContext())
if (!VerifyContext()) {
return false;
}
model_->InsertSeparatorAt(index, ui::NORMAL_SEPARATOR);
return true;
@ -153,8 +163,9 @@ bool CefSimpleMenuModelImpl::InsertSeparatorAt(size_t index) {
bool CefSimpleMenuModelImpl::InsertItemAt(size_t index,
int command_id,
const CefString& label) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return false;
}
model_->InsertItemAt(index, command_id, label);
return true;
@ -163,8 +174,9 @@ bool CefSimpleMenuModelImpl::InsertItemAt(size_t index,
bool CefSimpleMenuModelImpl::InsertCheckItemAt(size_t index,
int command_id,
const CefString& label) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return false;
}
model_->InsertCheckItemAt(index, command_id, label);
return true;
@ -174,8 +186,9 @@ bool CefSimpleMenuModelImpl::InsertRadioItemAt(size_t index,
int command_id,
const CefString& label,
int group_id) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return false;
}
model_->InsertRadioItemAt(index, command_id, label, group_id);
return true;
@ -185,8 +198,9 @@ CefRefPtr<CefMenuModel> CefSimpleMenuModelImpl::InsertSubMenuAt(
size_t index,
int command_id,
const CefString& label) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return nullptr;
}
auto new_menu = CreateNewSubMenu(nullptr);
model_->InsertSubMenuAt(index, command_id, label, new_menu->model());
@ -198,8 +212,9 @@ bool CefSimpleMenuModelImpl::Remove(int command_id) {
}
bool CefSimpleMenuModelImpl::RemoveAt(size_t index) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return false;
}
auto* sub_menu =
static_cast<ui::SimpleMenuModel*>(model_->GetSubmenuModelAt(index));
@ -216,18 +231,21 @@ bool CefSimpleMenuModelImpl::RemoveAt(size_t index) {
}
int CefSimpleMenuModelImpl::GetIndexOf(int command_id) {
if (!VerifyContext())
if (!VerifyContext()) {
return kInvalidIndex;
}
auto index = model_->GetIndexOfCommandId(command_id);
if (index.has_value())
if (index.has_value()) {
return static_cast<int>(*index);
}
return -1;
}
int CefSimpleMenuModelImpl::GetCommandIdAt(size_t index) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return kInvalidCommandId;
}
return model_->GetCommandIdAt(index);
}
@ -242,8 +260,9 @@ CefString CefSimpleMenuModelImpl::GetLabel(int command_id) {
}
CefString CefSimpleMenuModelImpl::GetLabelAt(size_t index) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return CefString();
}
return model_->GetLabelAt(index);
}
@ -253,8 +272,9 @@ bool CefSimpleMenuModelImpl::SetLabel(int command_id, const CefString& label) {
}
bool CefSimpleMenuModelImpl::SetLabelAt(size_t index, const CefString& label) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return false;
}
model_->SetLabel(index, label);
return true;
@ -267,8 +287,9 @@ CefSimpleMenuModelImpl::MenuItemType CefSimpleMenuModelImpl::GetType(
CefSimpleMenuModelImpl::MenuItemType CefSimpleMenuModelImpl::GetTypeAt(
size_t index) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return MENUITEMTYPE_NONE;
}
return GetCefItemType(model_->GetTypeAt(index));
}
@ -278,8 +299,9 @@ int CefSimpleMenuModelImpl::GetGroupId(int command_id) {
}
int CefSimpleMenuModelImpl::GetGroupIdAt(size_t index) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return kInvalidGroupId;
}
return model_->GetGroupIdAt(index);
}
@ -298,14 +320,16 @@ CefRefPtr<CefMenuModel> CefSimpleMenuModelImpl::GetSubMenu(int command_id) {
}
CefRefPtr<CefMenuModel> CefSimpleMenuModelImpl::GetSubMenuAt(size_t index) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return nullptr;
}
auto* sub_model =
static_cast<ui::SimpleMenuModel*>(model_->GetSubmenuModelAt(index));
auto it = submenumap_.find(sub_model);
if (it != submenumap_.end())
if (it != submenumap_.end()) {
return it->second;
}
return CreateNewSubMenu(sub_model);
}
@ -314,8 +338,9 @@ bool CefSimpleMenuModelImpl::IsVisible(int command_id) {
}
bool CefSimpleMenuModelImpl::IsVisibleAt(size_t index) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return false;
}
return model_->IsVisibleAt(index);
}
@ -325,8 +350,9 @@ bool CefSimpleMenuModelImpl::SetVisible(int command_id, bool visible) {
}
bool CefSimpleMenuModelImpl::SetVisibleAt(size_t index, bool visible) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return false;
}
model_->SetVisibleAt(index, visible);
return true;
@ -337,8 +363,9 @@ bool CefSimpleMenuModelImpl::IsEnabled(int command_id) {
}
bool CefSimpleMenuModelImpl::IsEnabledAt(size_t index) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return false;
}
return model_->IsEnabledAt(index);
}
@ -348,8 +375,9 @@ bool CefSimpleMenuModelImpl::SetEnabled(int command_id, bool enabled) {
}
bool CefSimpleMenuModelImpl::SetEnabledAt(size_t index, bool enabled) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return false;
}
model_->SetEnabledAt(index, enabled);
return true;
@ -360,15 +388,17 @@ bool CefSimpleMenuModelImpl::IsChecked(int command_id) {
}
bool CefSimpleMenuModelImpl::IsCheckedAt(size_t index) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return false;
}
return model_->IsItemCheckedAt(index);
}
bool CefSimpleMenuModelImpl::SetChecked(int command_id, bool checked) {
if (!VerifyContext() || command_id == kInvalidIndex)
if (!VerifyContext() || command_id == kInvalidIndex) {
return false;
}
state_delegate_->SetChecked(command_id, checked);
return true;
@ -383,8 +413,9 @@ bool CefSimpleMenuModelImpl::HasAccelerator(int command_id) {
}
bool CefSimpleMenuModelImpl::HasAcceleratorAt(size_t index) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return false;
}
ui::Accelerator accelerator;
return model_->GetAcceleratorAt(index, &accelerator);
@ -395,16 +426,20 @@ bool CefSimpleMenuModelImpl::SetAccelerator(int command_id,
bool shift_pressed,
bool ctrl_pressed,
bool alt_pressed) {
if (!VerifyContext() || command_id == kInvalidIndex)
if (!VerifyContext() || command_id == kInvalidIndex) {
return false;
}
int modifiers = 0;
if (shift_pressed)
if (shift_pressed) {
modifiers |= ui::EF_SHIFT_DOWN;
if (ctrl_pressed)
}
if (ctrl_pressed) {
modifiers |= ui::EF_CONTROL_DOWN;
if (alt_pressed)
}
if (alt_pressed) {
modifiers |= ui::EF_ALT_DOWN;
}
state_delegate_->SetAccelerator(
command_id,
@ -422,8 +457,9 @@ bool CefSimpleMenuModelImpl::SetAcceleratorAt(size_t index,
}
bool CefSimpleMenuModelImpl::RemoveAccelerator(int command_id) {
if (!VerifyContext() || command_id == kInvalidIndex)
if (!VerifyContext() || command_id == kInvalidIndex) {
return false;
}
state_delegate_->SetAccelerator(command_id, absl::nullopt);
return true;
}
@ -446,8 +482,9 @@ bool CefSimpleMenuModelImpl::GetAcceleratorAt(size_t index,
bool& shift_pressed,
bool& ctrl_pressed,
bool& alt_pressed) {
if (!VerifyContext() || !ValidIndex(index))
if (!VerifyContext() || !ValidIndex(index)) {
return false;
}
ui::Accelerator accel;
if (model_->GetAcceleratorAt(index, &accel)) {
@ -507,8 +544,9 @@ bool CefSimpleMenuModelImpl::VerifyContext() {
return false;
}
if (!model_)
if (!model_) {
return false;
}
return true;
}