Remove support for specifying version on command line.
[chromium-blink-merge.git] / ui / aura / client / default_activation_client.h
blob842ee909d624b4b4cdc1f94e776347174db682bf
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.
5 #ifndef UI_AURA_CLIENT_DEFAULT_ACTIVATION_CLIENT_H_
6 #define UI_AURA_CLIENT_DEFAULT_ACTIVATION_CLIENT_H_
8 #include <vector>
10 #include "base/compiler_specific.h"
11 #include "base/logging.h"
12 #include "base/observer_list.h"
13 #include "ui/aura/aura_export.h"
14 #include "ui/aura/client/activation_client.h"
15 #include "ui/aura/window_observer.h"
17 namespace aura {
18 namespace client {
19 class ActivationChangeObserver;
22 namespace client {
24 // Simple ActivationClient implementation for use by tests and other targets
25 // that just need basic behavior (e.g. activate windows whenever requested,
26 // restack windows at the top when they're activated, etc.).
27 class AURA_EXPORT DefaultActivationClient : public client::ActivationClient,
28 public WindowObserver {
29 public:
30 explicit DefaultActivationClient(Window* root_window);
31 virtual ~DefaultActivationClient();
33 // Overridden from client::ActivationClient:
34 virtual void AddObserver(client::ActivationChangeObserver* observer) OVERRIDE;
35 virtual void RemoveObserver(
36 client::ActivationChangeObserver* observer) OVERRIDE;
37 virtual void ActivateWindow(Window* window) OVERRIDE;
38 virtual void DeactivateWindow(Window* window) OVERRIDE;
39 virtual Window* GetActiveWindow() OVERRIDE;
40 virtual Window* GetActivatableWindow(Window* window) OVERRIDE;
41 virtual Window* GetToplevelWindow(Window* window) OVERRIDE;
42 virtual bool OnWillFocusWindow(Window* window,
43 const ui::Event* event) OVERRIDE;
44 virtual bool CanActivateWindow(Window* window) const OVERRIDE;
46 // Overridden from WindowObserver:
47 virtual void OnWindowDestroyed(Window* window) OVERRIDE;
49 private:
50 void RemoveActiveWindow(Window* window);
52 // This class explicitly does NOT store the active window in a window property
53 // to make sure that ActivationChangeObserver is not treated as part of the
54 // aura API. Assumptions to that end will cause tests that use this client to
55 // fail.
56 std::vector<Window*> active_windows_;
58 // The window which was active before the currently active one.
59 Window* last_active_;
61 ObserverList<client::ActivationChangeObserver> observers_;
63 DISALLOW_COPY_AND_ASSIGN(DefaultActivationClient);
66 } // namespace client
67 } // namespace aura
69 #endif // UI_AURA_CLIENT_DEFAULT_ACTIVATION_CLIENT_H_