OLD | NEW |
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/wm/window_cycle_controller.h" | 5 #include "ash/wm/window_cycle_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "ash/shell_delegate.h" | 9 #include "ash/shell_delegate.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 }; | 27 }; |
28 | 28 |
29 // Filter to watch for the termination of a keyboard gesture to cycle through | 29 // Filter to watch for the termination of a keyboard gesture to cycle through |
30 // multiple windows. | 30 // multiple windows. |
31 class WindowCycleEventFilter : public ui::EventHandler { | 31 class WindowCycleEventFilter : public ui::EventHandler { |
32 public: | 32 public: |
33 WindowCycleEventFilter(); | 33 WindowCycleEventFilter(); |
34 virtual ~WindowCycleEventFilter(); | 34 virtual ~WindowCycleEventFilter(); |
35 | 35 |
36 // Overridden from ui::EventHandler: | 36 // Overridden from ui::EventHandler: |
37 virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 37 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
38 private: | 38 private: |
39 DISALLOW_COPY_AND_ASSIGN(WindowCycleEventFilter); | 39 DISALLOW_COPY_AND_ASSIGN(WindowCycleEventFilter); |
40 }; | 40 }; |
41 | 41 |
42 // Watch for all keyboard events by filtering the root window. | 42 // Watch for all keyboard events by filtering the root window. |
43 WindowCycleEventFilter::WindowCycleEventFilter() { | 43 WindowCycleEventFilter::WindowCycleEventFilter() { |
44 } | 44 } |
45 | 45 |
46 WindowCycleEventFilter::~WindowCycleEventFilter() { | 46 WindowCycleEventFilter::~WindowCycleEventFilter() { |
47 } | 47 } |
48 | 48 |
49 ui::EventResult WindowCycleEventFilter::OnKeyEvent(ui::KeyEvent* event) { | 49 void WindowCycleEventFilter::OnKeyEvent(ui::KeyEvent* event) { |
50 // Views uses VKEY_MENU for both left and right Alt keys. | 50 // Views uses VKEY_MENU for both left and right Alt keys. |
51 if (event->key_code() == ui::VKEY_MENU && | 51 if (event->key_code() == ui::VKEY_MENU && |
52 event->type() == ui::ET_KEY_RELEASED) { | 52 event->type() == ui::ET_KEY_RELEASED) { |
53 Shell::GetInstance()->window_cycle_controller()->AltKeyReleased(); | 53 Shell::GetInstance()->window_cycle_controller()->AltKeyReleased(); |
54 // Warning: |this| will be deleted from here on. | 54 // Warning: |this| will be deleted from here on. |
55 } | 55 } |
56 return ui::ER_UNHANDLED; // Always let the event propagate. | |
57 } | 56 } |
58 | 57 |
59 // Adds all the children of |window| to |windows|. | 58 // Adds all the children of |window| to |windows|. |
60 void AddAllChildren(aura::Window* window, | 59 void AddAllChildren(aura::Window* window, |
61 WindowCycleList::WindowList* windows) { | 60 WindowCycleList::WindowList* windows) { |
62 const WindowCycleList::WindowList& children(window->children()); | 61 const WindowCycleList::WindowList& children(window->children()); |
63 windows->insert(windows->end(), children.begin(), children.end()); | 62 windows->insert(windows->end(), children.begin(), children.end()); |
64 } | 63 } |
65 | 64 |
66 // Adds all the children of all of |window|s children to |windows|. | 65 // Adds all the children of all of |window|s children to |windows|. |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 mru_windows_.remove(window); | 283 mru_windows_.remove(window); |
285 if (window->id() == internal::kShellWindowId_WorkspaceContainer) | 284 if (window->id() == internal::kShellWindowId_WorkspaceContainer) |
286 window->RemoveObserver(this); | 285 window->RemoveObserver(this); |
287 } | 286 } |
288 | 287 |
289 void WindowCycleController::OnWindowDestroying(aura::Window* window) { | 288 void WindowCycleController::OnWindowDestroying(aura::Window* window) { |
290 window->RemoveObserver(this); | 289 window->RemoveObserver(this); |
291 } | 290 } |
292 | 291 |
293 } // namespace ash | 292 } // namespace ash |
OLD | NEW |