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

Side by Side Diff: ui/aura_shell/activation_controller.h

Issue 8894018: Move the concept of Activation to the Shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 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_AURA_SHELL_ACTIVATION_CONTROLLER_H_
6 #define UI_AURA_SHELL_ACTIVATION_CONTROLLER_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "ui/aura/client/activation_client.h"
13 #include "ui/aura/root_window_observer.h"
14 #include "ui/aura/window_observer.h"
15
16 namespace aura_shell {
17 namespace internal {
18
19 class ActivationController : public aura::ActivationClient,
20 public aura::WindowObserver,
21 public aura::RootWindowObserver {
22 public:
23 ActivationController();
24 virtual ~ActivationController();
25
26 // Returns true if |window| exists within a container that supports
27 // activation.
28 static aura::Window* GetActivatableWindow(aura::Window* window);
29
30 // Returns true if |window| can be focused. To be focusable, |window| must
31 // exist inside an activatable window.
32 static bool CanFocusWindow(aura::Window* window);
33
34 // Overridden from aura::ActivationClient:
35 virtual void ActivateWindow(aura::Window* window) OVERRIDE;
36 virtual void DeactivateWindow(aura::Window* window) OVERRIDE;
37 virtual aura::Window* GetActiveWindow() OVERRIDE;
38
39 // Overridden from aura::WindowObserver:
40 virtual void OnWindowVisibilityChanged(aura::Window* window,
41 bool visible) OVERRIDE;
42 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
43
44 // Overridden from aura::RootWindowObserver:
45 virtual void OnWindowInitialized(aura::Window* window) OVERRIDE;
46 virtual void OnWindowFocused(aura::Window* window) OVERRIDE;
47
48 #if defined(UNIT_TEST)
49 void set_default_container_for_test(aura::Window* window) {
50 default_container_for_test_ = window;
51 }
52 #endif
53
54 private:
55 // Shifts activation to the next window, ignoring |window|.
56 void ActivateNextWindow(aura::Window* window);
57
58 // Returns the next window that should be activated, ignoring |ignore|.
59 aura::Window* GetTopmostWindowToActivate(aura::Window* ignore) const;
60
61 // True inside ActivateWindow(). Used to prevent recursion of focus
62 // change notifications causing activation.
63 bool updating_activation_;
64
65 // For tests that are not running with a Shell instance,
66 // ActivationController's attempts to locate the next active window in
67 // GetTopmostWindowToActivate() will crash, so we provide this way for such
68 // tests to specify a default container.
69 aura::Window* default_container_for_test_;
70
71 DISALLOW_COPY_AND_ASSIGN(ActivationController);
72 };
73
74 } // namespace internal
75 } // namespace aura_shell
76
77 #endif // UI_AURA_SHELL_ACTIVATION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698