Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: ash/system/audio/volume_view.cc

Issue 2835233005: Revert of Introduce a type of View background that stays in sync with its host (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | ash/system/tray/system_tray.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/native_theme/native_theme.h"
24 #include "ui/views/background.h" 23 #include "ui/views/background.h"
25 #include "ui/views/border.h" 24 #include "ui/views/border.h"
26 #include "ui/views/controls/button/custom_button.h" 25 #include "ui/views/controls/button/custom_button.h"
27 #include "ui/views/controls/image_view.h" 26 #include "ui/views/controls/image_view.h"
28 #include "ui/views/controls/slider.h" 27 #include "ui/views/controls/slider.h"
29 #include "ui/views/layout/fill_layout.h" 28 #include "ui/views/layout/fill_layout.h"
30 29
31 using chromeos::CrasAudioHandler; 30 using chromeos::CrasAudioHandler;
32 31
33 namespace ash { 32 namespace ash {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 123
125 icon_ = new VolumeButton(owner, this); 124 icon_ = new VolumeButton(owner, this);
126 tri_view_->AddView(TriView::Container::START, icon_); 125 tri_view_->AddView(TriView::Container::START, icon_);
127 126
128 slider_ = TrayPopupUtils::CreateSlider(this); 127 slider_ = TrayPopupUtils::CreateSlider(this);
129 slider_->SetValue(CrasAudioHandler::Get()->GetOutputVolumePercent() / 100.0f); 128 slider_->SetValue(CrasAudioHandler::Get()->GetOutputVolumePercent() / 100.0f);
130 slider_->SetAccessibleName( 129 slider_->SetAccessibleName(
131 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_VOLUME)); 130 l10n_util::GetStringUTF16(IDS_ASH_STATUS_TRAY_VOLUME));
132 tri_view_->AddView(TriView::Container::CENTER, slider_); 131 tri_view_->AddView(TriView::Container::CENTER, slider_);
133 132
134 set_background(views::Background::CreateThemedSolidBackground( 133 set_background(views::Background::CreateSolidBackground(kBackgroundColor));
135 this, ui::NativeTheme::kColorId_BubbleBackground));
136
137 Update(); 134 Update();
138 } 135 }
139 136
140 VolumeView::~VolumeView() {} 137 VolumeView::~VolumeView() {}
141 138
142 void VolumeView::Update() { 139 void VolumeView::Update() {
143 icon_->Update(); 140 icon_->Update();
144 slider_->UpdateState(!CrasAudioHandler::Get()->IsOutputMuted()); 141 slider_->UpdateState(!CrasAudioHandler::Get()->IsOutputMuted());
145 UpdateDeviceTypeAndMore(); 142 UpdateDeviceTypeAndMore();
146 Layout(); 143 Layout();
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 if (new_volume > current_volume) 271 if (new_volume > current_volume)
275 HandleVolumeUp(new_volume); 272 HandleVolumeUp(new_volume);
276 else 273 else
277 HandleVolumeDown(new_volume); 274 HandleVolumeDown(new_volume);
278 } 275 }
279 icon_->Update(); 276 icon_->Update();
280 } 277 }
281 278
282 } // namespace tray 279 } // namespace tray
283 } // namespace ash 280 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698