Skip to content

Commit

Permalink
Hide sync menu from app menu if it's disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhong committed Feb 10, 2020
1 parent 2b7923b commit 31e39ac
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion browser/ui/toolbar/brave_app_menu_model.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

#include "brave/browser/ui/toolbar/brave_app_menu_model.h"

#include "brave/components/brave_sync/buildflags/buildflags.h"
#include "chrome/app/chrome_command_ids.h"
#include "chrome/grit/generated_resources.h"
#include "components/sync/driver/sync_driver_switches.h"

BraveAppMenuModel::~BraveAppMenuModel() = default;

Expand Down Expand Up @@ -76,12 +78,15 @@ void BraveAppMenuModel::InsertBraveMenuItems() {
IDS_SHOW_BRAVE_WALLET);
}

#if BUILDFLAG(ENABLE_BRAVE_SYNC)
// Insert sync menu
if (IsCommandIdEnabled(IDC_SHOW_BRAVE_SYNC)) {
if (switches::IsSyncAllowedByFlag() &&
IsCommandIdEnabled(IDC_SHOW_BRAVE_SYNC)) {
InsertItemWithStringIdAt(GetIndexOfBraveSyncItem(),
IDC_SHOW_BRAVE_SYNC,
IDS_SHOW_BRAVE_SYNC);
}
#endif

// Insert adblock menu at last. Assumed this is always enabled.
DCHECK(IsCommandIdEnabled(IDC_SHOW_BRAVE_ADBLOCK));
Expand Down

0 comments on commit 31e39ac

Please sign in to comment.