| 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 #include "chrome/browser/ui/tabs/tab_utils.h" | 5 #include "chrome/browser/ui/tabs/tab_utils.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/app/vector_icons/vector_icons.h" |
| 12 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" | 13 #include "chrome/browser/media/webrtc/media_capture_devices_dispatcher.h" |
| 13 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" | 14 #include "chrome/browser/media/webrtc/media_stream_capture_indicator.h" |
| 14 #include "chrome/browser/themes/theme_properties.h" | 15 #include "chrome/browser/themes/theme_properties.h" |
| 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 16 #include "chrome/browser/usb/usb_tab_helper.h" | 17 #include "chrome/browser/usb/usb_tab_helper.h" |
| 17 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 19 #include "content/public/browser/web_contents.h" | 20 #include "content/public/browser/web_contents.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 21 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/material_design/material_design_controller.h" | 22 #include "ui/base/material_design/material_design_controller.h" |
| 22 #include "ui/base/theme_provider.h" | 23 #include "ui/base/theme_provider.h" |
| 23 #include "ui/gfx/animation/multi_animation.h" | 24 #include "ui/gfx/animation/multi_animation.h" |
| 24 #include "ui/gfx/image/image.h" | 25 #include "ui/gfx/image/image.h" |
| 25 #include "ui/gfx/paint_vector_icon.h" | 26 #include "ui/gfx/paint_vector_icon.h" |
| 26 #include "ui/gfx/vector_icons_public.h" | |
| 27 #include "ui/native_theme/common_theme.h" | 27 #include "ui/native_theme/common_theme.h" |
| 28 #include "ui/native_theme/native_theme.h" | 28 #include "ui/native_theme/native_theme.h" |
| 29 | 29 |
| 30 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
| 31 #include "chrome/grit/theme_resources.h" | 31 #include "chrome/grit/theme_resources.h" |
| 32 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
| 33 #endif | 33 #endif |
| 34 | 34 |
| 35 struct LastMuteMetadata | 35 struct LastMuteMetadata |
| 36 : public content::WebContentsUserData<LastMuteMetadata> { | 36 : public content::WebContentsUserData<LastMuteMetadata> { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 if (contents->IsAudioMuted()) | 170 if (contents->IsAudioMuted()) |
| 171 return TabAlertState::AUDIO_MUTING; | 171 return TabAlertState::AUDIO_MUTING; |
| 172 if (contents->WasRecentlyAudible()) | 172 if (contents->WasRecentlyAudible()) |
| 173 return TabAlertState::AUDIO_PLAYING; | 173 return TabAlertState::AUDIO_PLAYING; |
| 174 | 174 |
| 175 return TabAlertState::NONE; | 175 return TabAlertState::NONE; |
| 176 } | 176 } |
| 177 | 177 |
| 178 gfx::Image GetTabAlertIndicatorImage(TabAlertState alert_state, | 178 gfx::Image GetTabAlertIndicatorImage(TabAlertState alert_state, |
| 179 SkColor button_color) { | 179 SkColor button_color) { |
| 180 gfx::VectorIconId icon_id = gfx::VectorIconId::VECTOR_ICON_NONE; | 180 const gfx::VectorIcon* icon = nullptr; |
| 181 switch (alert_state) { | 181 switch (alert_state) { |
| 182 case TabAlertState::AUDIO_PLAYING: | 182 case TabAlertState::AUDIO_PLAYING: |
| 183 icon_id = gfx::VectorIconId::TAB_AUDIO; | 183 icon = &kTabAudioIcon; |
| 184 break; | 184 break; |
| 185 case TabAlertState::AUDIO_MUTING: | 185 case TabAlertState::AUDIO_MUTING: |
| 186 icon_id = gfx::VectorIconId::TAB_AUDIO_MUTING; | 186 icon = &kTabAudioMutingIcon; |
| 187 break; | 187 break; |
| 188 case TabAlertState::MEDIA_RECORDING: | 188 case TabAlertState::MEDIA_RECORDING: |
| 189 icon_id = gfx::VectorIconId::TAB_MEDIA_RECORDING; | 189 icon = &kTabMediaRecordingIcon; |
| 190 break; | 190 break; |
| 191 case TabAlertState::TAB_CAPTURING: | 191 case TabAlertState::TAB_CAPTURING: |
| 192 icon_id = gfx::VectorIconId::TAB_MEDIA_CAPTURING; | 192 icon = &kTabMediaCapturingIcon; |
| 193 break; | 193 break; |
| 194 case TabAlertState::BLUETOOTH_CONNECTED: | 194 case TabAlertState::BLUETOOTH_CONNECTED: |
| 195 icon_id = gfx::VectorIconId::TAB_BLUETOOTH_CONNECTED; | 195 icon = &kTabBluetoothConnectedIcon; |
| 196 break; | 196 break; |
| 197 case TabAlertState::USB_CONNECTED: | 197 case TabAlertState::USB_CONNECTED: |
| 198 icon_id = gfx::VectorIconId::TAB_USB_CONNECTED; | 198 icon = &kTabUsbConnectedIcon; |
| 199 break; | 199 break; |
| 200 case TabAlertState::NONE: | 200 case TabAlertState::NONE: |
| 201 break; | 201 return gfx::Image(); |
| 202 } | 202 } |
| 203 if (icon_id != gfx::VectorIconId::VECTOR_ICON_NONE) | 203 DCHECK(icon); |
| 204 return gfx::Image(gfx::CreateVectorIcon(icon_id, 16, button_color)); | 204 return gfx::Image(gfx::CreateVectorIcon(*icon, 16, button_color)); |
| 205 | |
| 206 NOTREACHED(); | |
| 207 return gfx::Image(); | |
| 208 } | 205 } |
| 209 | 206 |
| 210 gfx::Image GetTabAlertIndicatorAffordanceImage(TabAlertState alert_state, | 207 gfx::Image GetTabAlertIndicatorAffordanceImage(TabAlertState alert_state, |
| 211 SkColor button_color) { | 208 SkColor button_color) { |
| 212 switch (alert_state) { | 209 switch (alert_state) { |
| 213 case TabAlertState::AUDIO_PLAYING: | 210 case TabAlertState::AUDIO_PLAYING: |
| 214 return GetTabAlertIndicatorImage(TabAlertState::AUDIO_MUTING, | 211 return GetTabAlertIndicatorImage(TabAlertState::AUDIO_MUTING, |
| 215 button_color); | 212 button_color); |
| 216 case TabAlertState::AUDIO_MUTING: | 213 case TabAlertState::AUDIO_MUTING: |
| 217 return GetTabAlertIndicatorImage(TabAlertState::AUDIO_PLAYING, | 214 return GetTabAlertIndicatorImage(TabAlertState::AUDIO_PLAYING, |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 const std::vector<int>& indices) { | 371 const std::vector<int>& indices) { |
| 375 for (std::vector<int>::const_iterator i = indices.begin(); i != indices.end(); | 372 for (std::vector<int>::const_iterator i = indices.begin(); i != indices.end(); |
| 376 ++i) { | 373 ++i) { |
| 377 if (!tab_strip.GetWebContentsAt(*i)->IsAudioMuted()) | 374 if (!tab_strip.GetWebContentsAt(*i)->IsAudioMuted()) |
| 378 return false; | 375 return false; |
| 379 } | 376 } |
| 380 return true; | 377 return true; |
| 381 } | 378 } |
| 382 | 379 |
| 383 } // namespace chrome | 380 } // namespace chrome |
| OLD | NEW |