Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / ui / tabs / tab_menu_model.cc
index 1f9d839..ba70eac 100644 (file)
@@ -7,8 +7,8 @@
 #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,
@@ -36,6 +36,23 @@ void TabMenuModel::Build(TabStripModel* tab_strip, int index) {
         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,
@@ -55,12 +72,4 @@ void TabMenuModel::Build(TabStripModel* tab_strip, int index) {
                       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);
-  }
 }