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

Side by Side Diff: ash/accelerators/accelerator_controller_delegate_aura.cc

Issue 2689143002: ash: Remove OS_CHROMEOS ifdefs from accelerator files (Closed)
Patch Set: rebase Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | ash/accelerators/accelerator_filter_unittest.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 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/accelerators/accelerator_controller_delegate_aura.h" 5 #include "ash/accelerators/accelerator_controller_delegate_aura.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "ash/accelerators/accelerator_commands_aura.h" 12 #include "ash/accelerators/accelerator_commands_aura.h"
13 #include "ash/common/accelerators/debug_commands.h" 13 #include "ash/common/accelerators/debug_commands.h"
14 #include "ash/common/accessibility_types.h" 14 #include "ash/common/accessibility_types.h"
15 #include "ash/common/session/session_state_delegate.h" 15 #include "ash/common/session/session_state_delegate.h"
16 #include "ash/common/shelf/wm_shelf.h" 16 #include "ash/common/shelf/wm_shelf.h"
17 #include "ash/common/shell_delegate.h" 17 #include "ash/common/shell_delegate.h"
18 #include "ash/common/system/system_notifier.h" 18 #include "ash/common/system/system_notifier.h"
19 #include "ash/common/system/tray/system_tray.h" 19 #include "ash/common/system/tray/system_tray.h"
20 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h" 20 #include "ash/common/wm/maximize_mode/maximize_mode_controller.h"
21 #include "ash/common/wm/window_state.h" 21 #include "ash/common/wm/window_state.h"
22 #include "ash/common/wm/wm_event.h" 22 #include "ash/common/wm/wm_event.h"
23 #include "ash/common/wm_shell.h" 23 #include "ash/common/wm_shell.h"
24 #include "ash/debug.h" 24 #include "ash/debug.h"
25 #include "ash/display/display_configuration_controller.h"
25 #include "ash/display/window_tree_host_manager.h" 26 #include "ash/display/window_tree_host_manager.h"
26 #include "ash/host/ash_window_tree_host.h" 27 #include "ash/host/ash_window_tree_host.h"
27 #include "ash/magnifier/magnification_controller.h" 28 #include "ash/magnifier/magnification_controller.h"
28 #include "ash/public/cpp/shell_window_ids.h" 29 #include "ash/public/cpp/shell_window_ids.h"
29 #include "ash/root_window_controller.h" 30 #include "ash/root_window_controller.h"
30 #include "ash/rotator/screen_rotation_animator.h" 31 #include "ash/rotator/screen_rotation_animator.h"
31 #include "ash/rotator/window_rotation.h" 32 #include "ash/rotator/window_rotation.h"
32 #include "ash/screenshot_delegate.h" 33 #include "ash/screenshot_delegate.h"
33 #include "ash/shell.h" 34 #include "ash/shell.h"
34 #include "ash/touch/touch_hud_debug.h" 35 #include "ash/touch/touch_hud_debug.h"
35 #include "ash/utility/screenshot_controller.h" 36 #include "ash/utility/screenshot_controller.h"
36 #include "ash/wm/power_button_controller.h" 37 #include "ash/wm/power_button_controller.h"
37 #include "ash/wm/window_state_aura.h" 38 #include "ash/wm/window_state_aura.h"
38 #include "ash/wm/window_util.h" 39 #include "ash/wm/window_util.h"
39 #include "base/memory/ptr_util.h" 40 #include "base/memory/ptr_util.h"
40 #include "base/metrics/histogram_macros.h" 41 #include "base/metrics/histogram_macros.h"
41 #include "base/metrics/user_metrics.h" 42 #include "base/metrics/user_metrics.h"
42 #include "base/strings/string_split.h" 43 #include "base/strings/string_split.h"
43 #include "base/strings/utf_string_conversions.h" 44 #include "base/strings/utf_string_conversions.h"
45 #include "base/sys_info.h"
44 #include "third_party/skia/include/core/SkColor.h" 46 #include "third_party/skia/include/core/SkColor.h"
45 #include "ui/base/accelerators/accelerator.h" 47 #include "ui/base/accelerators/accelerator.h"
46 #include "ui/base/l10n/l10n_util.h" 48 #include "ui/base/l10n/l10n_util.h"
47 #include "ui/compositor/layer.h" 49 #include "ui/compositor/layer.h"
48 #include "ui/compositor/layer_animation_sequence.h" 50 #include "ui/compositor/layer_animation_sequence.h"
49 #include "ui/compositor/layer_animator.h" 51 #include "ui/compositor/layer_animator.h"
50 #include "ui/display/manager/display_manager.h" 52 #include "ui/display/manager/display_manager.h"
51 #include "ui/display/screen.h" 53 #include "ui/display/screen.h"
52 #include "ui/events/event.h" 54 #include "ui/events/event.h"
53 #include "ui/events/keycodes/keyboard_codes.h" 55 #include "ui/events/keycodes/keyboard_codes.h"
54 #include "ui/message_center/message_center.h" 56 #include "ui/message_center/message_center.h"
55 #include "ui/message_center/notification.h" 57 #include "ui/message_center/notification.h"
56 #include "ui/message_center/notifier_settings.h" 58 #include "ui/message_center/notifier_settings.h"
57 59
58 #if defined(OS_CHROMEOS)
59 #include "ash/display/display_configuration_controller.h"
60 #include "base/sys_info.h"
61 #endif // defined(OS_CHROMEOS)
62
63 namespace ash { 60 namespace ash {
64 namespace { 61 namespace {
65 62
66 using base::UserMetricsAction; 63 using base::UserMetricsAction;
67 64
68 // The notification delegate that will be used to open the keyboard shortcut 65 // The notification delegate that will be used to open the keyboard shortcut
69 // help page when the notification is clicked. 66 // help page when the notification is clicked.
70 class DeprecatedAcceleratorNotificationDelegate 67 class DeprecatedAcceleratorNotificationDelegate
71 : public message_center::NotificationDelegate { 68 : public message_center::NotificationDelegate {
72 public: 69 public:
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 } 221 }
225 222
226 bool CanHandleUnpin() { 223 bool CanHandleUnpin() {
227 // Returns true only for WINDOW_STATE_TYPE_PINNED. 224 // Returns true only for WINDOW_STATE_TYPE_PINNED.
228 // WINDOW_STATE_TYPE_TRUSTED_PINNED does not accept user's unpin operation. 225 // WINDOW_STATE_TYPE_TRUSTED_PINNED does not accept user's unpin operation.
229 wm::WindowState* window_state = wm::GetActiveWindowState(); 226 wm::WindowState* window_state = wm::GetActiveWindowState();
230 return window_state && 227 return window_state &&
231 window_state->GetStateType() == wm::WINDOW_STATE_TYPE_PINNED; 228 window_state->GetStateType() == wm::WINDOW_STATE_TYPE_PINNED;
232 } 229 }
233 230
234 #if defined(OS_CHROMEOS)
235 void HandleSwapPrimaryDisplay() { 231 void HandleSwapPrimaryDisplay() {
236 base::RecordAction(UserMetricsAction("Accel_Swap_Primary_Display")); 232 base::RecordAction(UserMetricsAction("Accel_Swap_Primary_Display"));
237 233
238 // TODO(rjkroege): This is not correct behaviour on devices with more than 234 // TODO(rjkroege): This is not correct behaviour on devices with more than
239 // two screens. Behave the same as mirroring: fail and notify if there are 235 // two screens. Behave the same as mirroring: fail and notify if there are
240 // three or more screens. 236 // three or more screens.
241 Shell::GetInstance()->display_configuration_controller()->SetPrimaryDisplayId( 237 Shell::GetInstance()->display_configuration_controller()->SetPrimaryDisplayId(
242 Shell::GetInstance()->display_manager()->GetSecondaryDisplay().id(), 238 Shell::GetInstance()->display_manager()->GetSecondaryDisplay().id(),
243 true /* user_action */); 239 true /* user_action */);
244 } 240 }
(...skipping 12 matching lines...) Expand all
257 void HandleTouchHudClear() { 253 void HandleTouchHudClear() {
258 RootWindowController::ForTargetRootWindow()->touch_hud_debug()->Clear(); 254 RootWindowController::ForTargetRootWindow()->touch_hud_debug()->Clear();
259 } 255 }
260 256
261 void HandleTouchHudModeChange() { 257 void HandleTouchHudModeChange() {
262 RootWindowController* controller = 258 RootWindowController* controller =
263 RootWindowController::ForTargetRootWindow(); 259 RootWindowController::ForTargetRootWindow();
264 controller->touch_hud_debug()->ChangeToNextMode(); 260 controller->touch_hud_debug()->ChangeToNextMode();
265 } 261 }
266 262
267 #endif // defined(OS_CHROMEOS)
268
269 } // namespace 263 } // namespace
270 264
271 AcceleratorControllerDelegateAura::AcceleratorControllerDelegateAura() {} 265 AcceleratorControllerDelegateAura::AcceleratorControllerDelegateAura() {}
272 266
273 AcceleratorControllerDelegateAura::~AcceleratorControllerDelegateAura() {} 267 AcceleratorControllerDelegateAura::~AcceleratorControllerDelegateAura() {}
274 268
275 void AcceleratorControllerDelegateAura::SetScreenshotDelegate( 269 void AcceleratorControllerDelegateAura::SetScreenshotDelegate(
276 std::unique_ptr<ScreenshotDelegate> screenshot_delegate) { 270 std::unique_ptr<ScreenshotDelegate> screenshot_delegate) {
277 screenshot_delegate_ = std::move(screenshot_delegate); 271 screenshot_delegate_ = std::move(screenshot_delegate);
278 } 272 }
279 273
280 bool AcceleratorControllerDelegateAura::HandlesAction( 274 bool AcceleratorControllerDelegateAura::HandlesAction(
281 AcceleratorAction action) { 275 AcceleratorAction action) {
282 // NOTE: When adding a new accelerator that only depends on //ash/common code, 276 // NOTE: When adding a new accelerator that only depends on //ash/common code,
283 // add it to accelerator_controller.cc instead. See class comment. 277 // add it to accelerator_controller.cc instead. See class comment.
284 switch (action) { 278 switch (action) {
285 case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: 279 case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR:
286 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: 280 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS:
287 case DEBUG_TOGGLE_SHOW_FPS_COUNTER: 281 case DEBUG_TOGGLE_SHOW_FPS_COUNTER:
288 case DEBUG_TOGGLE_SHOW_PAINT_RECTS: 282 case DEBUG_TOGGLE_SHOW_PAINT_RECTS:
283 case DEV_ADD_REMOVE_DISPLAY:
289 case DEV_TOGGLE_ROOT_WINDOW_FULL_SCREEN: 284 case DEV_TOGGLE_ROOT_WINDOW_FULL_SCREEN:
285 case DEV_TOGGLE_UNIFIED_DESKTOP:
286 case LOCK_PRESSED:
287 case LOCK_RELEASED:
290 case MAGNIFY_SCREEN_ZOOM_IN: 288 case MAGNIFY_SCREEN_ZOOM_IN:
291 case MAGNIFY_SCREEN_ZOOM_OUT: 289 case MAGNIFY_SCREEN_ZOOM_OUT:
290 case POWER_PRESSED:
291 case POWER_RELEASED:
292 case ROTATE_SCREEN: 292 case ROTATE_SCREEN:
293 case ROTATE_WINDOW: 293 case ROTATE_WINDOW:
294 case SCALE_UI_DOWN: 294 case SCALE_UI_DOWN:
295 case SCALE_UI_RESET: 295 case SCALE_UI_RESET:
296 case SCALE_UI_UP: 296 case SCALE_UI_UP:
297 case SHOW_MESSAGE_CENTER_BUBBLE: 297 case SHOW_MESSAGE_CENTER_BUBBLE:
298 case SHOW_SYSTEM_TRAY_BUBBLE: 298 case SHOW_SYSTEM_TRAY_BUBBLE:
299 case SWAP_PRIMARY_DISPLAY:
299 case TAKE_PARTIAL_SCREENSHOT: 300 case TAKE_PARTIAL_SCREENSHOT:
300 case TAKE_SCREENSHOT: 301 case TAKE_SCREENSHOT:
301 case TAKE_WINDOW_SCREENSHOT: 302 case TAKE_WINDOW_SCREENSHOT:
302 case UNPIN:
303 return true;
304
305 #if defined(OS_CHROMEOS)
306 case DEV_ADD_REMOVE_DISPLAY:
307 case DEV_TOGGLE_UNIFIED_DESKTOP:
308 case LOCK_PRESSED:
309 case LOCK_RELEASED:
310 case POWER_PRESSED:
311 case POWER_RELEASED:
312 case SWAP_PRIMARY_DISPLAY:
313 case TOGGLE_MIRROR_MODE: 303 case TOGGLE_MIRROR_MODE:
314 case TOUCH_HUD_CLEAR: 304 case TOUCH_HUD_CLEAR:
315 case TOUCH_HUD_MODE_CHANGE: 305 case TOUCH_HUD_MODE_CHANGE:
316 case TOUCH_HUD_PROJECTION_TOGGLE: 306 case TOUCH_HUD_PROJECTION_TOGGLE:
307 case UNPIN:
317 return true; 308 return true;
318 #endif
319 309
320 default: 310 default:
321 break; 311 break;
322 } 312 }
323 return false; 313 return false;
324 } 314 }
325 315
326 bool AcceleratorControllerDelegateAura::CanPerformAction( 316 bool AcceleratorControllerDelegateAura::CanPerformAction(
327 AcceleratorAction action, 317 AcceleratorAction action,
328 const ui::Accelerator& accelerator, 318 const ui::Accelerator& accelerator,
329 const ui::Accelerator& previous_accelerator) { 319 const ui::Accelerator& previous_accelerator) {
330 switch (action) { 320 switch (action) {
331 case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: 321 case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR:
332 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: 322 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS:
333 case DEBUG_TOGGLE_SHOW_FPS_COUNTER: 323 case DEBUG_TOGGLE_SHOW_FPS_COUNTER:
334 case DEBUG_TOGGLE_SHOW_PAINT_RECTS: 324 case DEBUG_TOGGLE_SHOW_PAINT_RECTS:
335 return debug::DebugAcceleratorsEnabled(); 325 return debug::DebugAcceleratorsEnabled();
326 case DEV_ADD_REMOVE_DISPLAY:
336 case DEV_TOGGLE_ROOT_WINDOW_FULL_SCREEN: 327 case DEV_TOGGLE_ROOT_WINDOW_FULL_SCREEN:
328 case DEV_TOGGLE_UNIFIED_DESKTOP:
337 return debug::DeveloperAcceleratorsEnabled(); 329 return debug::DeveloperAcceleratorsEnabled();
338 case MAGNIFY_SCREEN_ZOOM_IN: 330 case MAGNIFY_SCREEN_ZOOM_IN:
339 case MAGNIFY_SCREEN_ZOOM_OUT: 331 case MAGNIFY_SCREEN_ZOOM_OUT:
340 return CanHandleMagnifyScreen(); 332 return CanHandleMagnifyScreen();
341 case SCALE_UI_DOWN: 333 case SCALE_UI_DOWN:
342 case SCALE_UI_RESET: 334 case SCALE_UI_RESET:
343 case SCALE_UI_UP: 335 case SCALE_UI_UP:
344 return accelerators::IsInternalDisplayZoomEnabled(); 336 return accelerators::IsInternalDisplayZoomEnabled();
345 case UNPIN: 337 case UNPIN:
346 return CanHandleUnpin(); 338 return CanHandleUnpin();
347 339
348 // Following are always enabled: 340 // Following are always enabled:
341 case LOCK_PRESSED:
342 case LOCK_RELEASED:
343 case POWER_PRESSED:
344 case POWER_RELEASED:
349 case ROTATE_SCREEN: 345 case ROTATE_SCREEN:
350 case ROTATE_WINDOW: 346 case ROTATE_WINDOW:
351 case SHOW_SYSTEM_TRAY_BUBBLE: 347 case SHOW_SYSTEM_TRAY_BUBBLE:
352 case TAKE_PARTIAL_SCREENSHOT: 348 case TAKE_PARTIAL_SCREENSHOT:
353 case TAKE_SCREENSHOT: 349 case TAKE_SCREENSHOT:
354 case TAKE_WINDOW_SCREENSHOT: 350 case TAKE_WINDOW_SCREENSHOT:
351 case TOGGLE_MIRROR_MODE:
352 case TOUCH_HUD_PROJECTION_TOGGLE:
355 return true; 353 return true;
356 354
357 #if defined(OS_CHROMEOS)
358 case DEV_ADD_REMOVE_DISPLAY:
359 case DEV_TOGGLE_UNIFIED_DESKTOP:
360 return debug::DeveloperAcceleratorsEnabled();
361
362 case SWAP_PRIMARY_DISPLAY: 355 case SWAP_PRIMARY_DISPLAY:
363 return display::Screen::GetScreen()->GetNumDisplays() > 1; 356 return display::Screen::GetScreen()->GetNumDisplays() > 1;
364 case TOUCH_HUD_CLEAR: 357 case TOUCH_HUD_CLEAR:
365 case TOUCH_HUD_MODE_CHANGE: 358 case TOUCH_HUD_MODE_CHANGE:
366 return CanHandleTouchHud(); 359 return CanHandleTouchHud();
367 360
368 // Following are always enabled.
369 case LOCK_PRESSED:
370 case LOCK_RELEASED:
371 case POWER_PRESSED:
372 case POWER_RELEASED:
373 case TOGGLE_MIRROR_MODE:
374 case TOUCH_HUD_PROJECTION_TOGGLE:
375 return true;
376 #endif
377
378 default: 361 default:
379 NOTREACHED(); 362 NOTREACHED();
380 break; 363 break;
381 } 364 }
382 return false; 365 return false;
383 } 366 }
384 367
385 void AcceleratorControllerDelegateAura::PerformAction( 368 void AcceleratorControllerDelegateAura::PerformAction(
386 AcceleratorAction action, 369 AcceleratorAction action,
387 const ui::Accelerator& accelerator) { 370 const ui::Accelerator& accelerator) {
388 switch (action) { 371 switch (action) {
389 case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: 372 case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR:
390 Shell::GetInstance()->display_manager()->ToggleDisplayScaleFactor(); 373 Shell::GetInstance()->display_manager()->ToggleDisplayScaleFactor();
391 break; 374 break;
392 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: 375 case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS:
393 debug::ToggleShowDebugBorders(); 376 debug::ToggleShowDebugBorders();
394 break; 377 break;
395 case DEBUG_TOGGLE_SHOW_FPS_COUNTER: 378 case DEBUG_TOGGLE_SHOW_FPS_COUNTER:
396 debug::ToggleShowFpsCounter(); 379 debug::ToggleShowFpsCounter();
397 break; 380 break;
398 case DEBUG_TOGGLE_SHOW_PAINT_RECTS: 381 case DEBUG_TOGGLE_SHOW_PAINT_RECTS:
399 debug::ToggleShowPaintRects(); 382 debug::ToggleShowPaintRects();
400 break; 383 break;
384 case DEV_ADD_REMOVE_DISPLAY:
385 Shell::GetInstance()->display_manager()->AddRemoveDisplay();
386 break;
401 case DEV_TOGGLE_ROOT_WINDOW_FULL_SCREEN: 387 case DEV_TOGGLE_ROOT_WINDOW_FULL_SCREEN:
402 Shell::GetPrimaryRootWindowController()->ash_host()->ToggleFullScreen(); 388 Shell::GetPrimaryRootWindowController()->ash_host()->ToggleFullScreen();
403 break; 389 break;
390 case DEV_TOGGLE_UNIFIED_DESKTOP:
391 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(
392 !Shell::GetInstance()->display_manager()->unified_desktop_enabled());
393 break;
394 case LOCK_PRESSED:
395 case LOCK_RELEASED:
396 Shell::GetInstance()->power_button_controller()->OnLockButtonEvent(
397 action == LOCK_PRESSED, base::TimeTicks());
398 break;
404 case MAGNIFY_SCREEN_ZOOM_IN: 399 case MAGNIFY_SCREEN_ZOOM_IN:
405 HandleMagnifyScreen(1); 400 HandleMagnifyScreen(1);
406 break; 401 break;
407 case MAGNIFY_SCREEN_ZOOM_OUT: 402 case MAGNIFY_SCREEN_ZOOM_OUT:
408 HandleMagnifyScreen(-1); 403 HandleMagnifyScreen(-1);
409 break; 404 break;
405 case POWER_PRESSED: // fallthrough
406 case POWER_RELEASED:
407 if (!base::SysInfo::IsRunningOnChromeOS()) {
408 // There is no powerd, the Chrome OS power manager, in linux desktop,
409 // so call the PowerButtonController here.
410 Shell::GetInstance()->power_button_controller()->OnPowerButtonEvent(
411 action == POWER_PRESSED, base::TimeTicks());
412 }
413 // We don't do anything with these at present on the device,
414 // (power button events are reported to us from powerm via
415 // D-BUS), but we consume them to prevent them from getting
416 // passed to apps -- see http://crbug.com/146609.
417 break;
410 case ROTATE_SCREEN: 418 case ROTATE_SCREEN:
411 HandleRotateScreen(); 419 HandleRotateScreen();
412 break; 420 break;
413 case ROTATE_WINDOW: 421 case ROTATE_WINDOW:
414 HandleRotateActiveWindow(); 422 HandleRotateActiveWindow();
415 break; 423 break;
416 case SCALE_UI_DOWN: 424 case SCALE_UI_DOWN:
417 accelerators::ZoomInternalDisplay(false /* down */); 425 accelerators::ZoomInternalDisplay(false /* down */);
418 break; 426 break;
419 case SCALE_UI_RESET: 427 case SCALE_UI_RESET:
420 accelerators::ResetInternalDisplayZoom(); 428 accelerators::ResetInternalDisplayZoom();
421 break; 429 break;
422 case SCALE_UI_UP: 430 case SCALE_UI_UP:
423 accelerators::ZoomInternalDisplay(true /* up */); 431 accelerators::ZoomInternalDisplay(true /* up */);
424 break; 432 break;
425 case SHOW_SYSTEM_TRAY_BUBBLE: 433 case SHOW_SYSTEM_TRAY_BUBBLE:
426 HandleShowSystemTrayBubble(); 434 HandleShowSystemTrayBubble();
427 break; 435 break;
436 case SWAP_PRIMARY_DISPLAY:
437 HandleSwapPrimaryDisplay();
438 break;
428 case TAKE_PARTIAL_SCREENSHOT: 439 case TAKE_PARTIAL_SCREENSHOT:
429 HandleTakePartialScreenshot(screenshot_delegate_.get()); 440 HandleTakePartialScreenshot(screenshot_delegate_.get());
430 break; 441 break;
431 case TAKE_SCREENSHOT: 442 case TAKE_SCREENSHOT:
432 HandleTakeScreenshot(screenshot_delegate_.get()); 443 HandleTakeScreenshot(screenshot_delegate_.get());
433 break; 444 break;
434 case TAKE_WINDOW_SCREENSHOT: 445 case TAKE_WINDOW_SCREENSHOT:
435 HandleTakeWindowScreenshot(screenshot_delegate_.get()); 446 HandleTakeWindowScreenshot(screenshot_delegate_.get());
436 break; 447 break;
437 case UNPIN:
438 accelerators::Unpin();
439 break;
440 #if defined(OS_CHROMEOS)
441 case DEV_ADD_REMOVE_DISPLAY:
442 Shell::GetInstance()->display_manager()->AddRemoveDisplay();
443 break;
444 case DEV_TOGGLE_UNIFIED_DESKTOP:
445 Shell::GetInstance()->display_manager()->SetUnifiedDesktopEnabled(
446 !Shell::GetInstance()->display_manager()->unified_desktop_enabled());
447 break;
448 case LOCK_PRESSED:
449 case LOCK_RELEASED:
450 Shell::GetInstance()->power_button_controller()->OnLockButtonEvent(
451 action == LOCK_PRESSED, base::TimeTicks());
452 break;
453 case POWER_PRESSED: // fallthrough
454 case POWER_RELEASED:
455 if (!base::SysInfo::IsRunningOnChromeOS()) {
456 // There is no powerd, the Chrome OS power manager, in linux desktop,
457 // so call the PowerButtonController here.
458 Shell::GetInstance()->power_button_controller()->OnPowerButtonEvent(
459 action == POWER_PRESSED, base::TimeTicks());
460 }
461 // We don't do anything with these at present on the device,
462 // (power button events are reported to us from powerm via
463 // D-BUS), but we consume them to prevent them from getting
464 // passed to apps -- see http://crbug.com/146609.
465 break;
466 case SWAP_PRIMARY_DISPLAY:
467 HandleSwapPrimaryDisplay();
468 break;
469 case TOGGLE_MIRROR_MODE: 448 case TOGGLE_MIRROR_MODE:
470 HandleToggleMirrorMode(); 449 HandleToggleMirrorMode();
471 break; 450 break;
472 case TOUCH_HUD_CLEAR: 451 case TOUCH_HUD_CLEAR:
473 HandleTouchHudClear(); 452 HandleTouchHudClear();
474 break; 453 break;
475 case TOUCH_HUD_MODE_CHANGE: 454 case TOUCH_HUD_MODE_CHANGE:
476 HandleTouchHudModeChange(); 455 HandleTouchHudModeChange();
477 break; 456 break;
478 case TOUCH_HUD_PROJECTION_TOGGLE: 457 case TOUCH_HUD_PROJECTION_TOGGLE:
479 accelerators::ToggleTouchHudProjection(); 458 accelerators::ToggleTouchHudProjection();
480 break; 459 break;
481 #endif 460 case UNPIN:
461 accelerators::Unpin();
462 break;
482 default: 463 default:
483 break; 464 break;
484 } 465 }
485 } 466 }
486 467
487 void AcceleratorControllerDelegateAura::ShowDeprecatedAcceleratorNotification( 468 void AcceleratorControllerDelegateAura::ShowDeprecatedAcceleratorNotification(
488 const char* const notification_id, 469 const char* const notification_id,
489 int message_id, 470 int message_id,
490 int old_shortcut_id, 471 int old_shortcut_id,
491 int new_shortcut_id) { 472 int new_shortcut_id) {
492 const base::string16 message = 473 const base::string16 message =
493 GetNotificationText(message_id, old_shortcut_id, new_shortcut_id); 474 GetNotificationText(message_id, old_shortcut_id, new_shortcut_id);
494 std::unique_ptr<message_center::Notification> notification( 475 std::unique_ptr<message_center::Notification> notification(
495 new message_center::Notification( 476 new message_center::Notification(
496 message_center::NOTIFICATION_TYPE_SIMPLE, notification_id, 477 message_center::NOTIFICATION_TYPE_SIMPLE, notification_id,
497 base::string16(), message, 478 base::string16(), message,
498 WmShell::Get()->delegate()->GetDeprecatedAcceleratorImage(), 479 WmShell::Get()->delegate()->GetDeprecatedAcceleratorImage(),
499 base::string16(), GURL(), 480 base::string16(), GURL(),
500 message_center::NotifierId( 481 message_center::NotifierId(
501 message_center::NotifierId::SYSTEM_COMPONENT, 482 message_center::NotifierId::SYSTEM_COMPONENT,
502 system_notifier::kNotifierDeprecatedAccelerator), 483 system_notifier::kNotifierDeprecatedAccelerator),
503 message_center::RichNotificationData(), 484 message_center::RichNotificationData(),
504 new DeprecatedAcceleratorNotificationDelegate)); 485 new DeprecatedAcceleratorNotificationDelegate));
505 message_center::MessageCenter::Get()->AddNotification( 486 message_center::MessageCenter::Get()->AddNotification(
506 std::move(notification)); 487 std::move(notification));
507 } 488 }
508 489
509 } // namespace ash 490 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/accelerators/accelerator_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698