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

Side by Side Diff: ash/system/chromeos/power/tablet_power_button_controller.cc

Issue 2507733004: Send screen on and off state as a11y alert (Closed)
Patch Set: alert when SetBacklightsForcedOff Created 4 years 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/accessibility_types.h ('k') | chrome/app/generated_resources.grd » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chromeos/power/tablet_power_button_controller.h" 5 #include "ash/system/chromeos/power/tablet_power_button_controller.h"
6 6
7 #include "ash/common/accessibility_delegate.h"
7 #include "ash/common/session/session_state_delegate.h" 8 #include "ash/common/session/session_state_delegate.h"
8 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 9 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
9 #include "ash/common/wm_shell.h" 10 #include "ash/common/wm_shell.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "ash/wm/lock_state_controller.h" 12 #include "ash/wm/lock_state_controller.h"
12 #include "base/time/default_tick_clock.h" 13 #include "base/time/default_tick_clock.h"
13 #include "chromeos/dbus/dbus_thread_manager.h" 14 #include "chromeos/dbus/dbus_thread_manager.h"
14 #include "ui/events/devices/input_device_manager.h" 15 #include "ui/events/devices/input_device_manager.h"
15 #include "ui/events/devices/stylus_state.h" 16 #include "ui/events/devices/stylus_state.h"
16 #include "ui/events/event.h" 17 #include "ui/events/event.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 169 }
169 170
170 void TabletPowerButtonController::SetBacklightsForcedOff(bool forced_off) { 171 void TabletPowerButtonController::SetBacklightsForcedOff(bool forced_off) {
171 if (backlights_forced_off_ == forced_off) 172 if (backlights_forced_off_ == forced_off)
172 return; 173 return;
173 174
174 chromeos::DBusThreadManager::Get() 175 chromeos::DBusThreadManager::Get()
175 ->GetPowerManagerClient() 176 ->GetPowerManagerClient()
176 ->SetBacklightsForcedOff(forced_off); 177 ->SetBacklightsForcedOff(forced_off);
177 backlights_forced_off_ = forced_off; 178 backlights_forced_off_ = forced_off;
179
180 // Send an a11y alert.
181 WmShell::Get()->accessibility_delegate()->TriggerAccessibilityAlert(
182 forced_off ? A11Y_ALERT_SCREEN_OFF : A11Y_ALERT_SCREEN_ON);
178 } 183 }
179 184
180 void TabletPowerButtonController::GetInitialBacklightsForcedOff() { 185 void TabletPowerButtonController::GetInitialBacklightsForcedOff() {
181 chromeos::DBusThreadManager::Get() 186 chromeos::DBusThreadManager::Get()
182 ->GetPowerManagerClient() 187 ->GetPowerManagerClient()
183 ->GetBacklightsForcedOff(base::Bind( 188 ->GetBacklightsForcedOff(base::Bind(
184 &TabletPowerButtonController::OnGotInitialBacklightsForcedOff, 189 &TabletPowerButtonController::OnGotInitialBacklightsForcedOff,
185 weak_ptr_factory_.GetWeakPtr())); 190 weak_ptr_factory_.GetWeakPtr()));
186 } 191 }
187 192
(...skipping 17 matching lines...) Expand all
205 WmShell::Get()->GetSessionStateDelegate(); 210 WmShell::Get()->GetSessionStateDelegate();
206 if (session_state_delegate->ShouldLockScreenAutomatically() && 211 if (session_state_delegate->ShouldLockScreenAutomatically() &&
207 session_state_delegate->CanLockScreen() && 212 session_state_delegate->CanLockScreen() &&
208 !session_state_delegate->IsUserSessionBlocked() && 213 !session_state_delegate->IsUserSessionBlocked() &&
209 !controller_->LockRequested()) { 214 !controller_->LockRequested()) {
210 session_state_delegate->LockScreen(); 215 session_state_delegate->LockScreen();
211 } 216 }
212 } 217 }
213 218
214 } // namespace ash 219 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/accessibility_types.h ('k') | chrome/app/generated_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698