| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 SERVICES_WINDOW_MANAGER_FOCUS_CONTROLLER_H_ | 5 #ifndef SERVICES_WINDOW_MANAGER_FOCUS_CONTROLLER_H_ | 
| 6 #define SERVICES_WINDOW_MANAGER_FOCUS_CONTROLLER_H_ | 6 #define SERVICES_WINDOW_MANAGER_FOCUS_CONTROLLER_H_ | 
| 7 | 7 | 
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" | 
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" | 
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" | 
| 11 #include "base/scoped_observer.h" | 11 #include "base/scoped_observer.h" | 
| 12 #include "mojo/services/view_manager/public/cpp/view_observer.h" | 12 #include "mojo/services/view_manager/public/cpp/view_observer.h" | 
| 13 #include "ui/events/event_handler.h" | 13 #include "ui/events/event_handler.h" | 
| 14 | 14 | 
| 15 namespace window_manager { | 15 namespace window_manager { | 
| 16 | 16 | 
| 17 class FocusControllerObserver; | 17 class FocusControllerObserver; | 
| 18 class FocusRules; | 18 class FocusRules; | 
| 19 | 19 | 
| 20 // FocusController handles focus and activation changes in a mojo window | 20 // FocusController handles focus and activation changes in a mojo window | 
| 21 // manager. Within the window manager, there can only be one focused and one | 21 // manager. Within the window manager, there can only be one focused and one | 
| 22 // active window at a time. When focus or activation changes, notifications are | 22 // active window at a time. When focus or activation changes, notifications are | 
| 23 // sent using the FocusControllerObserver interface. | 23 // sent using the FocusControllerObserver interface. | 
| 24 class FocusController : public ui::EventHandler, public mojo::ViewObserver { | 24 class FocusController : public ui::EventHandler, public mojo::ViewObserver { | 
| 25  public: | 25  public: | 
| 26   // |rules| cannot be null. | 26   // |rules| cannot be null. | 
| 27   explicit FocusController(scoped_ptr<FocusRules> rules); | 27   explicit FocusController(scoped_ptr<FocusRules> rules); | 
| 28   virtual ~FocusController(); | 28   ~FocusController() override; | 
| 29 | 29 | 
| 30   void AddObserver(FocusControllerObserver* observer); | 30   void AddObserver(FocusControllerObserver* observer); | 
| 31   void RemoveObserver(FocusControllerObserver* observer); | 31   void RemoveObserver(FocusControllerObserver* observer); | 
| 32 | 32 | 
| 33   void ActivateView(mojo::View* view); | 33   void ActivateView(mojo::View* view); | 
| 34   void DeactivateView(mojo::View* view); | 34   void DeactivateView(mojo::View* view); | 
| 35   mojo::View* GetActiveView(); | 35   mojo::View* GetActiveView(); | 
| 36   mojo::View* GetActivatableView(mojo::View* view); | 36   mojo::View* GetActivatableView(mojo::View* view); | 
| 37   mojo::View* GetToplevelView(mojo::View* view); | 37   mojo::View* GetToplevelView(mojo::View* view); | 
| 38   bool CanActivateView(mojo::View* view) const; | 38   bool CanActivateView(mojo::View* view) const; | 
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 93   DISALLOW_COPY_AND_ASSIGN(FocusController); | 93   DISALLOW_COPY_AND_ASSIGN(FocusController); | 
| 94 }; | 94 }; | 
| 95 | 95 | 
| 96 // Sets/Gets the focus controller for a view. | 96 // Sets/Gets the focus controller for a view. | 
| 97 void SetFocusController(mojo::View* view, FocusController* focus_controller); | 97 void SetFocusController(mojo::View* view, FocusController* focus_controller); | 
| 98 FocusController* GetFocusController(mojo::View* view); | 98 FocusController* GetFocusController(mojo::View* view); | 
| 99 | 99 | 
| 100 }  // namespace window_manager | 100 }  // namespace window_manager | 
| 101 | 101 | 
| 102 #endif  // SERVICES_WINDOW_MANAGER_FOCUS_CONTROLLER_H_ | 102 #endif  // SERVICES_WINDOW_MANAGER_FOCUS_CONTROLLER_H_ | 
| OLD | NEW | 
|---|