Chromium Code Reviews| Index: components/mus/ws/focus_controller.h |
| diff --git a/components/mus/ws/focus_controller.h b/components/mus/ws/focus_controller.h |
| index a86c86e3912ad44114cf3ee65ff1b1ecdcecf8bd..105f35c994d6ebee59ad6508d1d68f8e3ce58a93 100644 |
| --- a/components/mus/ws/focus_controller.h |
| +++ b/components/mus/ws/focus_controller.h |
| @@ -9,6 +9,7 @@ |
| #include "base/memory/scoped_ptr.h" |
| #include "base/observer_list.h" |
| #include "components/mus/ws/server_window_drawn_tracker_observer.h" |
| +#include "components/mus/ws/server_window_observer.h" |
| namespace mus { |
| @@ -18,6 +19,7 @@ class FocusControllerDelegate; |
| class FocusControllerObserver; |
| class ServerWindow; |
| class ServerWindowDrawnTracker; |
| +struct WindowId; |
| // Describes the source of the change. |
| enum class FocusControllerChangeSource { |
| @@ -27,7 +29,8 @@ enum class FocusControllerChangeSource { |
| // Tracks the focused window. Focus is moved to another window when the drawn |
| // state of the focused window changes. |
| -class FocusController : public ServerWindowDrawnTrackerObserver { |
| +class FocusController : public ServerWindowDrawnTrackerObserver, |
| + public ServerWindowObserver { |
| public: |
| FocusController(FocusControllerDelegate* delegate, ServerWindow* root); |
| ~FocusController() override; |
| @@ -44,7 +47,13 @@ class FocusController : public ServerWindowDrawnTrackerObserver { |
| void RemoveObserver(FocusControllerObserver* observer); |
| private: |
| - void SetActiveWindow(ServerWindow* window); |
| + enum class ActivationChangeReason { |
| + UNKNONW, |
| + CYCLE, // Activation changed because of ActivateNextWindow(). |
| + FOCUS, // Focus change required a different window to be activated. |
| + DRAWN_STATE_CHANGED, // Active window was hidden or destroyed. |
| + }; |
| + void SetActiveWindow(ServerWindow* window, ActivationChangeReason reason); |
| // Returns whether |window| can be focused or activated. |
| bool CanBeFocused(ServerWindow* window) const; |
| @@ -58,6 +67,8 @@ class FocusController : public ServerWindowDrawnTrackerObserver { |
| void SetFocusedWindowImpl(FocusControllerChangeSource change_source, |
| ServerWindow* window); |
| + void ClearCycleWindows(); |
| + |
| // ServerWindowDrawnTrackerObserver: |
| void OnDrawnStateWillChange(ServerWindow* ancestor, |
| ServerWindow* window, |
| @@ -66,11 +77,18 @@ class FocusController : public ServerWindowDrawnTrackerObserver { |
| ServerWindow* window, |
| bool is_drawn) override; |
| + // ServerWindowObserver: |
| + void OnWillDestroyWindow(ServerWindow* window) override; |
| + |
| FocusControllerDelegate* delegate_; |
| ServerWindow* root_; |
| ServerWindow* focused_window_; |
| ServerWindow* active_window_; |
| + // Tracks what caused |active_window_| to be activated. |
| + ActivationChangeReason activation_reason_; |
| + |
| + std::vector<ServerWindow*> cycle_windows_; |
|
sky
2016/01/06 21:02:39
It's not obvious what this is, or how it changes b
sadrul
2016/01/08 20:40:26
Done.
|
| base::ObserverList<FocusControllerObserver> observers_; |