1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef UI_VIEWS_COREWM_SHADOW_CONTROLLER_H_ 6 #define UI_VIEWS_COREWM_SHADOW_CONTROLLER_H_ 7 8 #include <map> 9 10 #include "base/basictypes.h" 11 #include "base/compiler_specific.h" 12 #include "base/memory/ref_counted.h" 13 #include "ui/aura/client/activation_change_observer.h" 14 #include "ui/views/views_export.h" 15 16 namespace aura { 17 class Window; 18 namespace client { 19 class ActivationClient; 20 } 21 } 22 namespace gfx { 23 class Rect; 24 } 25 26 namespace views { 27 namespace corewm { 28 29 class Shadow; 30 31 // ShadowController observes changes to windows and creates and updates drop 32 // shadows as needed. ShadowController itself is light weight and per 33 // ActivationClient. ShadowController delegates to its implementation class, 34 // which observes all window creation. 35 class VIEWS_EXPORT ShadowController : 36 public aura::client::ActivationChangeObserver { 37 public: 38 class VIEWS_EXPORT TestApi { 39 public: 40 explicit TestApi(ShadowController* controller) : controller_(controller) {} 41 ~TestApi() {} 42 43 Shadow* GetShadowForWindow(aura::Window* window); 44 45 private: 46 ShadowController* controller_; // not owned 47 48 DISALLOW_COPY_AND_ASSIGN(TestApi); 49 }; 50 51 explicit ShadowController(aura::client::ActivationClient* activation_client); 52 virtual ~ShadowController(); 53 54 // aura::client::ActivationChangeObserver overrides: 55 virtual void OnWindowActivated(aura::Window* gained_active, 56 aura::Window* lost_active) OVERRIDE; 57 58 private: 59 class Impl; 60 61 aura::client::ActivationClient* activation_client_; 62 63 scoped_refptr<Impl> impl_; 64 65 DISALLOW_COPY_AND_ASSIGN(ShadowController); 66 }; 67 68 } // namespace corewm 69 } // namespace views 70 71 #endif // UI_VIEWS_COREWM_SHADOW_CONTROLLER_H_ 72