From da56a47ab4279016cd690e576bee1d81d414aac5 Mon Sep 17 00:00:00 2001 From: "ben@chromium.org" Date: Wed, 14 Dec 2011 06:02:34 +0000 Subject: Store StackingClient on RootWindow in a property. BUG=none TEST=existing unit tests. Review URL: http://codereview.chromium.org/8926008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@114369 0039d316-1c4b-4281-b951-d872f2087c98 --- ui/aura/client/aura_constants.cc | 1 + ui/aura/client/aura_constants.h | 4 ++++ ui/aura/client/stacking_client.cc | 24 ++++++++++++++++++++++++ ui/aura/client/stacking_client.h | 7 ++++++- 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 ui/aura/client/stacking_client.cc (limited to 'ui/aura/client') diff --git a/ui/aura/client/aura_constants.cc b/ui/aura/client/aura_constants.cc index c1d0d6e..c39dd15 100644 --- a/ui/aura/client/aura_constants.cc +++ b/ui/aura/client/aura_constants.cc @@ -16,6 +16,7 @@ const char kRootWindowDragDropClientKey[] = "RootWindowDragDropClient"; const char kRootWindowTooltipClientKey[] = "RootWindowTooltipClient"; const char kRootWindowActiveWindow[] = "RootWindowActiveWindow"; const char kRootWindowActivationClient[] = "RootWindowActivationClient"; +const char kRootWindowStackingClient[] = "RootWindowStackingClient"; const char kShadowTypeKey[] = "ShadowType"; const char kShowStateKey[] = "ShowState"; const char kTooltipTextKey[] = "TooltipText"; diff --git a/ui/aura/client/aura_constants.h b/ui/aura/client/aura_constants.h index f5f2920..191c7ad 100644 --- a/ui/aura/client/aura_constants.h +++ b/ui/aura/client/aura_constants.h @@ -46,6 +46,10 @@ AURA_EXPORT extern const char kRootWindowActiveWindow[]; // the value is |aura::ActivationClient*|. AURA_EXPORT extern const char kRootWindowActivationClient[]; +// A property key to store a client that handles window stacking. The type of +// the value is |aura::StackingClient*|. +AURA_EXPORT extern const char kRootWindowStackingClient[]; + // A property key for a value from aura::ShadowType describing the drop shadow // that should be displayed under the window. If unset, no shadow is displayed. AURA_EXPORT extern const char kShadowTypeKey[]; diff --git a/ui/aura/client/stacking_client.cc b/ui/aura/client/stacking_client.cc new file mode 100644 index 0000000..56f96e6 --- /dev/null +++ b/ui/aura/client/stacking_client.cc @@ -0,0 +1,24 @@ +// Copyright (c) 2011 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. + +#include "ui/aura/client/stacking_client.h" + +#include "ui/aura/client/aura_constants.h" +#include "ui/aura/root_window.h" + +namespace aura { + +// static +void StackingClient::SetStackingClient(StackingClient* stacking_client) { + RootWindow::GetInstance()->SetProperty(kRootWindowStackingClient, + stacking_client); +} + +// static +StackingClient* StackingClient::GetStackingClient() { + return reinterpret_cast( + RootWindow::GetInstance()->GetProperty(kRootWindowStackingClient)); +} + +} // namespace aura diff --git a/ui/aura/client/stacking_client.h b/ui/aura/client/stacking_client.h index 6e89636..60712e7 100644 --- a/ui/aura/client/stacking_client.h +++ b/ui/aura/client/stacking_client.h @@ -15,12 +15,17 @@ class Window; // An interface implemented by an object that stacks windows. class AURA_EXPORT StackingClient { public: - virtual ~StackingClient() {} + // Sets/Gets the StackingClient for the RootWindow. + static void SetStackingClient(StackingClient* stacking_client); + static StackingClient* GetStackingClient(); // Called by the Window when its parent is set to NULL. The delegate is given // an opportunity to inspect the window and add it to a default parent window // of its choosing. virtual void AddChildToDefaultParent(Window* window) = 0; + + protected: + virtual ~StackingClient() {} }; } // namespace aura -- cgit v1.1