Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6)

Side by Side Diff: ui/views/widget/desktop_aura/desktop_activation_client.h

Issue 11299219: Rework FocusManager as FocusClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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"
11 #include "ui/aura/client/activation_client.h" 11 #include "ui/aura/client/activation_client.h"
12 #include "ui/aura/client/focus_change_observer.h"
12 #include "ui/aura/env_observer.h" 13 #include "ui/aura/env_observer.h"
13 #include "ui/aura/focus_change_observer.h"
14 #include "ui/aura/root_window_observer.h" 14 #include "ui/aura/root_window_observer.h"
15 #include "ui/aura/window_observer.h" 15 #include "ui/aura/window_observer.h"
16 #include "ui/views/views_export.h" 16 #include "ui/views/views_export.h"
17 17
18 namespace aura { 18 namespace aura {
19 class FocusManager; 19 class FocusManager;
20 class RootWindow; 20 class RootWindow;
21 21
22 namespace client { 22 namespace client {
23 class ActivationChangeObserver; 23 class ActivationChangeObserver;
24 } 24 }
25 } 25 }
26 26
27 namespace views { 27 namespace views {
28 28
29 // An activation client that handles activation events in a single 29 // An activation client that handles activation events in a single
30 // RootWindow. Used only on the Desktop where there can be multiple RootWindow 30 // RootWindow. Used only on the Desktop where there can be multiple RootWindow
31 // objects. 31 // objects.
32 class VIEWS_EXPORT DesktopActivationClient 32 class VIEWS_EXPORT DesktopActivationClient
33 : public aura::client::ActivationClient, 33 : public aura::client::ActivationClient,
34 public aura::WindowObserver, 34 public aura::WindowObserver,
35 public aura::FocusChangeObserver { 35 public aura::client::FocusChangeObserver {
36 public: 36 public:
37 explicit DesktopActivationClient(aura::RootWindow* root_window); 37 explicit DesktopActivationClient(aura::RootWindow* root_window);
38 virtual ~DesktopActivationClient(); 38 virtual ~DesktopActivationClient();
39 39
40 // ActivationClient: 40 // ActivationClient:
41 virtual void AddObserver( 41 virtual void AddObserver(
42 aura::client::ActivationChangeObserver* observer) OVERRIDE; 42 aura::client::ActivationChangeObserver* observer) OVERRIDE;
43 virtual void RemoveObserver( 43 virtual void RemoveObserver(
44 aura::client::ActivationChangeObserver* observer) OVERRIDE; 44 aura::client::ActivationChangeObserver* observer) OVERRIDE;
45 virtual void ActivateWindow(aura::Window* window) OVERRIDE; 45 virtual void ActivateWindow(aura::Window* window) OVERRIDE;
46 virtual void DeactivateWindow(aura::Window* window) OVERRIDE; 46 virtual void DeactivateWindow(aura::Window* window) OVERRIDE;
47 virtual aura::Window* GetActiveWindow() OVERRIDE; 47 virtual aura::Window* GetActiveWindow() OVERRIDE;
48 virtual bool OnWillFocusWindow(aura::Window* window, 48 virtual bool OnWillFocusWindow(aura::Window* window,
49 const ui::Event* event) OVERRIDE; 49 const ui::Event* event) OVERRIDE;
50 virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE; 50 virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE;
51 51
52 // Overridden from aura::WindowObserver: 52 // Overridden from aura::WindowObserver:
53 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; 53 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
54 54
55 // Overridden from aura::FocusChangeObserver: 55 // Overridden from aura::client::FocusChangeObserver:
56 virtual void OnWindowFocused(aura::Window* window) OVERRIDE; 56 virtual void OnWindowFocused(aura::Window* window) OVERRIDE;
57 57
58 private: 58 private:
59 // Walks up the chain to find the correct parent window to activate when we 59 // Walks up the chain to find the correct parent window to activate when we
60 // try to activate |window|. 60 // try to activate |window|.
61 aura::Window* GetActivatableWindow(aura::Window* window); 61 aura::Window* GetActivatableWindow(aura::Window* window);
62 62
63 aura::RootWindow* root_window_; 63 aura::RootWindow* root_window_;
64 64
65 // The current active window. 65 // The current active window.
66 aura::Window* current_active_; 66 aura::Window* current_active_;
67 67
68 // True inside ActivateWindow(). Used to prevent recursion of focus 68 // True inside ActivateWindow(). Used to prevent recursion of focus
69 // change notifications causing activation. 69 // change notifications causing activation.
70 bool updating_activation_; 70 bool updating_activation_;
71 71
72 ObserverList<aura::client::ActivationChangeObserver> observers_; 72 ObserverList<aura::client::ActivationChangeObserver> observers_;
73 73
74 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_; 74 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_;
75 75
76 DISALLOW_COPY_AND_ASSIGN(DesktopActivationClient); 76 DISALLOW_COPY_AND_ASSIGN(DesktopActivationClient);
77 }; 77 };
78 78
79 } // namespace views 79 } // namespace views
80 80
81 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESTKOP_ACTIVATION_CLIENT_H_ 81 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESTKOP_ACTIVATION_CLIENT_H_
OLDNEW
« no previous file with comments | « ui/views/focus/focus_manager_unittest.cc ('k') | ui/views/widget/desktop_aura/desktop_activation_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698