| 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 #ifndef UI_VIEWS_COREWM_FOCUS_CONTROLLER_H_ | 5 #ifndef UI_WM_CORE_FOCUS_CONTROLLER_H_ |
| 6 #define UI_VIEWS_COREWM_FOCUS_CONTROLLER_H_ | 6 #define UI_WM_CORE_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 "ui/aura/client/activation_client.h" | 12 #include "ui/aura/client/activation_client.h" |
| 13 #include "ui/aura/client/focus_client.h" | 13 #include "ui/aura/client/focus_client.h" |
| 14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
| 15 #include "ui/events/event_handler.h" | 15 #include "ui/events/event_handler.h" |
| 16 #include "ui/views/views_export.h" | 16 #include "ui/wm/core/wm_core_export.h" |
| 17 | 17 |
| 18 namespace views { | 18 namespace views { |
| 19 namespace corewm { | 19 namespace corewm { |
| 20 | 20 |
| 21 class FocusRules; | 21 class FocusRules; |
| 22 | 22 |
| 23 // FocusController handles focus and activation changes for an environment | 23 // FocusController handles focus and activation changes for an environment |
| 24 // encompassing one or more RootWindows. Within an environment there can be | 24 // encompassing one or more RootWindows. Within an environment there can be |
| 25 // only one focused and one active window at a time. When focus or activation | 25 // only one focused and one active window at a time. When focus or activation |
| 26 // changes notifications are sent using the | 26 // changes notifications are sent using the |
| 27 // aura::client::Focus/ActivationChangeObserver interfaces. | 27 // aura::client::Focus/ActivationChangeObserver interfaces. |
| 28 // Changes to focus and activation can be from three sources: | 28 // Changes to focus and activation can be from three sources: |
| 29 // . the Aura Client API (implemented here in aura::client::ActivationClient). | 29 // . the Aura Client API (implemented here in aura::client::ActivationClient). |
| 30 // (The FocusController must be set as the ActivationClient implementation | 30 // (The FocusController must be set as the ActivationClient implementation |
| 31 // for all RootWindows). | 31 // for all RootWindows). |
| 32 // . input events (implemented here in ui::EventHandler). | 32 // . input events (implemented here in ui::EventHandler). |
| 33 // (The FocusController must be registered as a pre-target handler for | 33 // (The FocusController must be registered as a pre-target handler for |
| 34 // the applicable environment owner, either a RootWindow or another type). | 34 // the applicable environment owner, either a RootWindow or another type). |
| 35 // . Window disposition changes (implemented here in aura::WindowObserver). | 35 // . Window disposition changes (implemented here in aura::WindowObserver). |
| 36 // (The FocusController registers itself as an observer of the active and | 36 // (The FocusController registers itself as an observer of the active and |
| 37 // focused windows). | 37 // focused windows). |
| 38 class VIEWS_EXPORT FocusController : public aura::client::ActivationClient, | 38 class WM_CORE_EXPORT FocusController : public aura::client::ActivationClient, |
| 39 public aura::client::FocusClient, | 39 public aura::client::FocusClient, |
| 40 public ui::EventHandler, | 40 public ui::EventHandler, |
| 41 public aura::WindowObserver { | 41 public aura::WindowObserver { |
| 42 public: | 42 public: |
| 43 // |rules| cannot be NULL. | 43 // |rules| cannot be NULL. |
| 44 explicit FocusController(FocusRules* rules); | 44 explicit FocusController(FocusRules* rules); |
| 45 virtual ~FocusController(); | 45 virtual ~FocusController(); |
| 46 | 46 |
| 47 private: | 47 private: |
| 48 // Overridden from aura::client::ActivationClient: | 48 // Overridden from aura::client::ActivationClient: |
| 49 virtual void AddObserver( | 49 virtual void AddObserver( |
| 50 aura::client::ActivationChangeObserver* observer) OVERRIDE; | 50 aura::client::ActivationChangeObserver* observer) OVERRIDE; |
| 51 virtual void RemoveObserver( | 51 virtual void RemoveObserver( |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 ObserverList<aura::client::FocusChangeObserver> focus_observers_; | 120 ObserverList<aura::client::FocusChangeObserver> focus_observers_; |
| 121 | 121 |
| 122 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_; | 122 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_; |
| 123 | 123 |
| 124 DISALLOW_COPY_AND_ASSIGN(FocusController); | 124 DISALLOW_COPY_AND_ASSIGN(FocusController); |
| 125 }; | 125 }; |
| 126 | 126 |
| 127 } // namespace corewm | 127 } // namespace corewm |
| 128 } // namespace views | 128 } // namespace views |
| 129 | 129 |
| 130 #endif // UI_VIEWS_COREWM_FOCUS_CONTROLLER_H_ | 130 #endif // UI_WM_CORE_FOCUS_CONTROLLER_H_ |
| OLD | NEW |