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

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

Issue 2483393002: chromeos: Combine TrayAudio and TrayAudioChromeOs classes (Closed)
Patch Set: rebase 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
« no previous file with comments | « ash/common/system/chromeos/audio/volume_view.h ('k') | ash/common/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/common/system/chromeos/audio/volume_view.h"
6
5 #include <algorithm> 7 #include <algorithm>
6 8
7 #include "ash/common/system/audio/volume_view.h"
8
9 #include "ash/common/material_design/material_design_controller.h" 9 #include "ash/common/material_design/material_design_controller.h"
10 #include "ash/common/metrics/user_metrics_action.h" 10 #include "ash/common/metrics/user_metrics_action.h"
11 #include "ash/common/system/audio/tray_audio.h" 11 #include "ash/common/system/chromeos/audio/tray_audio_delegate.h"
12 #include "ash/common/system/audio/tray_audio_delegate.h"
13 #include "ash/common/system/tray/actionable_view.h" 12 #include "ash/common/system/tray/actionable_view.h"
14 #include "ash/common/system/tray/system_tray_item.h" 13 #include "ash/common/system/tray/system_tray_item.h"
15 #include "ash/common/system/tray/tray_constants.h" 14 #include "ash/common/system/tray/tray_constants.h"
16 #include "ash/common/system/tray/tray_popup_item_container.h" 15 #include "ash/common/system/tray/tray_popup_item_container.h"
17 #include "ash/common/system/tray/tray_popup_utils.h" 16 #include "ash/common/system/tray/tray_popup_utils.h"
18 #include "ash/common/system/tray/tri_view.h" 17 #include "ash/common/system/tray/tri_view.h"
19 #include "ash/common/wm_shell.h" 18 #include "ash/common/wm_shell.h"
20 #include "ash/resources/vector_icons/vector_icons.h" 19 #include "ash/resources/vector_icons/vector_icons.h"
21 #include "grit/ash_resources.h" 20 #include "grit/ash_resources.h"
22 #include "grit/ash_strings.h" 21 #include "grit/ash_strings.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 return; 235 return;
237 slider_->SetValue(percent); 236 slider_->SetValue(percent);
238 // It is possible that the volume was (un)muted, but the actual volume level 237 // It is possible that the volume was (un)muted, but the actual volume level
239 // did not change. In that case, setting the value of the slider won't 238 // did not change. In that case, setting the value of the slider won't
240 // trigger an update. So explicitly trigger an update. 239 // trigger an update. So explicitly trigger an update.
241 Update(); 240 Update();
242 slider_->set_enable_accessibility_events(true); 241 slider_->set_enable_accessibility_events(true);
243 } 242 }
244 243
245 void VolumeView::UpdateDeviceTypeAndMore() { 244 void VolumeView::UpdateDeviceTypeAndMore() {
246 bool show_more = is_default_view_ && TrayAudio::ShowAudioDeviceMenu() && 245 bool show_more = is_default_view_ && audio_delegate_->HasAlternativeSources();
247 audio_delegate_->HasAlternativeSources();
248 246
249 if (!show_more) 247 if (!show_more)
250 return; 248 return;
251 249
252 // Show output device icon if necessary. 250 // Show output device icon if necessary.
253 device_type_->SetVisible(false); 251 device_type_->SetVisible(false);
254 if (MaterialDesignController::IsSystemTrayMenuMaterial()) { 252 if (MaterialDesignController::IsSystemTrayMenuMaterial()) {
255 const gfx::VectorIcon& device_icon = 253 const gfx::VectorIcon& device_icon =
256 audio_delegate_->GetActiveOutputDeviceVectorIcon(); 254 audio_delegate_->GetActiveOutputDeviceVectorIcon();
257 if (!device_icon.is_empty()) { 255 if (!device_icon.is_empty()) {
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 void VolumeView::OnBoundsChanged(const gfx::Rect& previous_bounds) { 336 void VolumeView::OnBoundsChanged(const gfx::Rect& previous_bounds) {
339 // Separator's prefered size is based on set bounds. When an empty bounds is 337 // Separator's prefered size is based on set bounds. When an empty bounds is
340 // set on first layout this causes BoxLayout to ignore the separator. Reset 338 // set on first layout this causes BoxLayout to ignore the separator. Reset
341 // its height on each bounds change so that it is laid out properly. 339 // its height on each bounds change so that it is laid out properly.
342 if (separator_) 340 if (separator_)
343 separator_->SetSize(gfx::Size(kSeparatorSize, bounds().height())); 341 separator_->SetSize(gfx::Size(kSeparatorSize, bounds().height()));
344 } 342 }
345 343
346 } // namespace tray 344 } // namespace tray
347 } // namespace ash 345 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/audio/volume_view.h ('k') | ash/common/system/tray/system_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698