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

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

Issue 2078883003: Handle UNPIN operation in ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Upload only diff. Created 4 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "ash/accelerators/accelerator_controller.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>
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 // Docked windows do not support centering. 540 // Docked windows do not support centering.
541 wm::WindowState* window_state = wm::GetActiveWindowState(); 541 wm::WindowState* window_state = wm::GetActiveWindowState();
542 return (window_state && !window_state->IsDocked()); 542 return (window_state && !window_state->IsDocked());
543 } 543 }
544 544
545 void HandlePositionCenter() { 545 void HandlePositionCenter() {
546 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center")); 546 base::RecordAction(UserMetricsAction("Accel_Window_Position_Center"));
547 wm::CenterWindow(wm::GetActiveWindow()); 547 wm::CenterWindow(wm::GetActiveWindow());
548 } 548 }
549 549
550 bool CanHandleUnpin() {
551 wm::WindowState* window_state = wm::GetActiveWindowState();
552 return window_state && window_state->IsPinned();
553 }
554
555 void HandleUnpin() {
556 accelerators::Unpin();
557 }
558
550 #if defined(OS_CHROMEOS) 559 #if defined(OS_CHROMEOS)
551 void HandleBrightnessDown(BrightnessControlDelegate* delegate, 560 void HandleBrightnessDown(BrightnessControlDelegate* delegate,
552 const ui::Accelerator& accelerator) { 561 const ui::Accelerator& accelerator) {
553 if (delegate) 562 if (delegate)
554 delegate->HandleBrightnessDown(accelerator); 563 delegate->HandleBrightnessDown(accelerator);
555 } 564 }
556 565
557 void HandleBrightnessUp(BrightnessControlDelegate* delegate, 566 void HandleBrightnessUp(BrightnessControlDelegate* delegate,
558 const ui::Accelerator& accelerator) { 567 const ui::Accelerator& accelerator) {
559 if (delegate) 568 if (delegate)
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
1021 return CanHandleShowMessageCenterBubble(); 1030 return CanHandleShowMessageCenterBubble();
1022 case SWITCH_IME: 1031 case SWITCH_IME:
1023 return CanHandleSwitchIme(ime_control_delegate_.get(), accelerator); 1032 return CanHandleSwitchIme(ime_control_delegate_.get(), accelerator);
1024 case TOGGLE_APP_LIST: 1033 case TOGGLE_APP_LIST:
1025 return CanHandleToggleAppList(accelerator, previous_accelerator); 1034 return CanHandleToggleAppList(accelerator, previous_accelerator);
1026 case WINDOW_CYCLE_SNAP_DOCK_LEFT: 1035 case WINDOW_CYCLE_SNAP_DOCK_LEFT:
1027 case WINDOW_CYCLE_SNAP_DOCK_RIGHT: 1036 case WINDOW_CYCLE_SNAP_DOCK_RIGHT:
1028 return CanHandleWindowSnapOrDock(); 1037 return CanHandleWindowSnapOrDock();
1029 case WINDOW_POSITION_CENTER: 1038 case WINDOW_POSITION_CENTER:
1030 return CanHandlePositionCenter(); 1039 return CanHandlePositionCenter();
1040 case UNPIN:
1041 return CanHandleUnpin();
1031 #if defined(OS_CHROMEOS) 1042 #if defined(OS_CHROMEOS)
1032 case DEBUG_ADD_REMOVE_DISPLAY: 1043 case DEBUG_ADD_REMOVE_DISPLAY:
1033 case DEBUG_TOGGLE_TOUCH_PAD: 1044 case DEBUG_TOGGLE_TOUCH_PAD:
1034 case DEBUG_TOGGLE_TOUCH_SCREEN: 1045 case DEBUG_TOGGLE_TOUCH_SCREEN:
1035 case DEBUG_TOGGLE_UNIFIED_DESKTOP: 1046 case DEBUG_TOGGLE_UNIFIED_DESKTOP:
1036 return debug::DebugAcceleratorsEnabled(); 1047 return debug::DebugAcceleratorsEnabled();
1037 case DISABLE_CAPS_LOCK: 1048 case DISABLE_CAPS_LOCK:
1038 return CanHandleDisableCapsLock(previous_accelerator); 1049 return CanHandleDisableCapsLock(previous_accelerator);
1039 case LOCK_SCREEN: 1050 case LOCK_SCREEN:
1040 return CanHandleLock(); 1051 return CanHandleLock();
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1276 case WINDOW_CYCLE_SNAP_DOCK_LEFT: 1287 case WINDOW_CYCLE_SNAP_DOCK_LEFT:
1277 case WINDOW_CYCLE_SNAP_DOCK_RIGHT: 1288 case WINDOW_CYCLE_SNAP_DOCK_RIGHT:
1278 HandleWindowSnapOrDock(action); 1289 HandleWindowSnapOrDock(action);
1279 break; 1290 break;
1280 case WINDOW_MINIMIZE: 1291 case WINDOW_MINIMIZE:
1281 HandleWindowMinimize(); 1292 HandleWindowMinimize();
1282 break; 1293 break;
1283 case WINDOW_POSITION_CENTER: 1294 case WINDOW_POSITION_CENTER:
1284 HandlePositionCenter(); 1295 HandlePositionCenter();
1285 break; 1296 break;
1297 case UNPIN:
1298 HandleUnpin();
1299 break;
1286 #if defined(OS_CHROMEOS) 1300 #if defined(OS_CHROMEOS)
1287 case BRIGHTNESS_DOWN: 1301 case BRIGHTNESS_DOWN:
1288 HandleBrightnessDown(brightness_control_delegate_.get(), accelerator); 1302 HandleBrightnessDown(brightness_control_delegate_.get(), accelerator);
1289 break; 1303 break;
1290 case BRIGHTNESS_UP: 1304 case BRIGHTNESS_UP:
1291 HandleBrightnessUp(brightness_control_delegate_.get(), accelerator); 1305 HandleBrightnessUp(brightness_control_delegate_.get(), accelerator);
1292 break; 1306 break;
1293 case DEBUG_ADD_REMOVE_DISPLAY: 1307 case DEBUG_ADD_REMOVE_DISPLAY:
1294 case DEBUG_TOGGLE_TOUCH_PAD: 1308 case DEBUG_TOGGLE_TOUCH_PAD:
1295 case DEBUG_TOGGLE_TOUCH_SCREEN: 1309 case DEBUG_TOGGLE_TOUCH_SCREEN:
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1441 } 1455 }
1442 1456
1443 void AcceleratorController::SetKeyboardBrightnessControlDelegate( 1457 void AcceleratorController::SetKeyboardBrightnessControlDelegate(
1444 std::unique_ptr<KeyboardBrightnessControlDelegate> 1458 std::unique_ptr<KeyboardBrightnessControlDelegate>
1445 keyboard_brightness_control_delegate) { 1459 keyboard_brightness_control_delegate) {
1446 keyboard_brightness_control_delegate_ = 1460 keyboard_brightness_control_delegate_ =
1447 std::move(keyboard_brightness_control_delegate); 1461 std::move(keyboard_brightness_control_delegate);
1448 } 1462 }
1449 1463
1450 } // namespace ash 1464 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698