| 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/browser/media/media_capture_devices_dispatcher.h" | 12 #include "chrome/browser/media/media_capture_devices_dispatcher.h" |
| 13 #include "chrome/browser/media/media_stream_capture_indicator.h" | 13 #include "chrome/browser/media/media_stream_capture_indicator.h" |
| 14 #include "chrome/browser/themes/theme_properties.h" | 14 #include "chrome/browser/themes/theme_properties.h" |
| 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 16 #include "chrome/browser/usb/usb_tab_helper.h" | 16 #include "chrome/browser/usb/usb_tab_helper.h" |
| 17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
| 19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/material_design/material_design_controller.h" |
| 21 #include "ui/base/theme_provider.h" | 22 #include "ui/base/theme_provider.h" |
| 22 #include "ui/gfx/animation/multi_animation.h" | 23 #include "ui/gfx/animation/multi_animation.h" |
| 23 #include "ui/gfx/image/image.h" | 24 #include "ui/gfx/image/image.h" |
| 25 #include "ui/gfx/paint_vector_icon.h" |
| 24 #include "ui/gfx/vector_icons_public.h" | 26 #include "ui/gfx/vector_icons_public.h" |
| 25 #include "ui/native_theme/common_theme.h" | 27 #include "ui/native_theme/common_theme.h" |
| 26 #include "ui/native_theme/native_theme.h" | 28 #include "ui/native_theme/native_theme.h" |
| 27 | 29 |
| 28 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
| 29 #include "grit/theme_resources.h" | 31 #include "grit/theme_resources.h" |
| 30 #include "ui/base/resource/resource_bundle.h" | 32 #include "ui/base/resource/resource_bundle.h" |
| 31 #else | 33 #else |
| 32 #include "ui/gfx/paint_vector_icon.h" | 34 #include "ui/gfx/paint_vector_icon.h" |
| 33 #endif | 35 #endif |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 return TabAlertState::AUDIO_MUTING; | 173 return TabAlertState::AUDIO_MUTING; |
| 172 if (contents->WasRecentlyAudible()) | 174 if (contents->WasRecentlyAudible()) |
| 173 return TabAlertState::AUDIO_PLAYING; | 175 return TabAlertState::AUDIO_PLAYING; |
| 174 | 176 |
| 175 return TabAlertState::NONE; | 177 return TabAlertState::NONE; |
| 176 } | 178 } |
| 177 | 179 |
| 178 gfx::Image GetTabAlertIndicatorImage(TabAlertState alert_state, | 180 gfx::Image GetTabAlertIndicatorImage(TabAlertState alert_state, |
| 179 SkColor button_color) { | 181 SkColor button_color) { |
| 180 #if defined(OS_MACOSX) | 182 #if defined(OS_MACOSX) |
| 181 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); | 183 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 182 switch (alert_state) { | 184 ui::ResourceBundle* rb = &ui::ResourceBundle::GetSharedInstance(); |
| 183 case TabAlertState::AUDIO_PLAYING: | 185 switch (alert_state) { |
| 184 return rb->GetNativeImageNamed(IDR_TAB_AUDIO_INDICATOR); | 186 case TabAlertState::AUDIO_PLAYING: |
| 185 case TabAlertState::AUDIO_MUTING: | 187 return rb->GetNativeImageNamed(IDR_TAB_AUDIO_INDICATOR); |
| 186 return rb->GetNativeImageNamed(IDR_TAB_AUDIO_MUTING_INDICATOR); | 188 case TabAlertState::AUDIO_MUTING: |
| 187 case TabAlertState::MEDIA_RECORDING: | 189 return rb->GetNativeImageNamed(IDR_TAB_AUDIO_MUTING_INDICATOR); |
| 188 return rb->GetNativeImageNamed(IDR_TAB_RECORDING_INDICATOR); | 190 case TabAlertState::MEDIA_RECORDING: |
| 189 case TabAlertState::TAB_CAPTURING: | 191 return rb->GetNativeImageNamed(IDR_TAB_RECORDING_INDICATOR); |
| 190 return rb->GetNativeImageNamed(IDR_TAB_CAPTURE_INDICATOR); | 192 case TabAlertState::TAB_CAPTURING: |
| 191 case TabAlertState::BLUETOOTH_CONNECTED: | 193 return rb->GetNativeImageNamed(IDR_TAB_CAPTURE_INDICATOR); |
| 192 return rb->GetNativeImageNamed(IDR_TAB_BLUETOOTH_INDICATOR); | 194 case TabAlertState::BLUETOOTH_CONNECTED: |
| 193 case TabAlertState::USB_CONNECTED: | 195 return rb->GetNativeImageNamed(IDR_TAB_BLUETOOTH_INDICATOR); |
| 194 return rb->GetNativeImageNamed(IDR_TAB_USB_INDICATOR); | 196 case TabAlertState::USB_CONNECTED: |
| 195 case TabAlertState::NONE: | 197 return rb->GetNativeImageNamed(IDR_TAB_USB_INDICATOR); |
| 196 break; | 198 case TabAlertState::NONE: |
| 199 break; |
| 200 } |
| 201 NOTREACHED(); |
| 202 return gfx::Image(); |
| 197 } | 203 } |
| 198 #else | 204 #endif |
| 205 |
| 199 gfx::VectorIconId icon_id = gfx::VectorIconId::VECTOR_ICON_NONE; | 206 gfx::VectorIconId icon_id = gfx::VectorIconId::VECTOR_ICON_NONE; |
| 200 switch (alert_state) { | 207 switch (alert_state) { |
| 201 case TabAlertState::AUDIO_PLAYING: | 208 case TabAlertState::AUDIO_PLAYING: |
| 202 icon_id = gfx::VectorIconId::TAB_AUDIO; | 209 icon_id = gfx::VectorIconId::TAB_AUDIO; |
| 203 break; | 210 break; |
| 204 case TabAlertState::AUDIO_MUTING: | 211 case TabAlertState::AUDIO_MUTING: |
| 205 icon_id = gfx::VectorIconId::TAB_AUDIO_MUTING; | 212 icon_id = gfx::VectorIconId::TAB_AUDIO_MUTING; |
| 206 break; | 213 break; |
| 207 case TabAlertState::MEDIA_RECORDING: | 214 case TabAlertState::MEDIA_RECORDING: |
| 208 icon_id = gfx::VectorIconId::TAB_MEDIA_RECORDING; | 215 icon_id = gfx::VectorIconId::TAB_MEDIA_RECORDING; |
| 209 break; | 216 break; |
| 210 case TabAlertState::TAB_CAPTURING: | 217 case TabAlertState::TAB_CAPTURING: |
| 211 icon_id = gfx::VectorIconId::TAB_MEDIA_CAPTURING; | 218 icon_id = gfx::VectorIconId::TAB_MEDIA_CAPTURING; |
| 212 break; | 219 break; |
| 213 case TabAlertState::BLUETOOTH_CONNECTED: | 220 case TabAlertState::BLUETOOTH_CONNECTED: |
| 214 icon_id = gfx::VectorIconId::TAB_BLUETOOTH_CONNECTED; | 221 icon_id = gfx::VectorIconId::TAB_BLUETOOTH_CONNECTED; |
| 215 break; | 222 break; |
| 216 case TabAlertState::USB_CONNECTED: | 223 case TabAlertState::USB_CONNECTED: |
| 217 icon_id = gfx::VectorIconId::TAB_USB_CONNECTED; | 224 icon_id = gfx::VectorIconId::TAB_USB_CONNECTED; |
| 218 break; | 225 break; |
| 219 case TabAlertState::NONE: | 226 case TabAlertState::NONE: |
| 220 break; | 227 break; |
| 221 } | 228 } |
| 222 if (icon_id != gfx::VectorIconId::VECTOR_ICON_NONE) | 229 if (icon_id != gfx::VectorIconId::VECTOR_ICON_NONE) |
| 223 return gfx::Image(gfx::CreateVectorIcon(icon_id, 16, button_color)); | 230 return gfx::Image(gfx::CreateVectorIcon(icon_id, 16, button_color)); |
| 224 #endif | 231 |
| 225 NOTREACHED(); | 232 NOTREACHED(); |
| 226 return gfx::Image(); | 233 return gfx::Image(); |
| 227 } | 234 } |
| 228 | 235 |
| 229 gfx::Image GetTabAlertIndicatorAffordanceImage(TabAlertState alert_state, | 236 gfx::Image GetTabAlertIndicatorAffordanceImage(TabAlertState alert_state, |
| 230 SkColor button_color) { | 237 SkColor button_color) { |
| 231 switch (alert_state) { | 238 switch (alert_state) { |
| 232 case TabAlertState::AUDIO_PLAYING: | 239 case TabAlertState::AUDIO_PLAYING: |
| 233 return GetTabAlertIndicatorImage(TabAlertState::AUDIO_MUTING, | 240 return GetTabAlertIndicatorImage(TabAlertState::AUDIO_MUTING, |
| 234 button_color); | 241 button_color); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 const std::vector<int>& indices) { | 398 const std::vector<int>& indices) { |
| 392 for (std::vector<int>::const_iterator i = indices.begin(); i != indices.end(); | 399 for (std::vector<int>::const_iterator i = indices.begin(); i != indices.end(); |
| 393 ++i) { | 400 ++i) { |
| 394 if (!tab_strip.GetWebContentsAt(*i)->IsAudioMuted()) | 401 if (!tab_strip.GetWebContentsAt(*i)->IsAudioMuted()) |
| 395 return false; | 402 return false; |
| 396 } | 403 } |
| 397 return true; | 404 return true; |
| 398 } | 405 } |
| 399 | 406 |
| 400 } // namespace chrome | 407 } // namespace chrome |
| OLD | NEW |