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

Side by Side Diff: ash/mus/accelerators/accelerator_controller_registrar.cc

Issue 2886253002: mash: remove more shell/shelf WmWindow usage. (Closed)
Patch Set: Sync and rebase. Created 3 years, 7 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 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/mus/accelerators/accelerator_controller_registrar.h" 5 #include "ash/mus/accelerators/accelerator_controller_registrar.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "ash/accelerators/accelerator_controller.h" 9 #include "ash/accelerators/accelerator_controller.h"
10 #include "ash/accelerators/accelerator_router.h" 10 #include "ash/accelerators/accelerator_router.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 // is called for *all* key events, where as this is only called for 85 // is called for *all* key events, where as this is only called for
86 // registered accelerators. This means the previous accelerator isn't the 86 // registered accelerators. This means the previous accelerator isn't the
87 // same as it was in ash. We need to figure out exactly what is needed of 87 // same as it was in ash. We need to figure out exactly what is needed of
88 // previous accelerator so that we can either register for the right set of 88 // previous accelerator so that we can either register for the right set of
89 // accelerators, or make WS send the previous accelerator. 89 // accelerators, or make WS send the previous accelerator.
90 // http://crbug.com/630683. 90 // http://crbug.com/630683.
91 accelerator_controller->accelerator_history()->StoreCurrentAccelerator( 91 accelerator_controller->accelerator_history()->StoreCurrentAccelerator(
92 accelerator); 92 accelerator);
93 if (HandleWindowCycleAccelerator(accelerator)) 93 if (HandleWindowCycleAccelerator(accelerator))
94 return ui::mojom::EventResult::HANDLED; 94 return ui::mojom::EventResult::HANDLED;
95 WmWindow* target_window = WmWindow::Get(wm::GetFocusedWindow()); 95 aura::Window* target_window = wm::GetFocusedWindow();
96 if (!target_window) 96 if (!target_window)
97 target_window = Shell::GetWmRootWindowForNewWindows(); 97 target_window = Shell::GetRootWindowForNewWindows();
98 DCHECK(target_window); 98 DCHECK(target_window);
99 if (router_->ProcessAccelerator(target_window, *(event.AsKeyEvent()), 99 if (router_->ProcessAccelerator(WmWindow::Get(target_window),
100 accelerator)) { 100 *(event.AsKeyEvent()), accelerator)) {
101 return ui::mojom::EventResult::HANDLED; 101 return ui::mojom::EventResult::HANDLED;
102 } 102 }
103 if (accelerator_controller->IsActionForAcceleratorEnabled(accelerator)) { 103 if (accelerator_controller->IsActionForAcceleratorEnabled(accelerator)) {
104 // We do have an accelerator for the key. Set a property so that the real 104 // We do have an accelerator for the key. Set a property so that the real
105 // target knows we have an accelerator. 105 // target knows we have an accelerator.
106 (*properties)[mojom::kWillProcessAccelerator_KeyEventProperty] = 106 (*properties)[mojom::kWillProcessAccelerator_KeyEventProperty] =
107 std::vector<uint8_t>(); 107 std::vector<uint8_t>();
108 } 108 }
109 return ui::mojom::EventResult::UNHANDLED; 109 return ui::mojom::EventResult::UNHANDLED;
110 } 110 }
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 if (accelerator == window_cycle_cancel_accelerator_) { 217 if (accelerator == window_cycle_cancel_accelerator_) {
218 window_cycle_controller->CancelCycling(); 218 window_cycle_controller->CancelCycling();
219 return true; 219 return true;
220 } 220 }
221 221
222 return false; 222 return false;
223 } 223 }
224 224
225 } // namespace mus 225 } // namespace mus
226 } // namespace ash 226 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698