OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/system/audio/volume_view.h" | 5 #include "ash/system/audio/volume_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/metrics/user_metrics_action.h" | 9 #include "ash/metrics/user_metrics_action.h" |
10 #include "ash/resources/vector_icons/vector_icons.h" | 10 #include "ash/resources/vector_icons/vector_icons.h" |
11 #include "ash/shell_port.h" | 11 #include "ash/shell_port.h" |
12 #include "ash/strings/grit/ash_strings.h" | 12 #include "ash/strings/grit/ash_strings.h" |
13 #include "ash/system/tray/actionable_view.h" | 13 #include "ash/system/tray/actionable_view.h" |
14 #include "ash/system/tray/system_tray_item.h" | 14 #include "ash/system/tray/system_tray_item.h" |
15 #include "ash/system/tray/tray_constants.h" | 15 #include "ash/system/tray/tray_constants.h" |
16 #include "ash/system/tray/tray_popup_utils.h" | 16 #include "ash/system/tray/tray_popup_utils.h" |
17 #include "ash/system/tray/tri_view.h" | 17 #include "ash/system/tray/tri_view.h" |
18 #include "chromeos/audio/cras_audio_handler.h" | 18 #include "chromeos/audio/cras_audio_handler.h" |
19 #include "ui/accessibility/ax_node_data.h" | 19 #include "ui/accessibility/ax_node_data.h" |
20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
21 #include "ui/gfx/paint_vector_icon.h" | 21 #include "ui/gfx/paint_vector_icon.h" |
22 #include "ui/gfx/vector_icon_types.h" | 22 #include "ui/gfx/vector_icon_types.h" |
23 #include "ui/views/background.h" | 23 #include "ui/views/background.h" |
24 #include "ui/views/border.h" | 24 #include "ui/views/border.h" |
25 #include "ui/views/controls/button/custom_button.h" | 25 #include "ui/views/controls/button/custom_button.h" |
26 #include "ui/views/controls/image_view.h" | 26 #include "ui/views/controls/image_view.h" |
27 #include "ui/views/controls/slider.h" | 27 #include "ui/views/controls/slider.h" |
28 #include "ui/views/layout/fill_layout.h" | 28 #include "ui/views/layout/fill_layout.h" |
tdanderson
2017/04/18 19:14:45
#include native_theme.h here? Ditto for other file
Evan Stade
2017/04/19 15:59:01
Done.
| |
29 | 29 |
30 using chromeos::CrasAudioHandler; | 30 using chromeos::CrasAudioHandler; |
31 | 31 |
32 namespace ash { | 32 namespace ash { |
33 namespace { | 33 namespace { |
34 | 34 |
35 const gfx::VectorIcon* const kVolumeLevelIcons[] = { | 35 const gfx::VectorIcon* const kVolumeLevelIcons[] = { |
36 &kSystemMenuVolumeMuteIcon, // Muted. | 36 &kSystemMenuVolumeMuteIcon, // Muted. |
37 &kSystemMenuVolumeLowIcon, // Low volume. | 37 &kSystemMenuVolumeLowIcon, // Low volume. |
38 &kSystemMenuVolumeMediumIcon, // Medium volume. | 38 &kSystemMenuVolumeMediumIcon, // Medium volume. |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
123 | 123 |
124 icon_ = new VolumeButton(owner, this); | 124 icon_ = new VolumeButton(owner, this); |
125 tri_view_->AddView(TriView::Container::START, icon_); | 125 tri_view_->AddView(TriView::Container::START, icon_); |
126 | 126 |
127 slider_ = TrayPopupUtils::CreateSlider(this); | 127 slider_ = TrayPopupUtils::CreateSlider(this); |
128 slider_->SetValue(CrasAudioHandler::Get()->GetOutputVolumePercent() / 100.0f); | 128 slider_->SetValue(CrasAudioHandler::Get()->GetOutputVolumePercent() / 100.0f); |
129 slider_->SetAccessibleName( | 129 slider_->SetAccessibleName( |
130 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_VOLUME)); | 130 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_VOLUME)); |
131 tri_view_->AddView(TriView::Container::CENTER, slider_); | 131 tri_view_->AddView(TriView::Container::CENTER, slider_); |
132 | 132 |
133 set_background(views::Background::CreateSolidBackground(kBackgroundColor)); | 133 set_background(views::Background::CreateThemedSolidBackground( |
134 this, ui::NativeTheme::kColorId_BubbleBackground)); | |
134 | 135 |
135 if (!is_default_view_) { | 136 if (!is_default_view_) { |
136 tri_view_->SetContainerVisible(TriView::Container::END, false); | 137 tri_view_->SetContainerVisible(TriView::Container::END, false); |
137 Update(); | 138 Update(); |
138 return; | 139 return; |
139 } | 140 } |
140 | 141 |
141 more_button_ = new ButtonListenerActionableView( | 142 more_button_ = new ButtonListenerActionableView( |
142 owner_, TrayPopupInkDropStyle::INSET_BOUNDS, this); | 143 owner_, TrayPopupInkDropStyle::INSET_BOUNDS, this); |
143 TrayPopupUtils::ConfigureContainer(TriView::Container::END, more_button_); | 144 TrayPopupUtils::ConfigureContainer(TriView::Container::END, more_button_); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
254 if (new_volume > current_volume) | 255 if (new_volume > current_volume) |
255 HandleVolumeUp(new_volume); | 256 HandleVolumeUp(new_volume); |
256 else | 257 else |
257 HandleVolumeDown(new_volume); | 258 HandleVolumeDown(new_volume); |
258 } | 259 } |
259 icon_->Update(); | 260 icon_->Update(); |
260 } | 261 } |
261 | 262 |
262 } // namespace tray | 263 } // namespace tray |
263 } // namespace ash | 264 } // namespace ash |
OLD | NEW |