diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-04 19:06:11 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-06-04 19:06:11 +0000 |
commit | e76310a9610bddcd92d2243594a79dd3bf177cf7 (patch) | |
tree | 1d9c441355fd4c514a3152bf09ef213c47454648 /ui/aura/client | |
parent | 6f80e93517be32b944ab78442d27cea032c56680 (diff) | |
download | chromium_src-e76310a9610bddcd92d2243594a79dd3bf177cf7.zip chromium_src-e76310a9610bddcd92d2243594a79dd3bf177cf7.tar.gz chromium_src-e76310a9610bddcd92d2243594a79dd3bf177cf7.tar.bz2 |
Add ActivationChangeObserver, replacing kRootWindowActiveWindowKey
BUG=123160
TEST=no functional change. all test must pass.
Review URL: https://chromiumcodereview.appspot.com/10500006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140340 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura/client')
-rw-r--r-- | ui/aura/client/activation_change_observer.h | 31 | ||||
-rw-r--r-- | ui/aura/client/activation_client.cc | 1 | ||||
-rw-r--r-- | ui/aura/client/activation_client.h | 11 |
3 files changed, 36 insertions, 7 deletions
diff --git a/ui/aura/client/activation_change_observer.h b/ui/aura/client/activation_change_observer.h new file mode 100644 index 0000000..bcaf900 --- /dev/null +++ b/ui/aura/client/activation_change_observer.h @@ -0,0 +1,31 @@ +// Copyright (c) 2012 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_ACTIVATION_CHANGE_OBSERVER_H_ +#define UI_AURA_CLIENT_ACTIVATION_CHANGE_OBSERVER_H_ +#pragma once + +#include "ui/aura/aura_export.h" + +namespace aura { +class Window; + +namespace client { + +class AURA_EXPORT ActivationChangeObserver { + public: + // Called when |active| gains focus, or there is no active window + // (|active| is NULL in this case.) |old_active| refers to the + // previous active window or NULL if there was no previously active + // window. + virtual void OnWindowActivated(Window* active, Window* old_active) = 0; + + protected: + virtual ~ActivationChangeObserver() {} +}; + +} // namespace client +} // namespace aura + +#endif // UI_AURA_CLIENT_ACTIVATION_CHANGE_OBSERVER_H_ diff --git a/ui/aura/client/activation_client.cc b/ui/aura/client/activation_client.cc index e9a5838..9348eb4 100644 --- a/ui/aura/client/activation_client.cc +++ b/ui/aura/client/activation_client.cc @@ -14,7 +14,6 @@ DECLARE_EXPORTED_WINDOW_PROPERTY_TYPE(AURA_EXPORT, bool); namespace aura { namespace client { -DEFINE_WINDOW_PROPERTY_KEY(Window*, kRootWindowActiveWindowKey, NULL); DEFINE_WINDOW_PROPERTY_KEY( ActivationClient*, kRootWindowActivationClientKey, NULL); DEFINE_WINDOW_PROPERTY_KEY(bool, kHideOnDeactivate, false); diff --git a/ui/aura/client/activation_client.h b/ui/aura/client/activation_client.h index 7996a05..2d221dc 100644 --- a/ui/aura/client/activation_client.h +++ b/ui/aura/client/activation_client.h @@ -10,15 +10,19 @@ #include "ui/aura/window.h" namespace aura { - class Event; class RootWindow; namespace client { +class ActivationChangeObserver; // An interface implemented by an object that manages window activation. class AURA_EXPORT ActivationClient { public: + // Adds/Removes ActivationChangeObservers. + virtual void AddObserver(ActivationChangeObserver* observer) = 0; + virtual void RemoveObserver(ActivationChangeObserver* observer) = 0; + // Activates |window|. If |window| is NULL, nothing happens. virtual void ActivateWindow(Window* window) = 0; @@ -46,11 +50,6 @@ AURA_EXPORT void SetActivationClient(RootWindow* root_window, ActivationClient* client); AURA_EXPORT ActivationClient* GetActivationClient(RootWindow* root_window); -// A property key to store what the client defines as the active window on the -// RootWindow. -AURA_EXPORT extern const WindowProperty<Window*>* const - kRootWindowActiveWindowKey; - // Some types of transient window are only visible when active. // The transient parents of these windows may have visual appearance properties // that differ from transient parents that can be deactivated. |