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

Side by Side Diff: chrome/browser/ui/tabs/tab_utils.h

Issue 757033005: Make tab audible and muted states and cause available for an extension API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Improve naming/capitalization for muted toggle strings; remove audible/muted event-listener code fr… Created 6 years 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_UI_TABS_TAB_UTILS_H_ 5 #ifndef CHROME_BROWSER_UI_TABS_TAB_UTILS_H_
6 #define CHROME_BROWSER_UI_TABS_TAB_UTILS_H_ 6 #define CHROME_BROWSER_UI_TABS_TAB_UTILS_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 15 matching lines...) Expand all
26 enum TabMediaState { 26 enum TabMediaState {
27 TAB_MEDIA_STATE_NONE, 27 TAB_MEDIA_STATE_NONE,
28 TAB_MEDIA_STATE_RECORDING, // Audio/Video being recorded, consumed by tab. 28 TAB_MEDIA_STATE_RECORDING, // Audio/Video being recorded, consumed by tab.
29 TAB_MEDIA_STATE_CAPTURING, // Tab contents being captured. 29 TAB_MEDIA_STATE_CAPTURING, // Tab contents being captured.
30 TAB_MEDIA_STATE_AUDIO_PLAYING, // Audible audio is playing from the tab. 30 TAB_MEDIA_STATE_AUDIO_PLAYING, // Audible audio is playing from the tab.
31 TAB_MEDIA_STATE_AUDIO_MUTING, // Tab audio is being muted. 31 TAB_MEDIA_STATE_AUDIO_MUTING, // Tab audio is being muted.
32 }; 32 };
33 33
34 namespace chrome { 34 namespace chrome {
35 35
36 // String to indicate that muted state change was caused by user (instead of
37 // initial, capture, an extension id).
38 const char kMutedToggleCauseUser[] = "user";
39
36 // Logic to determine which components (i.e., close button, favicon, and media 40 // Logic to determine which components (i.e., close button, favicon, and media
37 // indicator) of a tab should be shown, given current state. |capacity| 41 // indicator) of a tab should be shown, given current state. |capacity|
38 // specifies how many components can be shown, given available tab width. 42 // specifies how many components can be shown, given available tab width.
39 // 43 //
40 // Precedence rules for deciding what to show when capacity is insufficient to 44 // Precedence rules for deciding what to show when capacity is insufficient to
41 // show everything: 45 // show everything:
42 // 46 //
43 // Active tab: Always show the close button, then the media indicator, then 47 // Active tab: Always show the close button, then the media indicator, then
44 // the favicon. 48 // the favicon.
45 // Inactive tab: Media indicator, then the favicon, then the close button. 49 // Inactive tab: Media indicator, then the favicon, then the close button.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 96
93 // Returns true if the experimental tab audio mute feature is enabled. 97 // Returns true if the experimental tab audio mute feature is enabled.
94 bool IsTabAudioMutingFeatureEnabled(); 98 bool IsTabAudioMutingFeatureEnabled();
95 99
96 // Returns true if audio mute can be activated/deactivated for the given 100 // Returns true if audio mute can be activated/deactivated for the given
97 // |contents|. 101 // |contents|.
98 bool CanToggleAudioMute(content::WebContents* contents); 102 bool CanToggleAudioMute(content::WebContents* contents);
99 103
100 // Indicates/Sets whether all audio output from |contents| is muted. 104 // Indicates/Sets whether all audio output from |contents| is muted.
101 bool IsTabAudioMuted(content::WebContents* contents); 105 bool IsTabAudioMuted(content::WebContents* contents);
102 void SetTabAudioMuted(content::WebContents* contents, bool mute); 106 void SetTabAudioMuted(content::WebContents* contents,
107 bool muted,
108 const std::string& cause);
103 109
104 // Returns true if the tabs at the |indices| in |tab_strip| are all muted. 110 // Returns true if the tabs at the |indices| in |tab_strip| are all muted.
105 bool AreAllTabsMuted(const TabStripModel& tab_strip, 111 bool AreAllTabsMuted(const TabStripModel& tab_strip,
106 const std::vector<int>& indices); 112 const std::vector<int>& indices);
107 113
108 } // namespace chrome 114 } // namespace chrome
109 115
110 #endif // CHROME_BROWSER_UI_TABS_TAB_UTILS_H_ 116 #endif // CHROME_BROWSER_UI_TABS_TAB_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698