| OLD | NEW |
| 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 <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // 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 |
| 27 // comments for GetTabMediaStateForContents() below. | 27 // comments for GetTabMediaStateForContents() below. |
| 28 enum TabMediaState { | 28 enum TabMediaState { |
| 29 TAB_MEDIA_STATE_NONE, | 29 TAB_MEDIA_STATE_NONE, |
| 30 TAB_MEDIA_STATE_RECORDING, // Audio/Video being recorded, consumed by tab. | 30 TAB_MEDIA_STATE_RECORDING, // Audio/Video being recorded, consumed by tab. |
| 31 TAB_MEDIA_STATE_CAPTURING, // Tab contents being captured. | 31 TAB_MEDIA_STATE_CAPTURING, // Tab contents being captured. |
| 32 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. |
| 33 TAB_MEDIA_STATE_AUDIO_MUTING, // Tab audio is being muted. | 33 TAB_MEDIA_STATE_AUDIO_MUTING, // Tab audio is being muted. |
| 34 }; | 34 }; |
| 35 | 35 |
| 36 enum TabMutedResult { |
| 37 TAB_MUTED_RESULT_SUCCESS, |
| 38 TAB_MUTED_RESULT_FAIL_NOT_ENABLED, |
| 39 TAB_MUTED_RESULT_FAIL_TABCAPTURE, |
| 40 }; |
| 41 |
| 36 namespace chrome { | 42 namespace chrome { |
| 37 | 43 |
| 38 // String to indicate reason for muted state change (user, capture, extension | 44 // String to indicate reason for muted state change (user, capture, extension |
| 39 // id, or empty string) | 45 // id, or empty string) |
| 40 extern const char kMutedToggleCauseUser[]; | 46 extern const char kMutedToggleCauseUser[]; |
| 41 extern const char kMutedToggleCauseCapture[]; | 47 extern const char kMutedToggleCauseCapture[]; |
| 42 | 48 |
| 43 // Logic to determine which components (i.e., close button, favicon, and media | 49 // Logic to determine which components (i.e., close button, favicon, and media |
| 44 // indicator) of a tab should be shown, given current state. |capacity| | 50 // indicator) of a tab should be shown, given current state. |capacity| |
| 45 // specifies how many components can be shown, given available tab width. | 51 // specifies how many components can be shown, given available tab width. |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 108 |
| 103 // Returns true if audio mute can be activated/deactivated for the given | 109 // Returns true if audio mute can be activated/deactivated for the given |
| 104 // |contents|. | 110 // |contents|. |
| 105 bool CanToggleAudioMute(content::WebContents* contents); | 111 bool CanToggleAudioMute(content::WebContents* contents); |
| 106 | 112 |
| 107 // Indicates whether all audio output from |contents| is muted. | 113 // Indicates whether all audio output from |contents| is muted. |
| 108 bool IsTabAudioMuted(content::WebContents* contents); | 114 bool IsTabAudioMuted(content::WebContents* contents); |
| 109 | 115 |
| 110 // Sets whether all audio output from |contents| is muted. | 116 // Sets whether all audio output from |contents| is muted. |
| 111 // Cause is extensionid, kMutedToggleCause constant, or empty string | 117 // Cause is extensionid, kMutedToggleCause constant, or empty string |
| 112 void SetTabAudioMuted(content::WebContents* contents, | 118 TabMutedResult SetTabAudioMuted(content::WebContents* contents, |
| 113 bool mute, | 119 bool mute, |
| 114 const std::string& cause); | 120 const std::string& cause); |
| 115 | 121 |
| 116 // Get cause of mute (extensionid, kMutedToggleCause constant, or empty string) | 122 // Get cause of mute (extensionid, kMutedToggleCause constant, or empty string) |
| 117 const std::string& GetTabAudioMutedCause(content::WebContents* contents); | 123 const std::string& GetTabAudioMutedCause(content::WebContents* contents); |
| 118 | 124 |
| 119 // Returns true if the tabs at the |indices| in |tab_strip| are all muted. | 125 // Returns true if the tabs at the |indices| in |tab_strip| are all muted. |
| 120 bool AreAllTabsMuted(const TabStripModel& tab_strip, | 126 bool AreAllTabsMuted(const TabStripModel& tab_strip, |
| 121 const std::vector<int>& indices); | 127 const std::vector<int>& indices); |
| 122 | 128 |
| 123 } // namespace chrome | 129 } // namespace chrome |
| 124 | 130 |
| 125 #endif // CHROME_BROWSER_UI_TABS_TAB_UTILS_H_ | 131 #endif // CHROME_BROWSER_UI_TABS_TAB_UTILS_H_ |
| OLD | NEW |