diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-10 20:53:27 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-10 20:53:27 +0000 |
commit | 17eae598cc52d3cd95597c07dc35469369c59010 (patch) | |
tree | d8819cf216863ddcf94928ae647ab566016c7b71 /ui/aura/client/default_activation_client.h | |
parent | 4b2f65784504669a14cf7d93a9b97bcc81ab62a3 (diff) | |
download | chromium_src-17eae598cc52d3cd95597c07dc35469369c59010.zip chromium_src-17eae598cc52d3cd95597c07dc35469369c59010.tar.gz chromium_src-17eae598cc52d3cd95597c07dc35469369c59010.tar.bz2 |
Move MinimalShell to ui/shell.
Move the MinimalShell class from content to a new "shell"
library so it can be shared by app_shell. Also move
aura::test::TestActivationClient to
aura::client::DefaultActivationClient.
BUG=305404
Review URL: https://codereview.chromium.org/26699003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227986 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/client/default_activation_client.h')
-rw-r--r-- | ui/aura/client/default_activation_client.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/ui/aura/client/default_activation_client.h b/ui/aura/client/default_activation_client.h new file mode 100644 index 0000000..ebf04aa --- /dev/null +++ b/ui/aura/client/default_activation_client.h @@ -0,0 +1,67 @@ +// 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 "base/compiler_specific.h" +#include "base/logging.h" +#include "ui/aura/aura_export.h" +#include "ui/aura/client/activation_client.h" +#include "ui/aura/window_observer.h" + +namespace aura { +class RootWindow; +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(RootWindow* 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_ |