Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4303)

Unified Diff: chrome/browser/ui/tabs/tab_strip_model.cc

Issue 591963002: Tab audio mute control (views UI), behind a switch (off by default). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + add about:flags experiment Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/tabs/tab_strip_model.h ('k') | chrome/browser/ui/tabs/tab_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/tabs/tab_strip_model.cc
diff --git a/chrome/browser/ui/tabs/tab_strip_model.cc b/chrome/browser/ui/tabs/tab_strip_model.cc
index b7c60fbf90b974ee96176bae87dab73caad7e934..3298943ea311b5c362213fef20ab58aa33270bed 100644
--- a/chrome/browser/ui/tabs/tab_strip_model.cc
+++ b/chrome/browser/ui/tabs/tab_strip_model.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/ui/tab_contents/core_tab_helper_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model_delegate.h"
#include "chrome/browser/ui/tabs/tab_strip_model_order_controller.h"
+#include "chrome/browser/ui/tabs/tab_utils.h"
#include "chrome/browser/ui/web_contents_sizer.h"
#include "chrome/common/url_constants.h"
#include "components/web_modal/popup_manager.h"
@@ -919,6 +920,15 @@ bool TabStripModel::IsContextMenuCommandEnabled(
return false;
}
+ case CommandToggleTabAudioMuted: {
+ std::vector<int> indices = GetIndicesForCommand(context_index);
+ for (size_t i = 0; i < indices.size(); ++i) {
+ if (!chrome::CanToggleAudioMute(GetWebContentsAt(indices[i])))
+ return false;
+ }
+ return true;
+ }
+
case CommandBookmarkAllTabs:
return browser_defaults::bookmarks_enabled &&
delegate_->CanBookmarkAllTabs();
@@ -1026,6 +1036,20 @@ void TabStripModel::ExecuteContextMenuCommand(
break;
}
+ case CommandToggleTabAudioMuted: {
+ const std::vector<int>& indices = GetIndicesForCommand(context_index);
+ const bool mute = !chrome::AreAllTabsMuted(*this, indices);
+ if (mute)
+ content::RecordAction(UserMetricsAction("TabContextMenu_MuteTabs"));
+ else
+ content::RecordAction(UserMetricsAction("TabContextMenu_UnmuteTabs"));
+ for (std::vector<int>::const_iterator i = indices.begin();
+ i != indices.end(); ++i) {
+ chrome::SetTabAudioMuted(GetWebContentsAt(*i), mute);
+ }
+ break;
+ }
+
case CommandBookmarkAllTabs: {
content::RecordAction(
UserMetricsAction("TabContextMenu_BookmarkAllTabs"));
« no previous file with comments | « chrome/browser/ui/tabs/tab_strip_model.h ('k') | chrome/browser/ui/tabs/tab_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698