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 ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ 6 #define ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ 7 8 #include "ash/ash_export.h" 9 #include "ash/shelf/shelf_types.h" 10 #include "ash/wm/gestures/shelf_gesture_handler.h" 11 #include "ui/gfx/image/image_skia.h" 12 #include "ui/views/accessible_pane_view.h" 13 #include "ui/views/widget/widget_delegate.h" 14 15 namespace ash { 16 namespace internal { 17 18 class FocusCycler; 19 20 class ASH_EXPORT StatusAreaWidgetDelegate : public views::AccessiblePaneView, 21 public views::WidgetDelegate { 22 public: 23 StatusAreaWidgetDelegate(); 24 virtual ~StatusAreaWidgetDelegate(); 25 26 // Add a tray view to the widget (e.g. system tray, web notifications). 27 void AddTray(views::View* tray); 28 29 // Called whenever layout might change (e.g. alignment changed). 30 void UpdateLayout(); 31 32 // Sets the focus cycler. 33 void SetFocusCyclerForTesting(const FocusCycler* focus_cycler); 34 35 void set_alignment(ShelfAlignment alignment) { alignment_ = alignment; } 36 37 // Overridden from views::AccessiblePaneView. 38 virtual View* GetDefaultFocusableChild() OVERRIDE; 39 40 // Overridden from views::View: 41 virtual views::Widget* GetWidget() OVERRIDE; 42 virtual const views::Widget* GetWidget() const OVERRIDE; 43 44 // Overridden from ui::EventHandler: 45 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; 46 47 // views::WidgetDelegate overrides: 48 virtual bool CanActivate() const OVERRIDE; 49 virtual void DeleteDelegate() OVERRIDE; 50 51 protected: 52 // Overridden from views::View: 53 virtual void ChildPreferredSizeChanged(views::View* child) OVERRIDE; 54 virtual void ChildVisibilityChanged(views::View* child) OVERRIDE; 55 56 private: 57 void UpdateWidgetSize(); 58 59 const FocusCycler* focus_cycler_for_testing_; 60 ShelfAlignment alignment_; 61 62 ShelfGestureHandler gesture_handler_; 63 64 DISALLOW_COPY_AND_ASSIGN(StatusAreaWidgetDelegate); 65 }; 66 67 } // namespace internal 68 } // namespace ash 69 70 #endif // ASH_SYSTEM_STATUS_AREA_WIDGET_DELEGATE_H_ 71