Chromium Code Reviews| 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/tray_audio.h" | 5 #include "ash/system/audio/tray_audio.h" |
| 6 | 6 |
| 7 #include "ash/resources/vector_icons/vector_icons.h" | 7 #include "ash/resources/vector_icons/vector_icons.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shell.h" | |
| 9 #include "ash/shell_port.h" | 10 #include "ash/shell_port.h" |
| 10 #include "ash/system/audio/audio_detailed_view.h" | 11 #include "ash/system/audio/audio_detailed_view.h" |
| 11 #include "ash/system/audio/volume_view.h" | 12 #include "ash/system/audio/volume_view.h" |
| 12 #include "ash/system/tray/system_tray.h" | 13 #include "ash/system/tray/system_tray.h" |
| 13 #include "ash/system/tray/tray_constants.h" | 14 #include "ash/system/tray/tray_constants.h" |
| 14 #include "ash/wm_window.h" | |
| 15 #include "chromeos/dbus/dbus_thread_manager.h" | 15 #include "chromeos/dbus/dbus_thread_manager.h" |
| 16 #include "ui/display/display.h" | 16 #include "ui/display/display.h" |
| 17 #include "ui/display/manager/managed_display_info.h" | 17 #include "ui/display/manager/managed_display_info.h" |
| 18 #include "ui/display/screen.h" | 18 #include "ui/display/screen.h" |
| 19 #include "ui/views/view.h" | 19 #include "ui/views/view.h" |
| 20 | 20 |
| 21 namespace ash { | 21 namespace ash { |
| 22 | 22 |
| 23 using chromeos::CrasAudioHandler; | 23 using chromeos::CrasAudioHandler; |
| 24 using chromeos::DBusThreadManager; | 24 using chromeos::DBusThreadManager; |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 37 TrayAudio::~TrayAudio() { | 37 TrayAudio::~TrayAudio() { |
| 38 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); | 38 DBusThreadManager::Get()->GetPowerManagerClient()->RemoveObserver(this); |
| 39 display::Screen::GetScreen()->RemoveObserver(this); | 39 display::Screen::GetScreen()->RemoveObserver(this); |
| 40 if (CrasAudioHandler::IsInitialized()) | 40 if (CrasAudioHandler::IsInitialized()) |
| 41 CrasAudioHandler::Get()->RemoveAudioObserver(this); | 41 CrasAudioHandler::Get()->RemoveAudioObserver(this); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // static | 44 // static |
| 45 void TrayAudio::ShowPopUpVolumeView() { | 45 void TrayAudio::ShowPopUpVolumeView() { |
| 46 // Show the popup on all monitors with a system tray. | 46 // Show the popup on all monitors with a system tray. |
| 47 for (WmWindow* root : ShellPort::Get()->GetAllRootWindows()) { | 47 for (RootWindowController* root : Shell::GetAllRootWindowControllers()) { |
|
James Cook
2017/05/16 22:44:44
Do we prefer this, RootWindowController::root_wind
sky
2017/05/17 16:12:40
I would like to move to where ShellPort usage is v
| |
| 48 SystemTray* system_tray = root->GetRootWindowController()->GetSystemTray(); | 48 SystemTray* system_tray = root->GetSystemTray(); |
| 49 if (!system_tray) | 49 if (!system_tray) |
| 50 continue; | 50 continue; |
| 51 // Show the popup by simulating a volume change. The provided node id and | 51 // Show the popup by simulating a volume change. The provided node id and |
| 52 // volume value are ignored. | 52 // volume value are ignored. |
| 53 system_tray->GetTrayAudio()->OnOutputNodeVolumeChanged(0, 0); | 53 system_tray->GetTrayAudio()->OnOutputNodeVolumeChanged(0, 0); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 bool TrayAudio::GetInitialVisibility() { | 57 bool TrayAudio::GetInitialVisibility() { |
| 58 return CrasAudioHandler::Get()->IsOutputMuted(); | 58 return CrasAudioHandler::Get()->IsOutputMuted(); |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 194 volume_view_->SetVolumeLevel( | 194 volume_view_->SetVolumeLevel( |
| 195 CrasAudioHandler::Get()->GetOutputVolumePercent() / 100.0f); | 195 CrasAudioHandler::Get()->GetOutputVolumePercent() / 100.0f); |
| 196 volume_view_->Update(); | 196 volume_view_->Update(); |
| 197 } | 197 } |
| 198 | 198 |
| 199 if (audio_detail_view_) | 199 if (audio_detail_view_) |
| 200 audio_detail_view_->Update(); | 200 audio_detail_view_->Update(); |
| 201 } | 201 } |
| 202 | 202 |
| 203 } // namespace ash | 203 } // namespace ash |
| OLD | NEW |