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

Side by Side Diff: ui/wm/core/default_activation_client.h

Issue 250113002: Move DefaultActivationClient to wm/core (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 7 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
« no previous file with comments | « ui/wm/core/compound_event_filter_unittest.cc ('k') | ui/wm/core/default_activation_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2013 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_WM_CORE_DEFAULT_ACTIVATION_CLIENT_H_
6 #define UI_WM_CORE_DEFAULT_ACTIVATION_CLIENT_H_
7
8 #include <vector>
9
10 #include "base/compiler_specific.h"
11 #include "base/logging.h"
12 #include "base/observer_list.h"
13 #include "ui/aura/window_observer.h"
14 #include "ui/wm/public/activation_client.h"
15 #include "ui/wm/wm_export.h"
16
17 namespace aura {
18 namespace client {
19 class ActivationChangeObserver;
20 }
21 }
22
23 namespace wm {
24
25 // Simple ActivationClient implementation for use by tests and other targets
26 // that just need basic behavior (e.g. activate windows whenever requested,
27 // restack windows at the top when they're activated, etc.). This object deletes
28 // itself when the root window it is associated with is destroyed.
29 class WM_EXPORT DefaultActivationClient : public aura::client::ActivationClient,
30 public aura::WindowObserver {
31 public:
32 explicit DefaultActivationClient(aura::Window* root_window);
33
34 // Overridden from aura::client::ActivationClient:
35 virtual void AddObserver(
36 aura::client::ActivationChangeObserver* observer) OVERRIDE;
37 virtual void RemoveObserver(
38 aura::client::ActivationChangeObserver* observer) OVERRIDE;
39 virtual void ActivateWindow(aura::Window* window) OVERRIDE;
40 virtual void DeactivateWindow(aura::Window* window) OVERRIDE;
41 virtual aura::Window* GetActiveWindow() OVERRIDE;
42 virtual aura::Window* GetActivatableWindow(aura::Window* window) OVERRIDE;
43 virtual aura::Window* GetToplevelWindow(aura::Window* window) OVERRIDE;
44 virtual bool OnWillFocusWindow(aura::Window* window,
45 const ui::Event* event) OVERRIDE;
46 virtual bool CanActivateWindow(aura::Window* window) const OVERRIDE;
47
48 // Overridden from WindowObserver:
49 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
50
51 private:
52 class Deleter;
53
54 virtual ~DefaultActivationClient();
55 void RemoveActiveWindow(aura::Window* window);
56
57 // This class explicitly does NOT store the active window in a window property
58 // to make sure that ActivationChangeObserver is not treated as part of the
59 // aura API. Assumptions to that end will cause tests that use this client to
60 // fail.
61 std::vector<aura::Window*> active_windows_;
62
63 // The window which was active before the currently active one.
64 aura::Window* last_active_;
65
66 ObserverList<aura::client::ActivationChangeObserver> observers_;
67
68 DISALLOW_COPY_AND_ASSIGN(DefaultActivationClient);
69 };
70
71 } // namespace wm
72
73 #endif // UI_WM_CORE_DEFAULT_ACTIVATION_CLIENT_H_
OLDNEW
« no previous file with comments | « ui/wm/core/compound_event_filter_unittest.cc ('k') | ui/wm/core/default_activation_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698