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

Unified Diff: ash/wm/power_button_controller.cc

Issue 326813004: Added quick lock mechanism while in Touchview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reverted immediate lock on power button press. Created 6 years, 6 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
« ash/wm/power_button_controller.h ('K') | « ash/wm/power_button_controller.h ('k') | no next file » | 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 6e96c651dc5ba2ea47d4f44015dd3d9b3559fe74..ffce5573adc026d4a906d1992d8d358c7872d457 100644
--- a/ash/wm/power_button_controller.cc
+++ b/ash/wm/power_button_controller.cc
@@ -13,6 +13,7 @@
#include "base/command_line.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/display/types/chromeos/display_snapshot.h"
+#include "ui/events/event_handler.h"
#include "ui/wm/core/compound_event_filter.h"
namespace ash {
@@ -21,6 +22,7 @@ PowerButtonController::PowerButtonController(
LockStateController* controller)
: power_button_down_(false),
lock_button_down_(false),
+ volume_down_pressed_(false),
brightness_is_zero_(false),
internal_display_off_and_external_display_on_(false),
has_legacy_power_button_(
@@ -29,12 +31,14 @@ PowerButtonController::PowerButtonController(
controller_(controller) {
#if defined(OS_CHROMEOS)
Shell::GetInstance()->display_configurator()->AddObserver(this);
+ Shell::GetInstance()->PrependPreTargetHandler(this);
#endif
}
PowerButtonController::~PowerButtonController() {
#if defined(OS_CHROMEOS)
Shell::GetInstance()->display_configurator()->RemoveObserver(this);
+ Shell::GetInstance()->RemovePreTargetHandler(this);
#endif
}
@@ -55,6 +59,12 @@ void PowerButtonController::OnPowerButtonEvent(
if (brightness_is_zero_ && !internal_display_off_and_external_display_on_)
return;
+ if (volume_down_pressed_ && down) {
+ Shell::GetInstance()->accelerator_controller()->PerformAction(
+ ash::TAKE_SCREENSHOT, ui::Accelerator());
+ return;
+ }
+
const SessionStateDelegate* session_state_delegate =
Shell::GetInstance()->session_state_delegate();
if (has_legacy_power_button_) {
@@ -116,6 +126,13 @@ void PowerButtonController::OnLockButtonEvent(
controller_->CancelLockAnimation();
}
+void PowerButtonController::OnKeyEvent(ui::KeyEvent* event) {
+ if (event->key_code() == ui::VKEY_VOLUME_DOWN) {
+ volume_down_pressed_ = event->type() == ui::ET_KEY_PRESSED ||
+ event->type() == ui::ET_TRANSLATED_KEY_PRESS;
+ }
+}
+
#if defined(OS_CHROMEOS)
void PowerButtonController::OnDisplayModeChanged(
const ui::DisplayConfigurator::DisplayStateList& display_states) {
« ash/wm/power_button_controller.h ('K') | « ash/wm/power_button_controller.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698