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

Unified Diff: ash/common/system/chromeos/audio/volume_view.cc

Issue 2671593003: Re-layout Chrome OS audio row when headphone connected (Closed)
Patch Set: Update visibility iff necessary Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/system/chromeos/audio/volume_view.cc
diff --git a/ash/common/system/chromeos/audio/volume_view.cc b/ash/common/system/chromeos/audio/volume_view.cc
index 30ed63db42e22d847cd746d9be5621ad1f6d2cff..e12511c56c09decb3ced08eff2b3890c42e1f5ba 100644
--- a/ash/common/system/chromeos/audio/volume_view.cc
+++ b/ash/common/system/chromeos/audio/volume_view.cc
@@ -256,15 +256,14 @@ void VolumeView::UpdateDeviceTypeAndMore() {
if (!show_more)
return;
- // Show output device icon if necessary.
- device_type_->SetVisible(false);
+ bool target_visibility = false;
if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
const gfx::VectorIcon& device_icon =
audio_delegate_->GetActiveOutputDeviceVectorIcon();
if (!device_icon.is_empty()) {
device_type_->SetImage(
gfx::CreateVectorIcon(device_icon, kMenuIconColor));
- device_type_->SetVisible(true);
+ target_visibility = true;
}
} else {
int device_icon = audio_delegate_->GetActiveOutputDeviceIconId();
@@ -272,9 +271,13 @@ void VolumeView::UpdateDeviceTypeAndMore() {
device_type_->SetImage(ui::ResourceBundle::GetSharedInstance()
.GetImageNamed(device_icon)
.ToImageSkia());
- device_type_->SetVisible(true);
+ target_visibility = true;
}
}
+ if (device_type_->visible() != target_visibility) {
+ device_type_->SetVisible(target_visibility);
+ device_type_->InvalidateLayout();
+ }
}
void VolumeView::HandleVolumeUp(int level) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698