| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #ifndef COMPONENTS_MUS_WS_FOCUS_CONTROLLER_H_ | 5 #ifndef COMPONENTS_MUS_WS_FOCUS_CONTROLLER_H_ |
| 6 #define COMPONENTS_MUS_WS_FOCUS_CONTROLLER_H_ | 6 #define COMPONENTS_MUS_WS_FOCUS_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "components/mus/ws/server_window_drawn_tracker_observer.h" | 9 #include "components/mus/ws/server_window_drawn_tracker_observer.h" |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // Describes the source of the change. | 35 // Describes the source of the change. |
| 36 enum ChangeSource { | 36 enum ChangeSource { |
| 37 CHANGE_SOURCE_EXPLICIT, | 37 CHANGE_SOURCE_EXPLICIT, |
| 38 CHANGE_SOURCE_DRAWN_STATE_CHANGED, | 38 CHANGE_SOURCE_DRAWN_STATE_CHANGED, |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 // Returns whether |window| can be focused or activated. | 41 // Returns whether |window| can be focused or activated. |
| 42 bool CanBeFocused(ServerWindow* window) const; | 42 bool CanBeFocused(ServerWindow* window) const; |
| 43 bool CanBeActivated(ServerWindow* window) const; | 43 bool CanBeActivated(ServerWindow* window) const; |
| 44 | 44 |
| 45 // Returns the closest activatable ancestor of |window|. Returns nullptr if |
| 46 // there is no such ancestor. |
| 47 ServerWindow* GetActivatableAncestorOf(ServerWindow* window) const; |
| 48 |
| 45 // Implementation of SetFocusedWindow(). | 49 // Implementation of SetFocusedWindow(). |
| 46 void SetFocusedWindowImpl(ServerWindow* window, ChangeSource change_source); | 50 void SetFocusedWindowImpl(ServerWindow* window, ChangeSource change_source); |
| 47 | 51 |
| 48 // ServerWindowDrawnTrackerObserver: | 52 // ServerWindowDrawnTrackerObserver: |
| 49 void OnDrawnStateChanged(ServerWindow* ancestor, | 53 void OnDrawnStateChanged(ServerWindow* ancestor, |
| 50 ServerWindow* window, | 54 ServerWindow* window, |
| 51 bool is_drawn) override; | 55 bool is_drawn) override; |
| 52 | 56 |
| 53 FocusControllerDelegate* delegate_; | 57 FocusControllerDelegate* delegate_; |
| 58 |
| 59 ServerWindow* focused_window_; |
| 60 ServerWindow* active_window_; |
| 61 |
| 62 // Keeps track of the visibility of the focused and active window. |
| 54 scoped_ptr<ServerWindowDrawnTracker> drawn_tracker_; | 63 scoped_ptr<ServerWindowDrawnTracker> drawn_tracker_; |
| 55 | 64 |
| 56 DISALLOW_COPY_AND_ASSIGN(FocusController); | 65 DISALLOW_COPY_AND_ASSIGN(FocusController); |
| 57 }; | 66 }; |
| 58 | 67 |
| 59 } // namespace ws | 68 } // namespace ws |
| 60 | 69 |
| 61 } // namespace mus | 70 } // namespace mus |
| 62 | 71 |
| 63 #endif // COMPONENTS_MUS_WS_FOCUS_CONTROLLER_H_ | 72 #endif // COMPONENTS_MUS_WS_FOCUS_CONTROLLER_H_ |
| OLD | NEW |