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

Side by Side Diff: ui/aura/desktop/desktop_activation_client.h

Issue 11062004: Fix crash in a few of the tests in content_browsertests on Linux. The problem was that DesktopActiv… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: actually need to use test compositor on bots Created 8 years, 2 months 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_AURA_DESKTOP_DESTKOP_ACTIVATION_CLIENT_H_ 5 #ifndef UI_AURA_DESKTOP_DESTKOP_ACTIVATION_CLIENT_H_
6 #define UI_AURA_DESKTOP_DESTKOP_ACTIVATION_CLIENT_H_ 6 #define UI_AURA_DESKTOP_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/aura_export.h" 11 #include "ui/aura/aura_export.h"
12 #include "ui/aura/client/activation_client.h" 12 #include "ui/aura/client/activation_client.h"
13 #include "ui/aura/env_observer.h" 13 #include "ui/aura/env_observer.h"
14 #include "ui/aura/focus_change_observer.h" 14 #include "ui/aura/focus_change_observer.h"
15 #include "ui/aura/root_window_observer.h" 15 #include "ui/aura/root_window_observer.h"
16 #include "ui/aura/window_observer.h" 16 #include "ui/aura/window_observer.h"
17 17
18 namespace aura { 18 namespace aura {
19 class FocusManager; 19 class FocusManager;
20 namespace client { 20 namespace client {
21 class ActivationChangeObserver; 21 class ActivationChangeObserver;
22 } 22 }
23 23
24 // An activation client that handles activation events in a single 24 // An activation client that handles activation events in a single
25 // RootWindow. Used only on the Desktop where there can be multiple RootWindow 25 // RootWindow. Used only on the Desktop where there can be multiple RootWindow
26 // objects. 26 // objects.
27 class AURA_EXPORT DesktopActivationClient : public client::ActivationClient, 27 class AURA_EXPORT DesktopActivationClient : public client::ActivationClient,
28 public WindowObserver, 28 public WindowObserver,
29 public EnvObserver,
30 public FocusChangeObserver { 29 public FocusChangeObserver {
31 public: 30 public:
32 explicit DesktopActivationClient(FocusManager* focus_manager); 31 explicit DesktopActivationClient(FocusManager* focus_manager);
33 virtual ~DesktopActivationClient(); 32 virtual ~DesktopActivationClient();
34 33
35 // ActivationClient: 34 // ActivationClient:
36 virtual void AddObserver(client::ActivationChangeObserver* observer) OVERRIDE; 35 virtual void AddObserver(client::ActivationChangeObserver* observer) OVERRIDE;
37 virtual void RemoveObserver( 36 virtual void RemoveObserver(
38 client::ActivationChangeObserver* observer) OVERRIDE; 37 client::ActivationChangeObserver* observer) OVERRIDE;
39 virtual void ActivateWindow(Window* window) OVERRIDE; 38 virtual void ActivateWindow(Window* window) OVERRIDE;
40 virtual void DeactivateWindow(Window* window) OVERRIDE; 39 virtual void DeactivateWindow(Window* window) OVERRIDE;
41 virtual aura::Window* GetActiveWindow() OVERRIDE; 40 virtual aura::Window* GetActiveWindow() OVERRIDE;
42 virtual bool OnWillFocusWindow(Window* window, 41 virtual bool OnWillFocusWindow(Window* window,
43 const ui::Event* event) OVERRIDE; 42 const ui::Event* event) OVERRIDE;
44 virtual bool CanActivateWindow(Window* window) const OVERRIDE; 43 virtual bool CanActivateWindow(Window* window) const OVERRIDE;
45 44
46 // Overridden from aura::WindowObserver: 45 // Overridden from aura::WindowObserver:
47 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE; 46 virtual void OnWindowDestroying(aura::Window* window) OVERRIDE;
48 47
49 // Overridden from aura::EnvObserver:
50 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE;
51
52 // Overridden from aura::FocusChangeObserver: 48 // Overridden from aura::FocusChangeObserver:
53 virtual void OnWindowFocused(aura::Window* window) OVERRIDE; 49 virtual void OnWindowFocused(aura::Window* window) OVERRIDE;
54 50
55 protected: 51 protected:
56 // Walks up the chain to find the correct parent window to activate when we 52 // Walks up the chain to find the correct parent window to activate when we
57 // try to activate |window|. 53 // try to activate |window|.
58 aura::Window* GetActivatableWindow(aura::Window* window); 54 aura::Window* GetActivatableWindow(aura::Window* window);
59 55
60 // The focus manager that we collaborate with. 56 // The focus manager that we collaborate with.
61 FocusManager* focus_manager_; 57 FocusManager* focus_manager_;
62 58
63 // The current active window. 59 // The current active window.
64 Window* current_active_; 60 Window* current_active_;
65 61
66 // True inside ActivateWindow(). Used to prevent recursion of focus 62 // True inside ActivateWindow(). Used to prevent recursion of focus
67 // change notifications causing activation. 63 // change notifications causing activation.
68 bool updating_activation_; 64 bool updating_activation_;
69 65
70 ObserverList<client::ActivationChangeObserver> observers_; 66 ObserverList<client::ActivationChangeObserver> observers_;
71 67
72 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_; 68 ScopedObserver<aura::Window, aura::WindowObserver> observer_manager_;
73 69
74 DISALLOW_COPY_AND_ASSIGN(DesktopActivationClient); 70 DISALLOW_COPY_AND_ASSIGN(DesktopActivationClient);
75 }; 71 };
76 72
77 } // namespace aura 73 } // namespace aura
78 74
79 #endif // UI_AURA_DESKTOP_DESTKOP_ACTIVATION_CLIENT_H_ 75 #endif // UI_AURA_DESKTOP_DESTKOP_ACTIVATION_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698