| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESTKOP_ACTIVATION_CLIENT_H_ | |
| 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESTKOP_ACTIVATION_CLIENT_H_ | |
| 7 | |
| 8 #include "base/basictypes.h" | |
| 9 #include "base/observer_list.h" | |
| 10 #include "base/scoped_observer.h" | |
| 11 #include "ui/aura/client/activation_client.h" | |
| 12 #include "ui/aura/client/focus_change_observer.h" | |
| 13 #include "ui/aura/env_observer.h" | |
| 14 #include "ui/aura/root_window_observer.h" | |
| 15 #include "ui/aura/window_observer.h" | |
| 16 #include "ui/views/views_export.h" | |
| 17 | |
| 18 namespace aura { | |
| 19 class FocusManager; | |
| 20 class RootWindow; | |
| 21 | |
| 22 namespace client { | |
| 23 class ActivationChangeObserver; | |
| 24 } | |
| 25 } | |
| 26 | |
| 27 namespace views { | |
| 28 | |
| 29 // An activation client that handles activation events in a single | |
| 30 // RootWindow. Used only on the Desktop where there can be multiple RootWindow | |
| 31 // objects. | |
| 32 class VIEWS_EXPORT DesktopActivationClient | |
| 33 : public aura::client::ActivationClient, | |
| 34 public aura::WindowObserver, | |
| 35 public ui::EventHandler, | |
| 36 public aura::client::FocusChangeObserver { | |
| 37 public: | |
| 38 explicit DesktopActivationClient(aura::RootWindow* root_window); | |
| 39 virtual ~DesktopActivationClient(); | |
| 40 | |
| 41 // ActivationClient: | |
| 42 virtual void AddObserver( | |
| 43 aura::client::ActivationChangeObserver* observer) OVERRIDE; | |
| 44 virtual void RemoveObserver( | |
| 45 aura::client::ActivationChangeObserver* observer) OVERRIDE; | |
| 46 virtual void ActivateWindow(aura::Window* window) OVERRIDE; | |
| 47 virtual void DeactivateWindow(aura::Window* window) OVERRIDE; | |
| 48 virtual aura::Window* GetActiveWindow() OVERRIDE; | |
| 49 virtual aura::Window* GetActivatableWindow(aura::Window* window) OVERRIDE; | |
| 50 virtual aura::Window* GetToplevelWindow(aura::Window* window) OVERRIDE; | |
| 51 virtual bool OnWillFocusWindow(aura::Window* window, | |
| 52 const ui::Event* event) OVERRIDE; | |
| 53 virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE; | |
| 54 | |
| 55 // Overridden from aura::WindowObserver: | |
| 56 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | |
| 57 | |
| 58 // Overridden from aura::client::FocusChangeObserver: | |
| 59 virtual void OnWindowFocused(aura::Window* gained_focus, | |
| 60 aura::Window* lost_focus) OVERRIDE; | |
| 61 | |
| 62 // Overridden from ui::EventHandler: | |
| 63 virtual void OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | |
| 64 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | |
| 65 virtual void OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | |
| 66 virtual void OnTouchEvent(ui::TouchEvent* event) OVERRIDE; | |
| 67 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | |
| 68 | |
| 69 private: | |
| 70 void FocusWindowWithEvent(const ui::Event* event); | |
| 71 | |
| 72 aura::RootWindow* root_window_; | |
| 73 | |
| 74 // The current active window. | |
| 75 aura::Window* current_active_; | |
| 76 | |
| 77 // True inside ActivateWindow(). Used to prevent recursion of focus | |
| 78 // change notifications causing activation. | |
| 79 bool updating_activation_; | |
| 80 | |
| 81 ObserverList<aura::client::ActivationChangeObserver> observers_; | |
| 82 | |
| 83 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_; | |
| 84 | |
| 85 DISALLOW_COPY_AND_ASSIGN(DesktopActivationClient); | |
| 86 }; | |
| 87 | |
| 88 } // namespace views | |
| 89 | |
| 90 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESTKOP_ACTIVATION_CLIENT_H_ | |
| OLD | NEW |