#include "base/command_line.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
-#include "chrome/common/chrome_switches.h"
-#include "grit/generated_resources.h"
+#include "chrome/browser/ui/tabs/tab_utils.h"
+#include "chrome/grit/generated_resources.h"
TabMenuModel::TabMenuModel(ui::SimpleMenuModel::Delegate* delegate,
TabStripModel* tab_strip,
TabStripModel::CommandTogglePinned,
will_pin ? IDS_TAB_CXMENU_PIN_TAB : IDS_TAB_CXMENU_UNPIN_TAB);
}
+ if (chrome::IsTabAudioMutingFeatureEnabled()) {
+ if (affects_multiple_tabs) {
+ const bool will_mute = !chrome::AreAllTabsMuted(
+ *tab_strip, tab_strip->selection_model().selected_indices());
+ AddItemWithStringId(
+ TabStripModel::CommandToggleTabAudioMuted,
+ will_mute ? IDS_TAB_CXMENU_AUDIO_MUTE_TABS :
+ IDS_TAB_CXMENU_AUDIO_UNMUTE_TABS);
+ } else {
+ const bool will_mute =
+ !chrome::IsTabAudioMuted(tab_strip->GetWebContentsAt(index));
+ AddItemWithStringId(
+ TabStripModel::CommandToggleTabAudioMuted,
+ will_mute ? IDS_TAB_CXMENU_AUDIO_MUTE_TAB :
+ IDS_TAB_CXMENU_AUDIO_UNMUTE_TAB);
+ }
+ }
AddSeparator(ui::NORMAL_SEPARATOR);
if (affects_multiple_tabs) {
AddItemWithStringId(TabStripModel::CommandCloseTab,
is_window ? IDS_RESTORE_WINDOW : IDS_RESTORE_TAB);
AddItemWithStringId(TabStripModel::CommandBookmarkAllTabs,
IDS_TAB_CXMENU_BOOKMARK_ALL_TABS);
- if (CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kEnableTabGroupsContextMenu)) {
- AddSeparator(ui::NORMAL_SEPARATOR);
- AddItemWithStringId(TabStripModel::CommandSelectByDomain,
- IDS_TAB_CXMENU_SELECT_BY_DOMAIN);
- AddItemWithStringId(TabStripModel::CommandSelectByOpener,
- IDS_TAB_CXMENU_SELECT_BY_OPENER);
- }
}