| 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_WIDGET_DESKTOP_AURA_DESTKOP_ACTIVATION_CLIENT_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESTKOP_ACTIVATION_CLIENT_H_ |
| 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESTKOP_ACTIVATION_CLIENT_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESTKOP_ACTIVATION_CLIENT_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/observer_list.h" | 9 #include "base/observer_list.h" |
| 10 #include "base/scoped_observer.h" | 10 #include "base/scoped_observer.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 virtual ~DesktopActivationClient(); | 39 virtual ~DesktopActivationClient(); |
| 40 | 40 |
| 41 // ActivationClient: | 41 // ActivationClient: |
| 42 virtual void AddObserver( | 42 virtual void AddObserver( |
| 43 aura::client::ActivationChangeObserver* observer) OVERRIDE; | 43 aura::client::ActivationChangeObserver* observer) OVERRIDE; |
| 44 virtual void RemoveObserver( | 44 virtual void RemoveObserver( |
| 45 aura::client::ActivationChangeObserver* observer) OVERRIDE; | 45 aura::client::ActivationChangeObserver* observer) OVERRIDE; |
| 46 virtual void ActivateWindow(aura::Window* window) OVERRIDE; | 46 virtual void ActivateWindow(aura::Window* window) OVERRIDE; |
| 47 virtual void DeactivateWindow(aura::Window* window) OVERRIDE; | 47 virtual void DeactivateWindow(aura::Window* window) OVERRIDE; |
| 48 virtual aura::Window* GetActiveWindow() OVERRIDE; | 48 virtual aura::Window* GetActiveWindow() OVERRIDE; |
| 49 virtual aura::Window* GetActivatableWindow(aura::Window* window) OVERRIDE; |
| 49 virtual bool OnWillFocusWindow(aura::Window* window, | 50 virtual bool OnWillFocusWindow(aura::Window* window, |
| 50 const ui::Event* event) OVERRIDE; | 51 const ui::Event* event) OVERRIDE; |
| 51 virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE; | 52 virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE; |
| 52 | 53 |
| 53 // Overridden from aura::WindowObserver: | 54 // Overridden from aura::WindowObserver: |
| 54 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; | 55 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; |
| 55 | 56 |
| 56 // Overridden from aura::client::FocusChangeObserver: | 57 // Overridden from aura::client::FocusChangeObserver: |
| 57 virtual void OnWindowFocused(aura::Window* window) OVERRIDE; | 58 virtual void OnWindowFocused(aura::Window* window) OVERRIDE; |
| 58 | 59 |
| 59 // Overridden from ui::EventHandler: | 60 // Overridden from ui::EventHandler: |
| 60 virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE; | 61 virtual ui::EventResult OnKeyEvent(ui::KeyEvent* event) OVERRIDE; |
| 61 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE; | 62 virtual ui::EventResult OnMouseEvent(ui::MouseEvent* event) OVERRIDE; |
| 62 virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; | 63 virtual ui::EventResult OnScrollEvent(ui::ScrollEvent* event) OVERRIDE; |
| 63 virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE; | 64 virtual ui::EventResult OnTouchEvent(ui::TouchEvent* event) OVERRIDE; |
| 64 virtual ui::EventResult OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 65 virtual ui::EventResult OnGestureEvent(ui::GestureEvent* event) OVERRIDE; |
| 65 | 66 |
| 66 private: | 67 private: |
| 67 // Walks up the chain to find the correct parent window to activate when we | |
| 68 // try to activate |window|. | |
| 69 aura::Window* GetActivatableWindow(aura::Window* window); | |
| 70 | |
| 71 void FocusWindowWithEvent(const ui::Event* event); | 68 void FocusWindowWithEvent(const ui::Event* event); |
| 72 | 69 |
| 73 aura::RootWindow* root_window_; | 70 aura::RootWindow* root_window_; |
| 74 | 71 |
| 75 // The current active window. | 72 // The current active window. |
| 76 aura::Window* current_active_; | 73 aura::Window* current_active_; |
| 77 | 74 |
| 78 // True inside ActivateWindow(). Used to prevent recursion of focus | 75 // True inside ActivateWindow(). Used to prevent recursion of focus |
| 79 // change notifications causing activation. | 76 // change notifications causing activation. |
| 80 bool updating_activation_; | 77 bool updating_activation_; |
| 81 | 78 |
| 82 ObserverList<aura::client::ActivationChangeObserver> observers_; | 79 ObserverList<aura::client::ActivationChangeObserver> observers_; |
| 83 | 80 |
| 84 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_; | 81 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_; |
| 85 | 82 |
| 86 DISALLOW_COPY_AND_ASSIGN(DesktopActivationClient); | 83 DISALLOW_COPY_AND_ASSIGN(DesktopActivationClient); |
| 87 }; | 84 }; |
| 88 | 85 |
| 89 } // namespace views | 86 } // namespace views |
| 90 | 87 |
| 91 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESTKOP_ACTIVATION_CLIENT_H_ | 88 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESTKOP_ACTIVATION_CLIENT_H_ |
| OLD | NEW |