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

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

Issue 2483393002: chromeos: Combine TrayAudio and TrayAudioChromeOs classes (Closed)
Patch Set: cleanest diff ever Created 4 years, 1 month 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
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/common/system/audio/volume_view.h" 5 #include "ash/common/system/chromeos/audio/volume_view.h"
6 6
7 #include "ash/common/ash_constants.h" 7 #include "ash/common/ash_constants.h"
8 #include "ash/common/material_design/material_design_controller.h" 8 #include "ash/common/material_design/material_design_controller.h"
9 #include "ash/common/metrics/user_metrics_action.h" 9 #include "ash/common/metrics/user_metrics_action.h"
10 #include "ash/common/system/audio/tray_audio.h" 10 #include "ash/common/system/chromeos/audio/tray_audio_delegate.h"
11 #include "ash/common/system/audio/tray_audio_delegate.h"
12 #include "ash/common/system/tray/system_tray_item.h" 11 #include "ash/common/system/tray/system_tray_item.h"
13 #include "ash/common/system/tray/tray_constants.h" 12 #include "ash/common/system/tray/tray_constants.h"
14 #include "ash/common/system/tray/tray_popup_item_container.h" 13 #include "ash/common/system/tray/tray_popup_item_container.h"
15 #include "ash/common/wm_shell.h" 14 #include "ash/common/wm_shell.h"
16 #include "ash/resources/vector_icons/vector_icons.h" 15 #include "ash/resources/vector_icons/vector_icons.h"
17 #include "grit/ash_resources.h" 16 #include "grit/ash_resources.h"
18 #include "grit/ash_strings.h" 17 #include "grit/ash_strings.h"
19 #include "ui/accessibility/ax_node_data.h" 18 #include "ui/accessibility/ax_node_data.h"
20 #include "ui/base/resource/resource_bundle.h" 19 #include "ui/base/resource/resource_bundle.h"
21 #include "ui/gfx/canvas.h" 20 #include "ui/gfx/canvas.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 return; 231 return;
233 slider_->SetValue(percent); 232 slider_->SetValue(percent);
234 // It is possible that the volume was (un)muted, but the actual volume level 233 // It is possible that the volume was (un)muted, but the actual volume level
235 // did not change. In that case, setting the value of the slider won't 234 // did not change. In that case, setting the value of the slider won't
236 // trigger an update. So explicitly trigger an update. 235 // trigger an update. So explicitly trigger an update.
237 Update(); 236 Update();
238 slider_->set_enable_accessibility_events(true); 237 slider_->set_enable_accessibility_events(true);
239 } 238 }
240 239
241 void VolumeView::UpdateDeviceTypeAndMore() { 240 void VolumeView::UpdateDeviceTypeAndMore() {
242 bool show_more = is_default_view_ && TrayAudio::ShowAudioDeviceMenu() && 241 bool show_more = is_default_view_ && audio_delegate_->HasAlternativeSources();
243 audio_delegate_->HasAlternativeSources();
244 if (!ash::MaterialDesignController::IsSystemTrayMenuMaterial()) { 242 if (!ash::MaterialDesignController::IsSystemTrayMenuMaterial()) {
245 slider_->SetBorder(views::CreateEmptyBorder( 243 slider_->SetBorder(views::CreateEmptyBorder(
246 0, 0, 0, show_more ? kTrayPopupPaddingBetweenItems 244 0, 0, 0, show_more ? kTrayPopupPaddingBetweenItems
247 : kSliderRightPaddingToVolumeViewEdge)); 245 : kSliderRightPaddingToVolumeViewEdge));
248 } 246 }
249 if (!show_more) { 247 if (!show_more) {
250 more_region_->SetVisible(false); 248 more_region_->SetVisible(false);
251 return; 249 return;
252 } 250 }
253 251
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 separator_->SetSize(gfx::Size(kSeparatorSize, bounds().height())); 344 separator_->SetSize(gfx::Size(kSeparatorSize, bounds().height()));
347 } 345 }
348 346
349 void VolumeView::GetAccessibleNodeData(ui::AXNodeData* node_data) { 347 void VolumeView::GetAccessibleNodeData(ui::AXNodeData* node_data) {
350 // Intentionally overrides ActionableView, leaving |state| unset. A slider 348 // Intentionally overrides ActionableView, leaving |state| unset. A slider
351 // childview exposes accessibility data. 349 // childview exposes accessibility data.
352 } 350 }
353 351
354 } // namespace tray 352 } // namespace tray
355 } // namespace ash 353 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698