summaryrefslogtreecommitdiffstats
path: root/ash/wm/shadow_controller.h
diff options
context:
space:
mode:
authorben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-23 01:04:56 +0000
committerben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-23 01:04:56 +0000
commit7585967a09c178beb19d154411e16d0bf460b98c (patch)
treecc081a045d88728d3ec1afccdf603278f9a9fd6a /ash/wm/shadow_controller.h
parent7d578660a7d482216efbac91434fd30bb122a154 (diff)
downloadchromium_src-7585967a09c178beb19d154411e16d0bf460b98c.zip
chromium_src-7585967a09c178beb19d154411e16d0bf460b98c.tar.gz
chromium_src-7585967a09c178beb19d154411e16d0bf460b98c.tar.bz2
Move some more files into ash... this time seed the window manager dir.
http://crbug.com/108457 TEST=none TBR=sky Review URL: http://codereview.chromium.org/9026017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115655 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/shadow_controller.h')
-rw-r--r--ash/wm/shadow_controller.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/ash/wm/shadow_controller.h b/ash/wm/shadow_controller.h
new file mode 100644
index 0000000..82f2e45
--- /dev/null
+++ b/ash/wm/shadow_controller.h
@@ -0,0 +1,89 @@
+// 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.
+
+#ifndef ASH_WM_SHADOW_CONTROLLER_H_
+#define ASH_WM_SHADOW_CONTROLLER_H_
+#pragma once
+
+#include <map>
+
+#include "base/basictypes.h"
+#include "base/compiler_specific.h"
+#include "base/memory/linked_ptr.h"
+#include "ui/aura/root_window_observer.h"
+#include "ui/aura/window_observer.h"
+#include "ui/aura_shell/aura_shell_export.h"
+
+namespace aura {
+class Window;
+}
+namespace gfx {
+class Rect;
+}
+
+namespace aura_shell {
+namespace internal {
+
+class Shadow;
+
+// ShadowController observes changes to windows and creates and updates drop
+// shadows as needed.
+class AURA_SHELL_EXPORT ShadowController : public aura::RootWindowObserver,
+ public aura::WindowObserver {
+public:
+ class TestApi {
+ public:
+ explicit TestApi(ShadowController* controller) : controller_(controller) {}
+ ~TestApi() {}
+
+ Shadow* GetShadowForWindow(aura::Window* window) {
+ return controller_->GetShadowForWindow(window);
+ }
+
+ private:
+ ShadowController* controller_; // not owned
+
+ DISALLOW_COPY_AND_ASSIGN(TestApi);
+ };
+
+ explicit ShadowController();
+ virtual ~ShadowController();
+
+ // aura::RootWindowObserver override:
+ virtual void OnWindowInitialized(aura::Window* window) OVERRIDE;
+
+ // aura::WindowObserver overrides:
+ virtual void OnWindowPropertyChanged(
+ aura::Window* window, const char* name, void* old) OVERRIDE;
+ virtual void OnWindowBoundsChanged(
+ aura::Window* window, const gfx::Rect& bounds) OVERRIDE;
+ virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE;
+
+ private:
+ typedef std::map<aura::Window*, linked_ptr<Shadow> > WindowShadowMap;
+
+ // Checks if |window| is visible and contains a property requesting a shadow.
+ bool ShouldShowShadowForWindow(aura::Window* window) const;
+
+ // Returns |window|'s shadow from |window_shadows_|, or NULL if no shadow
+ // exists.
+ Shadow* GetShadowForWindow(aura::Window* window);
+
+ // Shows or hides |window|'s shadow as needed (creating the shadow if
+ // necessary).
+ void HandlePossibleShadowVisibilityChange(aura::Window* window);
+
+ // Creates a new shadow for |window| and stores it in |window_shadows_|. The
+ // shadow's bounds are initialized and it is added to the window's layer.
+ void CreateShadowForWindow(aura::Window* window);
+
+ WindowShadowMap window_shadows_;
+
+ DISALLOW_COPY_AND_ASSIGN(ShadowController);
+};
+
+} // namepsace aura_shell
+} // namepsace internal
+
+#endif // ASH_WM_SHADOW_CONTROLLER_H_