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

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: Document cause within method declaration Created 5 years, 9 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/tabs/tab_strip_model.cc ('k') | chrome/browser/ui/tabs/tab_utils.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string>
8 #include <vector> 9 #include <vector>
9 10
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/strings/string16.h" 12 #include "base/strings/string16.h"
13 #include "content/public/browser/web_contents_user_data.h"
12 14
13 class TabStripModel; 15 class TabStripModel;
14 16
15 namespace content { 17 namespace content {
16 class WebContents; 18 class WebContents;
17 } // namespace content 19 } // namespace content
18 20
19 namespace gfx { 21 namespace gfx {
20 class Animation; 22 class Animation;
21 class Image; 23 class Image;
22 } // namespace gfx 24 } // namespace gfx
23 25
24 // Media state for a tab. In reality, more than one of these may apply. See 26 // Media state for a tab. In reality, more than one of these may apply. See
25 // comments for GetTabMediaStateForContents() below. 27 // comments for GetTabMediaStateForContents() below.
26 enum TabMediaState { 28 enum TabMediaState {
27 TAB_MEDIA_STATE_NONE, 29 TAB_MEDIA_STATE_NONE,
28 TAB_MEDIA_STATE_RECORDING, // Audio/Video being recorded, consumed by tab. 30 TAB_MEDIA_STATE_RECORDING, // Audio/Video being recorded, consumed by tab.
29 TAB_MEDIA_STATE_CAPTURING, // Tab contents being captured. 31 TAB_MEDIA_STATE_CAPTURING, // Tab contents being captured.
30 TAB_MEDIA_STATE_AUDIO_PLAYING, // Audible audio is playing from the tab. 32 TAB_MEDIA_STATE_AUDIO_PLAYING, // Audible audio is playing from the tab.
31 TAB_MEDIA_STATE_AUDIO_MUTING, // Tab audio is being muted. 33 TAB_MEDIA_STATE_AUDIO_MUTING, // Tab audio is being muted.
32 }; 34 };
33 35
34 namespace chrome { 36 namespace chrome {
35 37
38 // String to indicate reason for muted state change (user, capture, extension
39 // id, or empty string)
40 extern const char kMutedToggleCauseUser[];
41 extern const char kMutedToggleCauseCapture[];
42
36 // Logic to determine which components (i.e., close button, favicon, and media 43 // Logic to determine which components (i.e., close button, favicon, and media
37 // indicator) of a tab should be shown, given current state. |capacity| 44 // indicator) of a tab should be shown, given current state. |capacity|
38 // specifies how many components can be shown, given available tab width. 45 // specifies how many components can be shown, given available tab width.
39 // 46 //
40 // Precedence rules for deciding what to show when capacity is insufficient to 47 // Precedence rules for deciding what to show when capacity is insufficient to
41 // show everything: 48 // show everything:
42 // 49 //
43 // Active tab: Always show the close button, then the media indicator, then 50 // Active tab: Always show the close button, then the media indicator, then
44 // the favicon. 51 // the favicon.
45 // Inactive tab: Media indicator, then the favicon, then the close button. 52 // Inactive tab: Media indicator, then the favicon, then the close button.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 base::string16 AssembleTabTooltipText(const base::string16& title, 97 base::string16 AssembleTabTooltipText(const base::string16& title,
91 TabMediaState media_state); 98 TabMediaState media_state);
92 99
93 // Returns true if the experimental tab audio mute feature is enabled. 100 // Returns true if the experimental tab audio mute feature is enabled.
94 bool IsTabAudioMutingFeatureEnabled(); 101 bool IsTabAudioMutingFeatureEnabled();
95 102
96 // Returns true if audio mute can be activated/deactivated for the given 103 // Returns true if audio mute can be activated/deactivated for the given
97 // |contents|. 104 // |contents|.
98 bool CanToggleAudioMute(content::WebContents* contents); 105 bool CanToggleAudioMute(content::WebContents* contents);
99 106
100 // Indicates/Sets whether all audio output from |contents| is muted. 107 // Indicates whether all audio output from |contents| is muted.
101 bool IsTabAudioMuted(content::WebContents* contents); 108 bool IsTabAudioMuted(content::WebContents* contents);
102 void SetTabAudioMuted(content::WebContents* contents, bool mute); 109
110 // Sets whether all audio output from |contents| is muted.
111 // Cause is extensionid, kMutedToggleCause constant, or empty string
112 void SetTabAudioMuted(content::WebContents* contents,
113 bool mute,
114 const std::string& cause);
115
116 // Get cause of mute (extensionid, kMutedToggleCause constant, or empty string)
117 const std::string& GetTabAudioMutedCause(content::WebContents* contents);
103 118
104 // Returns true if the tabs at the |indices| in |tab_strip| are all muted. 119 // Returns true if the tabs at the |indices| in |tab_strip| are all muted.
105 bool AreAllTabsMuted(const TabStripModel& tab_strip, 120 bool AreAllTabsMuted(const TabStripModel& tab_strip,
106 const std::vector<int>& indices); 121 const std::vector<int>& indices);
107 122
108 } // namespace chrome 123 } // namespace chrome
109 124
110 #endif // CHROME_BROWSER_UI_TABS_TAB_UTILS_H_ 125 #endif // CHROME_BROWSER_UI_TABS_TAB_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/tabs/tab_strip_model.cc ('k') | chrome/browser/ui/tabs/tab_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698