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

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: address comments 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
« no previous file with comments | « ash/accelerators/accelerator_commands_unittest.cc ('k') | ash/accelerators/accelerator_table.h » ('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 (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 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 return CanHandleShowMessageCenterBubble(); 1034 return CanHandleShowMessageCenterBubble();
1026 case SWITCH_IME: 1035 case SWITCH_IME:
1027 return CanHandleSwitchIme(ime_control_delegate_.get(), accelerator); 1036 return CanHandleSwitchIme(ime_control_delegate_.get(), accelerator);
1028 case TOGGLE_APP_LIST: 1037 case TOGGLE_APP_LIST:
1029 return CanHandleToggleAppList(accelerator, previous_accelerator); 1038 return CanHandleToggleAppList(accelerator, previous_accelerator);
1030 case WINDOW_CYCLE_SNAP_DOCK_LEFT: 1039 case WINDOW_CYCLE_SNAP_DOCK_LEFT:
1031 case WINDOW_CYCLE_SNAP_DOCK_RIGHT: 1040 case WINDOW_CYCLE_SNAP_DOCK_RIGHT:
1032 return CanHandleWindowSnapOrDock(); 1041 return CanHandleWindowSnapOrDock();
1033 case WINDOW_POSITION_CENTER: 1042 case WINDOW_POSITION_CENTER:
1034 return CanHandlePositionCenter(); 1043 return CanHandlePositionCenter();
1044 case UNPIN:
1045 return CanHandleUnpin();
1035 #if defined(OS_CHROMEOS) 1046 #if defined(OS_CHROMEOS)
1036 case DEBUG_ADD_REMOVE_DISPLAY: 1047 case DEBUG_ADD_REMOVE_DISPLAY:
1037 case DEBUG_TOGGLE_TOUCH_PAD: 1048 case DEBUG_TOGGLE_TOUCH_PAD:
1038 case DEBUG_TOGGLE_TOUCH_SCREEN: 1049 case DEBUG_TOGGLE_TOUCH_SCREEN:
1039 case DEBUG_TOGGLE_UNIFIED_DESKTOP: 1050 case DEBUG_TOGGLE_UNIFIED_DESKTOP:
1040 return debug::DebugAcceleratorsEnabled(); 1051 return debug::DebugAcceleratorsEnabled();
1041 case DISABLE_CAPS_LOCK: 1052 case DISABLE_CAPS_LOCK:
1042 return CanHandleDisableCapsLock(previous_accelerator); 1053 return CanHandleDisableCapsLock(previous_accelerator);
1043 case LOCK_SCREEN: 1054 case LOCK_SCREEN:
1044 return CanHandleLock(); 1055 return CanHandleLock();
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 case WINDOW_CYCLE_SNAP_DOCK_LEFT: 1291 case WINDOW_CYCLE_SNAP_DOCK_LEFT:
1281 case WINDOW_CYCLE_SNAP_DOCK_RIGHT: 1292 case WINDOW_CYCLE_SNAP_DOCK_RIGHT:
1282 HandleWindowSnapOrDock(action); 1293 HandleWindowSnapOrDock(action);
1283 break; 1294 break;
1284 case WINDOW_MINIMIZE: 1295 case WINDOW_MINIMIZE:
1285 HandleWindowMinimize(); 1296 HandleWindowMinimize();
1286 break; 1297 break;
1287 case WINDOW_POSITION_CENTER: 1298 case WINDOW_POSITION_CENTER:
1288 HandlePositionCenter(); 1299 HandlePositionCenter();
1289 break; 1300 break;
1301 case UNPIN:
1302 HandleUnpin();
1303 break;
1290 #if defined(OS_CHROMEOS) 1304 #if defined(OS_CHROMEOS)
1291 case BRIGHTNESS_DOWN: 1305 case BRIGHTNESS_DOWN:
1292 HandleBrightnessDown(brightness_control_delegate_.get(), accelerator); 1306 HandleBrightnessDown(brightness_control_delegate_.get(), accelerator);
1293 break; 1307 break;
1294 case BRIGHTNESS_UP: 1308 case BRIGHTNESS_UP:
1295 HandleBrightnessUp(brightness_control_delegate_.get(), accelerator); 1309 HandleBrightnessUp(brightness_control_delegate_.get(), accelerator);
1296 break; 1310 break;
1297 case DEBUG_ADD_REMOVE_DISPLAY: 1311 case DEBUG_ADD_REMOVE_DISPLAY:
1298 case DEBUG_TOGGLE_TOUCH_PAD: 1312 case DEBUG_TOGGLE_TOUCH_PAD:
1299 case DEBUG_TOGGLE_TOUCH_SCREEN: 1313 case DEBUG_TOGGLE_TOUCH_SCREEN:
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1445 } 1459 }
1446 1460
1447 void AcceleratorController::SetKeyboardBrightnessControlDelegate( 1461 void AcceleratorController::SetKeyboardBrightnessControlDelegate(
1448 std::unique_ptr<KeyboardBrightnessControlDelegate> 1462 std::unique_ptr<KeyboardBrightnessControlDelegate>
1449 keyboard_brightness_control_delegate) { 1463 keyboard_brightness_control_delegate) {
1450 keyboard_brightness_control_delegate_ = 1464 keyboard_brightness_control_delegate_ =
1451 std::move(keyboard_brightness_control_delegate); 1465 std::move(keyboard_brightness_control_delegate);
1452 } 1466 }
1453 1467
1454 } // namespace ash 1468 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_commands_unittest.cc ('k') | ash/accelerators/accelerator_table.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698