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

Unified Diff: ash/wm/power_button_controller.cc

Issue 2190773002: Fix Volume slider is captured in screenshot done in touchview mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 4 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 | « ash/wm/power_button_controller.h ('k') | chromeos/audio/cras_audio_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/power_button_controller.cc
diff --git a/ash/wm/power_button_controller.cc b/ash/wm/power_button_controller.cc
index 73c686a403a69604803a88b1728c503c1bbe8d84..b4c5916a3df6cb401d3e48b6d728fe36ac97f1fc 100644
--- a/ash/wm/power_button_controller.cc
+++ b/ash/wm/power_button_controller.cc
@@ -8,6 +8,8 @@
#include "ash/common/ash_switches.h"
#include "ash/common/session/session_state_delegate.h"
#include "ash/common/shell_window_ids.h"
+#include "ash/common/system/audio/tray_audio.h"
+#include "ash/common/system/tray/system_tray.h"
#include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
#include "ash/common/wm_shell.h"
#include "ash/shell.h"
@@ -20,6 +22,7 @@
#include "ui/wm/core/compound_event_filter.h"
#if defined(OS_CHROMEOS)
+#include "chromeos/audio/cras_audio_handler.h"
#include "chromeos/dbus/dbus_thread_manager.h"
#endif
@@ -29,6 +32,9 @@ PowerButtonController::PowerButtonController(LockStateController* controller)
: power_button_down_(false),
lock_button_down_(false),
volume_down_pressed_(false),
+#if defined(OS_CHROMEOS)
+ volume_percent_before_screenshot_(0),
+#endif
brightness_is_zero_(false),
internal_display_off_and_external_display_on_(false),
has_legacy_power_button_(
@@ -80,8 +86,21 @@ void PowerButtonController::OnPowerButtonEvent(
WmShell::Get()
->maximize_mode_controller()
->IsMaximizeModeWindowManagerEnabled()) {
+ SystemTray* system_tray = Shell::GetInstance()->GetPrimarySystemTray();
+ if (system_tray && system_tray->GetTrayAudio())
+ system_tray->GetTrayAudio()->HideDetailedView(false);
+
WmShell::Get()->accelerator_controller()->PerformActionIfEnabled(
TAKE_SCREENSHOT);
+
+#if defined(OS_CHROMEOS)
+ // Restore volume.
+ chromeos::CrasAudioHandler* audio_handler =
+ chromeos::CrasAudioHandler::Get();
+ audio_handler->SetOutputVolumePercentWithoutNotifyingObservers(
+ volume_percent_before_screenshot_,
+ chromeos::CrasAudioHandler::VOLUME_CHANGE_MAXIMIZE_MODE_SCREENSHOT);
+#endif
return;
}
@@ -151,8 +170,17 @@ void PowerButtonController::OnLockButtonEvent(
}
void PowerButtonController::OnKeyEvent(ui::KeyEvent* event) {
- if (event->key_code() == ui::VKEY_VOLUME_DOWN)
+ if (event->key_code() == ui::VKEY_VOLUME_DOWN) {
volume_down_pressed_ = event->type() == ui::ET_KEY_PRESSED;
+#if defined(OS_CHROMEOS)
+ if (!event->is_repeat()) {
+ chromeos::CrasAudioHandler* audio_handler =
+ chromeos::CrasAudioHandler::Get();
+ volume_percent_before_screenshot_ =
+ audio_handler->GetOutputVolumePercent();
+ }
+#endif
+ }
}
#if defined(OS_CHROMEOS)
« no previous file with comments | « ash/wm/power_button_controller.h ('k') | chromeos/audio/cras_audio_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698