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

Unified Diff: ui/aura/client/default_activation_client.h

Issue 261553002: Revert of Move DefaultActivationClient to wm/core (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura/aura.gyp ('k') | ui/aura/client/default_activation_client.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/client/default_activation_client.h
diff --git a/ui/aura/client/default_activation_client.h b/ui/aura/client/default_activation_client.h
new file mode 100644
index 0000000000000000000000000000000000000000..47e19dbc561995cd3cb5a9a8fc27e1ffb274920b
--- /dev/null
+++ b/ui/aura/client/default_activation_client.h
@@ -0,0 +1,69 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef UI_AURA_CLIENT_DEFAULT_ACTIVATION_CLIENT_H_
+#define UI_AURA_CLIENT_DEFAULT_ACTIVATION_CLIENT_H_
+
+#include <vector>
+
+#include "base/compiler_specific.h"
+#include "base/logging.h"
+#include "base/observer_list.h"
+#include "ui/aura/aura_export.h"
+#include "ui/aura/window_observer.h"
+#include "ui/wm/public/activation_client.h"
+
+namespace aura {
+namespace client {
+class ActivationChangeObserver;
+}
+
+namespace client {
+
+// Simple ActivationClient implementation for use by tests and other targets
+// that just need basic behavior (e.g. activate windows whenever requested,
+// restack windows at the top when they're activated, etc.).
+class AURA_EXPORT DefaultActivationClient : public client::ActivationClient,
+ public WindowObserver {
+ public:
+ explicit DefaultActivationClient(Window* root_window);
+ virtual ~DefaultActivationClient();
+
+ // Overridden from client::ActivationClient:
+ virtual void AddObserver(client::ActivationChangeObserver* observer) OVERRIDE;
+ virtual void RemoveObserver(
+ client::ActivationChangeObserver* observer) OVERRIDE;
+ virtual void ActivateWindow(Window* window) OVERRIDE;
+ virtual void DeactivateWindow(Window* window) OVERRIDE;
+ virtual Window* GetActiveWindow() OVERRIDE;
+ virtual Window* GetActivatableWindow(Window* window) OVERRIDE;
+ virtual Window* GetToplevelWindow(Window* window) OVERRIDE;
+ virtual bool OnWillFocusWindow(Window* window,
+ const ui::Event* event) OVERRIDE;
+ virtual bool CanActivateWindow(Window* window) const OVERRIDE;
+
+ // Overridden from WindowObserver:
+ virtual void OnWindowDestroyed(Window* window) OVERRIDE;
+
+ private:
+ void RemoveActiveWindow(Window* window);
+
+ // This class explicitly does NOT store the active window in a window property
+ // to make sure that ActivationChangeObserver is not treated as part of the
+ // aura API. Assumptions to that end will cause tests that use this client to
+ // fail.
+ std::vector<Window*> active_windows_;
+
+ // The window which was active before the currently active one.
+ Window* last_active_;
+
+ ObserverList<client::ActivationChangeObserver> observers_;
+
+ DISALLOW_COPY_AND_ASSIGN(DefaultActivationClient);
+};
+
+} // namespace client
+} // namespace aura
+
+#endif // UI_AURA_CLIENT_DEFAULT_ACTIVATION_CLIENT_H_
« no previous file with comments | « ui/aura/aura.gyp ('k') | ui/aura/client/default_activation_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698