| 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 |
| 11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
| 12 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 13 #include "content/public/browser/web_contents_user_data.h" | 13 #include "content/public/browser/web_contents_user_data.h" |
| 14 #include "third_party/skia/include/core/SkColor.h" |
| 14 | 15 |
| 15 class TabStripModel; | 16 class TabStripModel; |
| 16 | 17 |
| 17 namespace content { | 18 namespace content { |
| 18 class WebContents; | 19 class WebContents; |
| 19 } // namespace content | 20 } // namespace content |
| 20 | 21 |
| 21 namespace gfx { | 22 namespace gfx { |
| 22 class Animation; | 23 class Animation; |
| 23 class Image; | 24 class Image; |
| 24 } // namespace gfx | 25 } // namespace gfx |
| 25 | 26 |
| 26 namespace ui { | |
| 27 class ThemeProvider; | |
| 28 } | |
| 29 | |
| 30 // Media state for a tab. In reality, more than one of these may apply. See | 27 // Media state for a tab. In reality, more than one of these may apply. See |
| 31 // comments for GetTabMediaStateForContents() below. | 28 // comments for GetTabMediaStateForContents() below. |
| 32 enum TabMediaState { | 29 enum TabMediaState { |
| 33 TAB_MEDIA_STATE_NONE, | 30 TAB_MEDIA_STATE_NONE, |
| 34 TAB_MEDIA_STATE_RECORDING, // Audio/Video being recorded, consumed by tab. | 31 TAB_MEDIA_STATE_RECORDING, // Audio/Video being recorded, consumed by tab. |
| 35 TAB_MEDIA_STATE_CAPTURING, // Tab contents being captured. | 32 TAB_MEDIA_STATE_CAPTURING, // Tab contents being captured. |
| 36 TAB_MEDIA_STATE_AUDIO_PLAYING, // Audible audio is playing from the tab. | 33 TAB_MEDIA_STATE_AUDIO_PLAYING, // Audible audio is playing from the tab. |
| 37 TAB_MEDIA_STATE_AUDIO_MUTING, // Tab audio is being muted. | 34 TAB_MEDIA_STATE_AUDIO_MUTING, // Tab audio is being muted. |
| 38 }; | 35 }; |
| 39 | 36 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 bool is_active_tab); | 77 bool is_active_tab); |
| 81 | 78 |
| 82 // Returns the media state to be shown by the tab's media indicator. When | 79 // Returns the media state to be shown by the tab's media indicator. When |
| 83 // multiple states apply (e.g., tab capture with audio playback), the one most | 80 // multiple states apply (e.g., tab capture with audio playback), the one most |
| 84 // relevant to user privacy concerns is selected. | 81 // relevant to user privacy concerns is selected. |
| 85 TabMediaState GetTabMediaStateForContents(content::WebContents* contents); | 82 TabMediaState GetTabMediaStateForContents(content::WebContents* contents); |
| 86 | 83 |
| 87 // Returns a cached image, to be shown by the media indicator for the given | 84 // Returns a cached image, to be shown by the media indicator for the given |
| 88 // |media_state|. Uses the global ui::ResourceBundle shared instance. | 85 // |media_state|. Uses the global ui::ResourceBundle shared instance. |
| 89 gfx::Image GetTabMediaIndicatorImage(TabMediaState media_state, | 86 gfx::Image GetTabMediaIndicatorImage(TabMediaState media_state, |
| 90 const ui::ThemeProvider* tp); | 87 SkColor button_color); |
| 91 | 88 |
| 92 // Returns the cached image, to be shown by the media indicator button for mouse | 89 // Returns the cached image, to be shown by the media indicator button for mouse |
| 93 // hover/pressed, when the indicator is in the given |media_state|. Uses the | 90 // hover/pressed, when the indicator is in the given |media_state|. Uses the |
| 94 // global ui::ResourceBundle shared instance. | 91 // global ui::ResourceBundle shared instance. |
| 95 gfx::Image GetTabMediaIndicatorAffordanceImage(TabMediaState media_state, | 92 gfx::Image GetTabMediaIndicatorAffordanceImage(TabMediaState media_state, |
| 96 const ui::ThemeProvider* tp); | 93 SkColor button_color); |
| 97 | 94 |
| 98 // Returns a non-continuous Animation that performs a fade-in or fade-out | 95 // Returns a non-continuous Animation that performs a fade-in or fade-out |
| 99 // appropriate for the given |next_media_state|. This is used by the tab media | 96 // appropriate for the given |next_media_state|. This is used by the tab media |
| 100 // indicator to alert the user that recording, tab capture, or audio playback | 97 // indicator to alert the user that recording, tab capture, or audio playback |
| 101 // has started/stopped. | 98 // has started/stopped. |
| 102 scoped_ptr<gfx::Animation> CreateTabMediaIndicatorFadeAnimation( | 99 scoped_ptr<gfx::Animation> CreateTabMediaIndicatorFadeAnimation( |
| 103 TabMediaState next_media_state); | 100 TabMediaState next_media_state); |
| 104 | 101 |
| 105 // Returns the text to show in a tab's tooltip: The contents |title|, followed | 102 // Returns the text to show in a tab's tooltip: The contents |title|, followed |
| 106 // by a break, followed by a localized string describing the |media_state|. | 103 // by a break, followed by a localized string describing the |media_state|. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // string is returned. | 139 // string is returned. |
| 143 const std::string& GetExtensionIdForMutedTab(content::WebContents* contents); | 140 const std::string& GetExtensionIdForMutedTab(content::WebContents* contents); |
| 144 | 141 |
| 145 // Returns true if the tabs at the |indices| in |tab_strip| are all muted. | 142 // Returns true if the tabs at the |indices| in |tab_strip| are all muted. |
| 146 bool AreAllTabsMuted(const TabStripModel& tab_strip, | 143 bool AreAllTabsMuted(const TabStripModel& tab_strip, |
| 147 const std::vector<int>& indices); | 144 const std::vector<int>& indices); |
| 148 | 145 |
| 149 } // namespace chrome | 146 } // namespace chrome |
| 150 | 147 |
| 151 #endif // CHROME_BROWSER_UI_TABS_TAB_UTILS_H_ | 148 #endif // CHROME_BROWSER_UI_TABS_TAB_UTILS_H_ |
| OLD | NEW |